]>
Commit | Line | Data |
---|---|---|
df7375d7 | 1 | name: CI |
889cacb6 ĐTCD |
2 | |
3 | on: [push, pull_request] | |
4 | ||
5 | env: | |
6 | DEVELOPER: 1 | |
7 | ||
8 | jobs: | |
e76eec35 | 9 | ci-config: |
df7375d7 | 10 | name: config |
055747cd AM |
11 | runs-on: ubuntu-latest |
12 | outputs: | |
7d78d5fc | 13 | enabled: ${{ steps.check-ref.outputs.enabled }}${{ steps.skip-if-redundant.outputs.enabled }} |
eb5b03a9 | 14 | skip_concurrent: ${{ steps.check-ref.outputs.skip_concurrent }} |
055747cd AM |
15 | steps: |
16 | - name: try to clone ci-config branch | |
055747cd AM |
17 | run: | |
18 | git -c protocol.version=2 clone \ | |
19 | --no-tags \ | |
20 | --single-branch \ | |
21 | -b ci-config \ | |
22 | --depth 1 \ | |
23 | --no-checkout \ | |
24 | --filter=blob:none \ | |
25 | https://github.com/${{ github.repository }} \ | |
26 | config-repo && | |
b01aff8c | 27 | cd config-repo && |
2fcf7a8c | 28 | git checkout HEAD -- ci/config || : ignore |
055747cd AM |
29 | - id: check-ref |
30 | name: check whether CI is enabled for ref | |
31 | run: | | |
32 | enabled=yes | |
33 | if test -x config-repo/ci/config/allow-ref && | |
34 | ! config-repo/ci/config/allow-ref '${{ github.ref }}' | |
35 | then | |
36 | enabled=no | |
37 | fi | |
eb5b03a9 TB |
38 | |
39 | skip_concurrent=yes | |
40 | if test -x config-repo/ci/config/skip-concurrent && | |
41 | ! config-repo/ci/config/skip-concurrent '${{ github.ref }}' | |
42 | then | |
43 | skip_concurrent=no | |
44 | fi | |
f115c96e | 45 | echo "enabled=$enabled" >>$GITHUB_OUTPUT |
763f20fb | 46 | echo "skip_concurrent=$skip_concurrent" >>$GITHUB_OUTPUT |
7d78d5fc JS |
47 | - name: skip if the commit or tree was already tested |
48 | id: skip-if-redundant | |
63357b79 | 49 | uses: actions/github-script@v6 |
7d78d5fc JS |
50 | if: steps.check-ref.outputs.enabled == 'yes' |
51 | with: | |
52 | github-token: ${{secrets.GITHUB_TOKEN}} | |
53 | script: | | |
d6d66837 JS |
54 | try { |
55 | // Figure out workflow ID, commit and tree | |
63357b79 | 56 | const { data: run } = await github.rest.actions.getWorkflowRun({ |
d6d66837 JS |
57 | owner: context.repo.owner, |
58 | repo: context.repo.repo, | |
59 | run_id: context.runId, | |
60 | }); | |
61 | const workflow_id = run.workflow_id; | |
62 | const head_sha = run.head_sha; | |
63 | const tree_id = run.head_commit.tree_id; | |
7d78d5fc | 64 | |
d6d66837 | 65 | // See whether there is a successful run for that commit or tree |
63357b79 | 66 | const { data: runs } = await github.rest.actions.listWorkflowRuns({ |
d6d66837 JS |
67 | owner: context.repo.owner, |
68 | repo: context.repo.repo, | |
69 | per_page: 500, | |
70 | status: 'success', | |
71 | workflow_id, | |
72 | }); | |
73 | for (const run of runs.workflow_runs) { | |
74 | if (head_sha === run.head_sha) { | |
75 | core.warning(`Successful run for the commit ${head_sha}: ${run.html_url}`); | |
76 | core.setOutput('enabled', ' but skip'); | |
77 | break; | |
78 | } | |
79 | if (run.head_commit && tree_id === run.head_commit.tree_id) { | |
80 | core.warning(`Successful run for the tree ${tree_id}: ${run.html_url}`); | |
81 | core.setOutput('enabled', ' but skip'); | |
82 | break; | |
83 | } | |
7d78d5fc | 84 | } |
d6d66837 JS |
85 | } catch (e) { |
86 | core.warning(e); | |
7d78d5fc | 87 | } |
e76eec35 | 88 | |
889cacb6 | 89 | windows-build: |
df7375d7 | 90 | name: win build |
e76eec35 JK |
91 | needs: ci-config |
92 | if: needs.ci-config.outputs.enabled == 'yes' | |
889cacb6 | 93 | runs-on: windows-latest |
eb5b03a9 TB |
94 | concurrency: |
95 | group: windows-build-${{ github.ref }} | |
96 | cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }} | |
889cacb6 | 97 | steps: |
6cf4d908 | 98 | - uses: actions/checkout@v3 |
0eb6c189 | 99 | - uses: git-for-windows/setup-git-for-windows-sdk@v1 |
889cacb6 | 100 | - name: build |
0eb6c189 | 101 | shell: bash |
889cacb6 ĐTCD |
102 | env: |
103 | HOME: ${{runner.workspace}} | |
889cacb6 | 104 | NO_PERL: 1 |
7491ef61 | 105 | run: . /etc/profile && ci/make-test-artifacts.sh artifacts |
d681d0dc JS |
106 | - name: zip up tracked files |
107 | run: git archive -o artifacts/tracked.tar.gz HEAD | |
108 | - name: upload tracked files and build artifacts | |
1f398446 | 109 | uses: actions/upload-artifact@v3 |
889cacb6 ĐTCD |
110 | with: |
111 | name: windows-artifacts | |
112 | path: artifacts | |
113 | windows-test: | |
df7375d7 | 114 | name: win test |
889cacb6 | 115 | runs-on: windows-latest |
eb5b03a9 | 116 | needs: [ci-config, windows-build] |
889cacb6 | 117 | strategy: |
2b0e14f6 | 118 | fail-fast: false |
889cacb6 ĐTCD |
119 | matrix: |
120 | nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
eb5b03a9 TB |
121 | concurrency: |
122 | group: windows-test-${{ matrix.nr }}-${{ github.ref }} | |
123 | cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }} | |
889cacb6 | 124 | steps: |
d681d0dc | 125 | - name: download tracked files and build artifacts |
1f398446 | 126 | uses: actions/download-artifact@v3 |
889cacb6 ĐTCD |
127 | with: |
128 | name: windows-artifacts | |
129 | path: ${{github.workspace}} | |
d681d0dc | 130 | - name: extract tracked files and build artifacts |
889cacb6 | 131 | shell: bash |
d681d0dc | 132 | run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz |
0eb6c189 | 133 | - uses: git-for-windows/setup-git-for-windows-sdk@v1 |
889cacb6 | 134 | - name: test |
0eb6c189 | 135 | shell: bash |
7491ef61 | 136 | run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10 |
5aeb1457 JS |
137 | - name: print test failures |
138 | if: failure() && env.FAILED_TEST_ARTIFACTS != '' | |
139 | shell: bash | |
140 | run: ci/print-test-failures.sh | |
f72f328b JS |
141 | - name: Upload failed tests' directories |
142 | if: failure() && env.FAILED_TEST_ARTIFACTS != '' | |
1f398446 | 143 | uses: actions/upload-artifact@v3 |
f72f328b JS |
144 | with: |
145 | name: failed-tests-windows | |
146 | path: ${{env.FAILED_TEST_ARTIFACTS}} | |
889cacb6 | 147 | vs-build: |
df7375d7 | 148 | name: win+VS build |
e76eec35 | 149 | needs: ci-config |
a0da6dee | 150 | if: github.event.repository.owner.login == 'git-for-windows' && needs.ci-config.outputs.enabled == 'yes' |
889cacb6 | 151 | env: |
889cacb6 ĐTCD |
152 | NO_PERL: 1 |
153 | GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'" | |
154 | runs-on: windows-latest | |
eb5b03a9 TB |
155 | concurrency: |
156 | group: vs-build-${{ github.ref }} | |
157 | cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }} | |
889cacb6 | 158 | steps: |
6cf4d908 | 159 | - uses: actions/checkout@v3 |
0eb6c189 | 160 | - uses: git-for-windows/setup-git-for-windows-sdk@v1 |
958a5f5d | 161 | - name: initialize vcpkg |
6cf4d908 | 162 | uses: actions/checkout@v3 |
958a5f5d DA |
163 | with: |
164 | repository: 'microsoft/vcpkg' | |
165 | path: 'compat/vcbuild/vcpkg' | |
889cacb6 ĐTCD |
166 | - name: download vcpkg artifacts |
167 | shell: powershell | |
168 | run: | | |
169 | $urlbase = "https://dev.azure.com/git/git/_apis/build/builds" | |
170 | $id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=9&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id | |
171 | $downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[0].resource.downloadUrl | |
172 | (New-Object Net.WebClient).DownloadFile($downloadUrl, "compat.zip") | |
173 | Expand-Archive compat.zip -DestinationPath . -Force | |
174 | Remove-Item compat.zip | |
175 | - name: add msbuild to PATH | |
17c13069 | 176 | uses: microsoft/setup-msbuild@v1 |
4c2c38e8 | 177 | - name: copy dlls to root |
abb2b389 JS |
178 | shell: cmd |
179 | run: compat\vcbuild\vcpkg_copy_dlls.bat release | |
4c2c38e8 SS |
180 | - name: generate Visual Studio solution |
181 | shell: bash | |
182 | run: | | |
183 | cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows \ | |
9ab0b661 | 184 | -DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON |
889cacb6 ĐTCD |
185 | - name: MSBuild |
186 | run: msbuild git.sln -property:Configuration=Release -property:Platform=x64 -maxCpuCount:4 -property:PlatformToolset=v142 | |
187 | - name: bundle artifact tar | |
0eb6c189 | 188 | shell: bash |
889cacb6 ĐTCD |
189 | env: |
190 | MSVC: 1 | |
191 | VCPKG_ROOT: ${{github.workspace}}\compat\vcbuild\vcpkg | |
192 | run: | | |
0eb6c189 | 193 | mkdir -p artifacts && |
9ab0b661 | 194 | eval "$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)" |
d681d0dc JS |
195 | - name: zip up tracked files |
196 | run: git archive -o artifacts/tracked.tar.gz HEAD | |
197 | - name: upload tracked files and build artifacts | |
1f398446 | 198 | uses: actions/upload-artifact@v3 |
889cacb6 ĐTCD |
199 | with: |
200 | name: vs-artifacts | |
201 | path: artifacts | |
202 | vs-test: | |
df7375d7 | 203 | name: win+VS test |
889cacb6 | 204 | runs-on: windows-latest |
eb5b03a9 | 205 | needs: [ci-config, vs-build] |
889cacb6 | 206 | strategy: |
2b0e14f6 | 207 | fail-fast: false |
889cacb6 ĐTCD |
208 | matrix: |
209 | nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
eb5b03a9 TB |
210 | concurrency: |
211 | group: vs-test-${{ matrix.nr }}-${{ github.ref }} | |
212 | cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }} | |
889cacb6 | 213 | steps: |
0eb6c189 | 214 | - uses: git-for-windows/setup-git-for-windows-sdk@v1 |
d681d0dc | 215 | - name: download tracked files and build artifacts |
1f398446 | 216 | uses: actions/download-artifact@v3 |
889cacb6 ĐTCD |
217 | with: |
218 | name: vs-artifacts | |
219 | path: ${{github.workspace}} | |
d681d0dc | 220 | - name: extract tracked files and build artifacts |
889cacb6 | 221 | shell: bash |
d681d0dc | 222 | run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz |
4c2c38e8 | 223 | - name: test |
0eb6c189 | 224 | shell: bash |
889cacb6 | 225 | env: |
889cacb6 | 226 | NO_SVN_TESTS: 1 |
7491ef61 | 227 | run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10 |
5aeb1457 JS |
228 | - name: print test failures |
229 | if: failure() && env.FAILED_TEST_ARTIFACTS != '' | |
230 | shell: bash | |
231 | run: ci/print-test-failures.sh | |
4c2c38e8 SS |
232 | - name: Upload failed tests' directories |
233 | if: failure() && env.FAILED_TEST_ARTIFACTS != '' | |
1f398446 | 234 | uses: actions/upload-artifact@v3 |
4c2c38e8 SS |
235 | with: |
236 | name: failed-tests-windows | |
237 | path: ${{env.FAILED_TEST_ARTIFACTS}} | |
889cacb6 | 238 | regular: |
df7375d7 | 239 | name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}}) |
e76eec35 JK |
240 | needs: ci-config |
241 | if: needs.ci-config.outputs.enabled == 'yes' | |
eb5b03a9 TB |
242 | concurrency: |
243 | group: ${{ matrix.vector.jobname }}-${{ matrix.vector.pool }}-${{ github.ref }} | |
244 | cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }} | |
889cacb6 | 245 | strategy: |
2b0e14f6 | 246 | fail-fast: false |
889cacb6 ĐTCD |
247 | matrix: |
248 | vector: | |
249 | - jobname: linux-clang | |
250 | cc: clang | |
251 | pool: ubuntu-latest | |
25715419 ÆAB |
252 | - jobname: linux-sha256 |
253 | cc: clang | |
25715419 | 254 | pool: ubuntu-latest |
889cacb6 ĐTCD |
255 | - jobname: linux-gcc |
256 | cc: gcc | |
707d2f2f | 257 | cc_package: gcc-8 |
0178420b | 258 | pool: ubuntu-20.04 |
25715419 ÆAB |
259 | - jobname: linux-TEST-vars |
260 | cc: gcc | |
25715419 | 261 | cc_package: gcc-8 |
0178420b | 262 | pool: ubuntu-20.04 |
889cacb6 ĐTCD |
263 | - jobname: osx-clang |
264 | cc: clang | |
d1119225 | 265 | pool: macos-12 |
889cacb6 ĐTCD |
266 | - jobname: osx-gcc |
267 | cc: gcc | |
707d2f2f | 268 | cc_package: gcc-9 |
d1119225 | 269 | pool: macos-12 |
6c280b41 | 270 | - jobname: linux-gcc-default |
889cacb6 ĐTCD |
271 | cc: gcc |
272 | pool: ubuntu-latest | |
956d2e46 ÆAB |
273 | - jobname: linux-leaks |
274 | cc: gcc | |
275 | pool: ubuntu-latest | |
1c0962c0 JH |
276 | - jobname: linux-asan |
277 | cc: gcc | |
278 | pool: ubuntu-latest | |
279 | - jobname: linux-ubsan | |
280 | cc: gcc | |
281 | pool: ubuntu-latest | |
889cacb6 ĐTCD |
282 | env: |
283 | CC: ${{matrix.vector.cc}} | |
707d2f2f | 284 | CC_PACKAGE: ${{matrix.vector.cc_package}} |
889cacb6 | 285 | jobname: ${{matrix.vector.jobname}} |
707d2f2f | 286 | runs_on_pool: ${{matrix.vector.pool}} |
889cacb6 ĐTCD |
287 | runs-on: ${{matrix.vector.pool}} |
288 | steps: | |
6cf4d908 | 289 | - uses: actions/checkout@v3 |
889cacb6 ĐTCD |
290 | - run: ci/install-dependencies.sh |
291 | - run: ci/run-build-and-tests.sh | |
7b341645 | 292 | - name: print test failures |
5aeb1457 | 293 | if: failure() && env.FAILED_TEST_ARTIFACTS != '' |
7b341645 | 294 | run: ci/print-test-failures.sh |
f72f328b JS |
295 | - name: Upload failed tests' directories |
296 | if: failure() && env.FAILED_TEST_ARTIFACTS != '' | |
1f398446 | 297 | uses: actions/upload-artifact@v3 |
f72f328b JS |
298 | with: |
299 | name: failed-tests-${{matrix.vector.jobname}} | |
300 | path: ${{env.FAILED_TEST_ARTIFACTS}} | |
889cacb6 | 301 | dockerized: |
df7375d7 | 302 | name: ${{matrix.vector.jobname}} (${{matrix.vector.image}}) |
e76eec35 JK |
303 | needs: ci-config |
304 | if: needs.ci-config.outputs.enabled == 'yes' | |
eb5b03a9 TB |
305 | concurrency: |
306 | group: dockerized-${{ matrix.vector.jobname }}-${{ matrix.vector.image }}-${{ github.ref }} | |
307 | cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }} | |
889cacb6 | 308 | strategy: |
2b0e14f6 | 309 | fail-fast: false |
889cacb6 ĐTCD |
310 | matrix: |
311 | vector: | |
312 | - jobname: linux-musl | |
313 | image: alpine | |
c08bb260 | 314 | - jobname: linux32 |
889cacb6 | 315 | image: daald/ubuntu32:xenial |
cebead1e CMAB |
316 | - jobname: pedantic |
317 | image: fedora | |
889cacb6 ĐTCD |
318 | env: |
319 | jobname: ${{matrix.vector.jobname}} | |
320 | runs-on: ubuntu-latest | |
321 | container: ${{matrix.vector.image}} | |
322 | steps: | |
6cf4d908 OD |
323 | - uses: actions/checkout@v3 |
324 | if: matrix.vector.jobname != 'linux32' | |
889cacb6 | 325 | - uses: actions/checkout@v1 |
6cf4d908 | 326 | if: matrix.vector.jobname == 'linux32' |
889cacb6 ĐTCD |
327 | - run: ci/install-docker-dependencies.sh |
328 | - run: ci/run-build-and-tests.sh | |
7b341645 | 329 | - name: print test failures |
5aeb1457 | 330 | if: failure() && env.FAILED_TEST_ARTIFACTS != '' |
7b341645 | 331 | run: ci/print-test-failures.sh |
f72f328b | 332 | - name: Upload failed tests' directories |
1f398446 JS |
333 | if: failure() && env.FAILED_TEST_ARTIFACTS != '' && matrix.vector.jobname != 'linux32' |
334 | uses: actions/upload-artifact@v3 | |
335 | with: | |
336 | name: failed-tests-${{matrix.vector.jobname}} | |
337 | path: ${{env.FAILED_TEST_ARTIFACTS}} | |
338 | - name: Upload failed tests' directories | |
339 | if: failure() && env.FAILED_TEST_ARTIFACTS != '' && matrix.vector.jobname == 'linux32' | |
3cf9bb36 | 340 | uses: actions/upload-artifact@v1 |
f72f328b JS |
341 | with: |
342 | name: failed-tests-${{matrix.vector.jobname}} | |
343 | path: ${{env.FAILED_TEST_ARTIFACTS}} | |
889cacb6 | 344 | static-analysis: |
e76eec35 JK |
345 | needs: ci-config |
346 | if: needs.ci-config.outputs.enabled == 'yes' | |
889cacb6 ĐTCD |
347 | env: |
348 | jobname: StaticAnalysis | |
ef465848 | 349 | runs-on: ubuntu-22.04 |
eb5b03a9 TB |
350 | concurrency: |
351 | group: static-analysis-${{ github.ref }} | |
352 | cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }} | |
889cacb6 | 353 | steps: |
6cf4d908 | 354 | - uses: actions/checkout@v3 |
889cacb6 ĐTCD |
355 | - run: ci/install-dependencies.sh |
356 | - run: ci/run-static-analysis.sh | |
0e7696c6 | 357 | - run: ci/check-directional-formatting.bash |
e6105966 JS |
358 | sparse: |
359 | needs: ci-config | |
360 | if: needs.ci-config.outputs.enabled == 'yes' | |
361 | env: | |
362 | jobname: sparse | |
363 | runs-on: ubuntu-20.04 | |
eb5b03a9 TB |
364 | concurrency: |
365 | group: sparse-${{ github.ref }} | |
366 | cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }} | |
e6105966 JS |
367 | steps: |
368 | - name: Download a current `sparse` package | |
369 | # Ubuntu's `sparse` version is too old for us | |
370 | uses: git-for-windows/get-azure-pipelines-artifact@v0 | |
371 | with: | |
372 | repository: git/git | |
373 | definitionId: 10 | |
374 | artifact: sparse-20.04 | |
375 | - name: Install the current `sparse` package | |
376 | run: sudo dpkg -i sparse-20.04/sparse_*.deb | |
6cf4d908 | 377 | - uses: actions/checkout@v3 |
27f45ccf JK |
378 | - name: Install other dependencies |
379 | run: ci/install-dependencies.sh | |
e6105966 | 380 | - run: make sparse |
889cacb6 | 381 | documentation: |
df7375d7 | 382 | name: documentation |
e76eec35 JK |
383 | needs: ci-config |
384 | if: needs.ci-config.outputs.enabled == 'yes' | |
eb5b03a9 TB |
385 | concurrency: |
386 | group: documentation-${{ github.ref }} | |
387 | cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }} | |
889cacb6 ĐTCD |
388 | env: |
389 | jobname: Documentation | |
390 | runs-on: ubuntu-latest | |
391 | steps: | |
6cf4d908 | 392 | - uses: actions/checkout@v3 |
889cacb6 ĐTCD |
393 | - run: ci/install-dependencies.sh |
394 | - run: ci/test-documentation.sh |