interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / .github / workflows / main.yml

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