forked from Iiqra/HelloWorldCmakeSample
-
Notifications
You must be signed in to change notification settings - Fork 0
189 lines (163 loc) · 4.73 KB
/
cicd.yml
File metadata and controls
189 lines (163 loc) · 4.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: CI+CD
on:
push:
branches:
- master
pull_request: {}
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
jobs:
build-win32:
name: Build Win32
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Installing vcpkg (windows)
run: |
cd ..
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
git checkout --force 2020.01
.\bootstrap-vcpkg.bat
.\vcpkg.exe install cppzmq:x64-windows
- name: Running cmake (windows)
run: |
cd ${{ github.workspace }}
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/../vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: MSBuild
working-directory: build
run: msbuild CMakeHelloWorld.sln
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: win32-hello-world
path: ${{ github.workspace }}\build\Debug\CMakeHelloWorld.exe
retention-days: 2
build-linux:
name: Build Linux
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Running cmake (linux)
run: |
cd ${{ github.workspace }}
mkdir build
cd build
cmake .. && make
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: linux-hello-world
path: build/CMakeHelloWorld
retention-days: 2
test-linux:
name: Test Linux
runs-on: ubuntu-latest
needs: [build-linux]
steps:
- uses: actions/download-artifact@v2
with:
name: linux-hello-world
- name: run
run: |
chmod +x CMakeHelloWorld
./CMakeHelloWorld
test-win32:
name: Test Win32
runs-on: windows-latest
needs: [build-win32]
steps:
- uses: actions/download-artifact@v2
with:
name: win32-hello-world
- name: run
run: ${{ github.workspace }}\CMakeHelloWorld.exe
deploy-win32-staging:
name: Deploy Win32 to Staging
if: github.event.ref == 'refs/heads/master'
needs: [test-win32, test-linux]
runs-on: windows-latest
environment:
name: win32-staging
url: 'http://win32.stage.cadence.com'
steps:
- name: Deploy
run: echo I am deploying!
deploy-linux-staging:
name: Deploy Linux to Staging
if: github.event.ref == 'refs/heads/master'
needs: [test-win32, test-linux]
runs-on: ubuntu-latest
environment:
name: linux-staging
url: 'http://linux.stage.cadence.com'
steps:
- name: Deploy
run: echo I am deploying!
deploy-win32-production:
name: Deploy Win32 to Production
needs: [deploy-linux-staging, deploy-win32-staging]
runs-on: ubuntu-latest
environment:
name: win32-production
url: 'http://win32.prod.cadence.com'
steps:
- name: Deploy
run: echo I am deploying!
deploy-linux-production:
name: Deploy Linux to Production
needs: [deploy-linux-staging, deploy-win32-staging]
runs-on: ubuntu-latest
environment:
name: linux-production
url: 'http://linux.prod.cadence.com'
steps:
- name: Deploy
run: echo I am deploying!
tag-release:
name: Tag / Release
runs-on: ubuntu-latest
needs: [deploy-linux-production, deploy-win32-production]
steps:
- name: tag
id: tag_version
uses: mathieudutour/github-tag-action@v5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
#- name: release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ steps.tag_version.outputs.new_tag }}
# release_name: Release ${{ steps.tag_version.outputs.new_tag }}
# body: ${{ steps.tag_version.outputs.changelog }}
- name: Download Linux
uses: actions/download-artifact@v2
with:
name: linux-hello-world
- name: Download Win32
uses: actions/download-artifact@v2
with:
name: win32-hello-world
- name: Archive Linux
run: zip linux.zip CMakeHelloWorld && zip win32.zip CMakeHelloWorld.exe
- name: Release
uses: ncipollo/release-action@v1
with:
name: "Release ${{ steps.tag_version.outputs.new_tag }}"
artifactContentType: application/zip
artifacts: "linux.zip,win32.zip"
body: "Linux / Win32 Hello World Binaries"
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.tag_version.outputs.new_tag }}