at commit 86909a94

1 name: CI
2
3 on: [push, pull_request]
4
5 env:
6 DEVELOPER: 1
7
8 # If more than one workflow run is triggered for the very same commit hash
9 # (which happens when multiple branches pointing to the same commit), only
10 # the first one is allowed to run, the second will be kept in the "queued"
11 # state. This allows a successful completion of the first run to be reused
12 # in the second run via the `skip-if-redundant` logic in the `config` job.
13 #
14 # The only caveat is that if a workflow run is triggered for the same commit
15 # hash that another run is already being held, that latter run will be
16 # canceled. For more details about the `concurrency` attribute, see:
17 # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
18 concurrency:
19 group: ${{ github.sha }}
20
21 jobs:
22 ci-config:
23 name: config
24 if: vars.CI_BRANCHES == '' || contains(vars.CI_BRANCHES, github.ref_name)
25 runs-on: ubuntu-latest
26 outputs:
27 enabled: ${{ steps.check-ref.outputs.enabled }}${{ steps.skip-if-redundant.outputs.enabled }}
28 skip_concurrent: ${{ steps.check-ref.outputs.skip_concurrent }}
29 steps:
30 - name: try to clone ci-config branch
31 run: |
32 git -c protocol.version=2 clone \
33 --no-tags \
34 --single-branch \
35 -b ci-config \
36 --depth 1 \
37 --no-checkout \
38 --filter=blob:none \
39 https://github.com/${{ github.repository }} \
40 config-repo &&
41 cd config-repo &&
42 git checkout HEAD -- ci/config || : ignore
43 - id: check-ref
44 name: check whether CI is enabled for ref
45 run: |
46 enabled=yes
47 if test -x config-repo/ci/config/allow-ref
48 then
49 echo "::warning::ci/config/allow-ref is deprecated; use CI_BRANCHES instead"
50 if ! config-repo/ci/config/allow-ref '${{ github.ref }}'
51 then
52 enabled=no
53 fi
54 fi
55
56 skip_concurrent=yes
57 if test -x config-repo/ci/config/skip-concurrent &&
58 ! config-repo/ci/config/skip-concurrent '${{ github.ref }}'
59 then
60 skip_concurrent=no
61 fi
62 echo "enabled=$enabled" >>$GITHUB_OUTPUT
63 echo "skip_concurrent=$skip_concurrent" >>$GITHUB_OUTPUT
64 - name: skip if the commit or tree was already tested
65 id: skip-if-redundant
66 uses: actions/github-script@v9
67 if: steps.check-ref.outputs.enabled == 'yes'
68 with:
69 github-token: ${{secrets.GITHUB_TOKEN}}
70 script: |
71 try {
72 // Figure out workflow ID, commit and tree
73 const { data: run } = await github.rest.actions.getWorkflowRun({
74 owner: context.repo.owner,
75 repo: context.repo.repo,
76 run_id: context.runId,
77 });
78 const workflow_id = run.workflow_id;
79 const head_sha = run.head_sha;
80 const tree_id = run.head_commit.tree_id;
81
82 // See whether there is a successful run for that commit or tree
83 const { data: runs } = await github.rest.actions.listWorkflowRuns({
84 owner: context.repo.owner,
85 repo: context.repo.repo,
86 per_page: 500,
87 status: 'success',
88 workflow_id,
89 });
90 for (const run of runs.workflow_runs) {
91 if (head_sha === run.head_sha) {
92 core.warning(`Successful run for the commit ${head_sha}: ${run.html_url}`);
93 core.setOutput('enabled', ' but skip');
94 break;
95 }
96 if (run.head_commit && tree_id === run.head_commit.tree_id) {
97 core.warning(`Successful run for the tree ${tree_id}: ${run.html_url}`);
98 core.setOutput('enabled', ' but skip');
99 break;
100 }
101 }
102 } catch (e) {
103 core.warning(e);
104 }
105
106 windows-build:
107 name: win build
108 needs: ci-config
109 if: needs.ci-config.outputs.enabled == 'yes'
110 runs-on: windows-latest
111 concurrency:
112 group: windows-build-${{ github.ref }}
113 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
114 steps:
115 - uses: actions/checkout@v6
116 - uses: git-for-windows/setup-git-for-windows-sdk@v2
117 - name: Install GCC-compatible Rust target
118 shell: bash
119 run: |
120 # The hosted Windows runners ship a rustup-managed Rust whose
121 # default toolchain targets the MSVC ABI. That produces a
122 # `gitcore.lib` which the MinGW GCC used by the rest of the
123 # build cannot link. Install the precompiled `std` for a
124 # GCC-compatible target triple matching the MSYS2 subsystem;
125 # the Makefile selects the same triple via $(MSYSTEM) and
126 # passes it to `cargo build --target`.
127 case "$MSYSTEM" in
128 CLANGARM64) target=aarch64-pc-windows-gnullvm ;;
129 CLANG64) target=x86_64-pc-windows-gnullvm ;;
130 CLANG32) target=i686-pc-windows-gnullvm ;;
131 UCRT64) target=x86_64-pc-windows-gnu ;;
132 MINGW64) target=x86_64-pc-windows-gnu ;;
133 MINGW32) target=i686-pc-windows-gnu ;;
134 *) echo "::error::Unsupported MSYSTEM: $MSYSTEM"; exit 1 ;;
135 esac &&
136 rustup target add "$target" &&
137
138 # Ensure that cargo.exe is found even with the minimal SDK's restricted PATH
139 CARGO="$(type -p cargo.exe)" &&
140 echo "export PATH=\$PATH:${CARGO%/cargo.exe}" >>/etc/profile
141 - name: build
142 shell: bash
143 env:
144 HOME: ${{runner.workspace}}
145 NO_PERL: 1
146 run: . /etc/profile && ci/make-test-artifacts.sh artifacts
147 - name: zip up tracked files
148 run: git archive -o artifacts/tracked.tar.gz HEAD
149 - name: upload tracked files and build artifacts
150 uses: actions/upload-artifact@v7
151 with:
152 name: windows-artifacts
153 path: artifacts
154 windows-test:
155 name: win test
156 runs-on: windows-latest
157 needs: [ci-config, windows-build]
158 strategy:
159 fail-fast: false
160 matrix:
161 nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
162 concurrency:
163 group: windows-test-${{ matrix.nr }}-${{ github.ref }}
164 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
165 steps:
166 - name: download tracked files and build artifacts
167 uses: actions/download-artifact@v8
168 with:
169 name: windows-artifacts
170 path: ${{github.workspace}}
171 - name: extract tracked files and build artifacts
172 shell: bash
173 run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz
174 - uses: git-for-windows/setup-git-for-windows-sdk@v2
175 - name: test
176 shell: bash
177 run: . /etc/profile && ci/run-test-slice.sh $((${{matrix.nr}} + 1)) 10
178 - name: print test failures
179 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
180 shell: bash
181 run: ci/print-test-failures.sh
182 - name: Upload failed tests' directories
183 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
184 uses: actions/upload-artifact@v7
185 with:
186 name: failed-tests-windows-${{ matrix.nr }}
187 path: ${{env.FAILED_TEST_ARTIFACTS}}
188 vs-build:
189 name: win+VS build
190 needs: ci-config
191 if: github.event.repository.owner.login == 'git-for-windows' && needs.ci-config.outputs.enabled == 'yes'
192 env:
193 NO_PERL: 1
194 GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'"
195 runs-on: windows-latest
196 concurrency:
197 group: vs-build-${{ github.ref }}
198 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
199 steps:
200 - uses: actions/checkout@v6
201 - uses: git-for-windows/setup-git-for-windows-sdk@v2
202 - name: initialize vcpkg
203 uses: actions/checkout@v6
204 with:
205 repository: 'microsoft/vcpkg'
206 path: 'compat/vcbuild/vcpkg'
207 - name: download vcpkg artifacts
208 uses: git-for-windows/get-azure-pipelines-artifact@v0
209 with:
210 repository: git/git
211 definitionId: 9
212 - name: add msbuild to PATH
213 uses: microsoft/setup-msbuild@v3
214 - name: copy dlls to root
215 shell: cmd
216 run: compat\vcbuild\vcpkg_copy_dlls.bat release
217 - name: generate Visual Studio solution
218 shell: bash
219 run: |
220 cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows \
221 -DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON
222 - name: MSBuild
223 run: msbuild git.sln -property:Configuration=Release -property:Platform=x64 -maxCpuCount:4 -property:PlatformToolset=v142
224 - name: bundle artifact tar
225 shell: bash
226 env:
227 MSVC: 1
228 VCPKG_ROOT: ${{github.workspace}}\compat\vcbuild\vcpkg
229 run: |
230 mkdir -p artifacts &&
231 eval "$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)"
232 - name: zip up tracked files
233 run: git archive -o artifacts/tracked.tar.gz HEAD
234 - name: upload tracked files and build artifacts
235 uses: actions/upload-artifact@v7
236 with:
237 name: vs-artifacts
238 path: artifacts
239 vs-test:
240 name: win+VS test
241 runs-on: windows-latest
242 needs: [ci-config, vs-build]
243 strategy:
244 fail-fast: false
245 matrix:
246 nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
247 concurrency:
248 group: vs-test-${{ matrix.nr }}-${{ github.ref }}
249 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
250 steps:
251 - uses: git-for-windows/setup-git-for-windows-sdk@v2
252 - name: download tracked files and build artifacts
253 uses: actions/download-artifact@v8
254 with:
255 name: vs-artifacts
256 path: ${{github.workspace}}
257 - name: extract tracked files and build artifacts
258 shell: bash
259 run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz
260 - name: test
261 shell: bash
262 env:
263 NO_SVN_TESTS: 1
264 run: . /etc/profile && ci/run-test-slice.sh $((${{matrix.nr}} + 1)) 10
265 - name: print test failures
266 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
267 shell: bash
268 run: ci/print-test-failures.sh
269 - name: Upload failed tests' directories
270 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
271 uses: actions/upload-artifact@v7
272 with:
273 name: failed-tests-windows-vs-${{ matrix.nr }}
274 path: ${{env.FAILED_TEST_ARTIFACTS}}
275
276 windows-meson-build:
277 name: win+Meson build
278 needs: ci-config
279 if: needs.ci-config.outputs.enabled == 'yes'
280 runs-on: windows-latest
281 concurrency:
282 group: windows-meson-build-${{ github.ref }}
283 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
284 steps:
285 - uses: actions/checkout@v6
286 - uses: actions/setup-python@v6
287 - name: Set up dependencies
288 shell: pwsh
289 run: pip install meson ninja
290 - name: Setup
291 shell: pwsh
292 run: meson setup build --vsenv -Dbuildtype=release -Dperl=disabled -Dcredential_helpers=wincred
293 - name: Compile
294 shell: pwsh
295 run: meson compile -C build
296 - name: Upload build artifacts
297 uses: actions/upload-artifact@v7
298 with:
299 name: windows-meson-artifacts
300 path: build
301 windows-meson-test:
302 name: win+Meson test
303 runs-on: windows-latest
304 needs: [ci-config, windows-meson-build]
305 strategy:
306 fail-fast: false
307 matrix:
308 nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
309 concurrency:
310 group: windows-meson-test-${{ matrix.nr }}-${{ github.ref }}
311 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
312 steps:
313 - uses: actions/checkout@v6
314 - uses: actions/setup-python@v6
315 - name: Set up dependencies
316 shell: pwsh
317 run: pip install meson ninja
318 - name: Download build artifacts
319 uses: actions/download-artifact@v8
320 with:
321 name: windows-meson-artifacts
322 path: build
323 - name: Test
324 shell: bash
325 run: ci/run-test-slice-meson.sh build $((${{matrix.nr}} + 1)) 10
326 - name: print test failures
327 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
328 shell: bash
329 run: ci/print-test-failures.sh
330 - name: Upload failed tests' directories
331 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
332 uses: actions/upload-artifact@v7
333 with:
334 name: failed-tests-windows-meson-${{ matrix.nr }}
335 path: ${{env.FAILED_TEST_ARTIFACTS}}
336
337 regular:
338 name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}})
339 needs: ci-config
340 if: needs.ci-config.outputs.enabled == 'yes'
341 concurrency:
342 group: ${{ matrix.vector.jobname }}-${{ matrix.vector.pool }}-${{ github.ref }}
343 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
344 strategy:
345 fail-fast: false
346 matrix:
347 vector:
348 - jobname: osx-clang
349 cc: clang
350 pool: macos-14
351 - jobname: osx-reftable
352 cc: clang
353 pool: macos-14
354 - jobname: osx-gcc
355 cc: gcc-13
356 pool: macos-14
357 - jobname: osx-meson
358 cc: clang
359 pool: macos-14
360 env:
361 CC: ${{matrix.vector.cc}}
362 CC_PACKAGE: ${{matrix.vector.cc_package}}
363 jobname: ${{matrix.vector.jobname}}
364 CI_JOB_IMAGE: ${{matrix.vector.pool}}
365 TEST_OUTPUT_DIRECTORY: ${{github.workspace}}/t
366 runs-on: ${{matrix.vector.pool}}
367 steps:
368 - uses: actions/checkout@v6
369 - run: ci/install-dependencies.sh
370 - run: ci/run-build-and-tests.sh
371 - name: print test failures
372 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
373 run: ci/print-test-failures.sh
374 - name: Upload failed tests' directories
375 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
376 uses: actions/upload-artifact@v7
377 with:
378 name: failed-tests-${{matrix.vector.jobname}}
379 path: ${{env.FAILED_TEST_ARTIFACTS}}
380 fuzz-smoke-test:
381 name: fuzz smoke test
382 needs: ci-config
383 if: needs.ci-config.outputs.enabled == 'yes'
384 env:
385 CC: clang
386 CI_JOB_IMAGE: ubuntu-latest
387 runs-on: ubuntu-latest
388 steps:
389 - uses: actions/checkout@v6
390 - run: ci/install-dependencies.sh
391 - run: ci/run-build-and-minimal-fuzzers.sh
392 dockerized:
393 name: ${{matrix.vector.jobname}} (${{matrix.vector.image}})
394 needs: ci-config
395 if: needs.ci-config.outputs.enabled == 'yes'
396 concurrency:
397 group: dockerized-${{ matrix.vector.jobname }}-${{ matrix.vector.image }}-${{ github.ref }}
398 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
399 strategy:
400 fail-fast: false
401 matrix:
402 vector:
403 - jobname: linux-sha256
404 image: ubuntu:rolling
405 cc: clang
406 - jobname: linux-reftable
407 image: ubuntu:rolling
408 cc: clang
409 - jobname: linux-TEST-vars
410 image: ubuntu:20.04
411 cc: gcc
412 cc_package: gcc-8
413 - jobname: linux-breaking-changes
414 cc: gcc
415 image: ubuntu:rolling
416 - jobname: fedora-breaking-changes-meson
417 image: fedora:latest
418 - jobname: linux-leaks
419 image: ubuntu:rolling
420 cc: gcc
421 - jobname: linux-reftable-leaks
422 image: ubuntu:rolling
423 cc: gcc
424 - jobname: linux-asan-ubsan
425 image: ubuntu:rolling
426 cc: clang
427 - jobname: linux-meson
428 image: ubuntu:rolling
429 cc: gcc
430 - jobname: linux-musl-meson
431 image: alpine:latest
432 # Supported until 2025-04-02.
433 - jobname: linux32
434 image: i386/ubuntu:20.04
435 # A RHEL 8 compatible distro. Supported until 2029-05-31.
436 - jobname: almalinux-8
437 image: almalinux:8
438 # Supported until 2026-08-31.
439 - jobname: debian-11
440 image: debian:11
441 env:
442 jobname: ${{matrix.vector.jobname}}
443 CC: ${{matrix.vector.cc}}
444 CI_JOB_IMAGE: ${{matrix.vector.image}}
445 CUSTOM_PATH: /custom
446 runs-on: ubuntu-latest
447 container:
448 image: ${{ matrix.vector.image }}
449 options: ${{ github.repository_visibility == 'private' && '--pids-limit 16384 --ulimit nproc=16384:16384 --ulimit nofile=32768:32768' || '' }}
450 steps:
451 - name: prepare libc6 for actions
452 if: matrix.vector.jobname == 'linux32'
453 run: apt -q update && apt -q -y install libc6-amd64 lib64stdc++6
454 - name: install git in container
455 run: |
456 if command -v git
457 then
458 : # nothing to do
459 elif command -v apk
460 then
461 apk add --update git
462 elif command -v dnf
463 then
464 dnf -yq update && dnf -yq install git
465 else
466 apt-get -q update && apt-get -q -y install git
467 fi
468 - uses: actions/checkout@v6
469 - run: ci/install-dependencies.sh
470 - run: useradd builder --create-home
471 - run: chown -R builder .
472 - run: chmod a+w $GITHUB_ENV && sudo --preserve-env --set-home --user=builder ci/run-build-and-tests.sh
473 - name: print test failures
474 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
475 run: sudo --preserve-env --set-home --user=builder ci/print-test-failures.sh
476 - name: Upload failed tests' directories
477 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
478 uses: actions/upload-artifact@v7
479 with:
480 name: failed-tests-${{matrix.vector.jobname}}
481 path: ${{env.FAILED_TEST_ARTIFACTS}}
482 static-analysis:
483 needs: ci-config
484 if: needs.ci-config.outputs.enabled == 'yes'
485 env:
486 jobname: StaticAnalysis
487 CI_JOB_IMAGE: ubuntu-22.04
488 runs-on: ubuntu-22.04
489 concurrency:
490 group: static-analysis-${{ github.ref }}
491 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
492 steps:
493 - uses: actions/checkout@v6
494 - run: ci/install-dependencies.sh
495 - run: ci/run-static-analysis.sh
496 - run: ci/check-directional-formatting.bash
497 rust-analysis:
498 needs: ci-config
499 if: needs.ci-config.outputs.enabled == 'yes'
500 env:
501 jobname: RustAnalysis
502 CI_JOB_IMAGE: ubuntu:rolling
503 runs-on: ubuntu-latest
504 container: ubuntu:rolling
505 concurrency:
506 group: rust-analysis-${{ github.ref }}
507 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
508 steps:
509 - uses: actions/checkout@v6
510 - run: ci/install-dependencies.sh
511 - run: ci/run-rust-checks.sh
512 sparse:
513 needs: ci-config
514 if: needs.ci-config.outputs.enabled == 'yes'
515 env:
516 jobname: sparse
517 CI_JOB_IMAGE: ubuntu-22.04
518 runs-on: ubuntu-22.04
519 concurrency:
520 group: sparse-${{ github.ref }}
521 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
522 steps:
523 - uses: actions/checkout@v6
524 - name: Install other dependencies
525 run: ci/install-dependencies.sh
526 - run: make sparse
527 documentation:
528 name: documentation
529 needs: ci-config
530 if: needs.ci-config.outputs.enabled == 'yes'
531 concurrency:
532 group: documentation-${{ github.ref }}
533 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
534 env:
535 jobname: Documentation
536 CI_JOB_IMAGE: ubuntu-latest
537 runs-on: ubuntu-latest
538 steps:
539 - uses: actions/checkout@v6
540 - run: ci/install-dependencies.sh
541 - run: ci/test-documentation.sh