3 on: [push, pull_request]
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.
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
19 group: ${{ github.sha }}
24 if: vars.CI_BRANCHES == '' || contains(vars.CI_BRANCHES, github.ref_name)
25 runs-on: ubuntu-latest
27 enabled: ${{ steps.check-ref.outputs.enabled }}${{ steps.skip-if-redundant.outputs.enabled }}
28 skip_concurrent: ${{ steps.check-ref.outputs.skip_concurrent }}
30 - name: try to clone ci-config branch
32 git -c protocol.version=2 clone \
39 https://github.com/${{ github.repository }} \
42 git checkout HEAD -- ci/config || : ignore
44 name: check whether CI is enabled for ref
47 if test -x config-repo/ci/config/allow-ref
49 echo "::warning::ci/config/allow-ref is deprecated; use CI_BRANCHES instead"
50 if ! config-repo/ci/config/allow-ref '${{ github.ref }}'
57 if test -x config-repo/ci/config/skip-concurrent &&
58 ! config-repo/ci/config/skip-concurrent '${{ github.ref }}'
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
66 uses: actions/github-script@v7
67 if: steps.check-ref.outputs.enabled == 'yes'
69 github-token: ${{secrets.GITHUB_TOKEN}}
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,
78 const workflow_id = run.workflow_id;
79 const head_sha = run.head_sha;
80 const tree_id = run.head_commit.tree_id;
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,
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');
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');
109 if: needs.ci-config.outputs.enabled == 'yes'
110 runs-on: windows-latest
112 group: windows-build-${{ github.ref }}
113 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
115 - uses: actions/checkout@v4
116 - uses: git-for-windows/setup-git-for-windows-sdk@v1
120 HOME: ${{runner.workspace}}
122 run: . /etc/profile && ci/make-test-artifacts.sh artifacts
123 - name: zip up tracked files
124 run: git archive -o artifacts/tracked.tar.gz HEAD
125 - name: upload tracked files and build artifacts
126 uses: actions/upload-artifact@v4
128 name: windows-artifacts
132 runs-on: windows-latest
133 needs: [ci-config, windows-build]
137 nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
139 group: windows-test-${{ matrix.nr }}-${{ github.ref }}
140 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
142 - name: download tracked files and build artifacts
143 uses: actions/download-artifact@v4
145 name: windows-artifacts
146 path: ${{github.workspace}}
147 - name: extract tracked files and build artifacts
149 run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz
150 - uses: git-for-windows/setup-git-for-windows-sdk@v1
153 run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
154 - name: print test failures
155 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
157 run: ci/print-test-failures.sh
158 - name: Upload failed tests' directories
159 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
160 uses: actions/upload-artifact@v4
162 name: failed-tests-windows
163 path: ${{env.FAILED_TEST_ARTIFACTS}}
167 if: github.event.repository.owner.login == 'git-for-windows' && needs.ci-config.outputs.enabled == 'yes'
170 GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'"
171 runs-on: windows-latest
173 group: vs-build-${{ github.ref }}
174 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
176 - uses: actions/checkout@v4
177 - uses: git-for-windows/setup-git-for-windows-sdk@v1
178 - name: initialize vcpkg
179 uses: actions/checkout@v4
181 repository: 'microsoft/vcpkg'
182 path: 'compat/vcbuild/vcpkg'
183 - name: download vcpkg artifacts
186 $urlbase = "https://dev.azure.com/git/git/_apis/build/builds"
187 $id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=9&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id
188 $downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[0].resource.downloadUrl
189 (New-Object Net.WebClient).DownloadFile($downloadUrl, "compat.zip")
190 Expand-Archive compat.zip -DestinationPath . -Force
191 Remove-Item compat.zip
192 - name: add msbuild to PATH
193 uses: microsoft/setup-msbuild@v1
194 - name: copy dlls to root
196 run: compat\vcbuild\vcpkg_copy_dlls.bat release
197 - name: generate Visual Studio solution
200 cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows \
201 -DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON
203 run: msbuild git.sln -property:Configuration=Release -property:Platform=x64 -maxCpuCount:4 -property:PlatformToolset=v142
204 - name: bundle artifact tar
208 VCPKG_ROOT: ${{github.workspace}}\compat\vcbuild\vcpkg
210 mkdir -p artifacts &&
211 eval "$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)"
212 - name: zip up tracked files
213 run: git archive -o artifacts/tracked.tar.gz HEAD
214 - name: upload tracked files and build artifacts
215 uses: actions/upload-artifact@v4
221 runs-on: windows-latest
222 needs: [ci-config, vs-build]
226 nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
228 group: vs-test-${{ matrix.nr }}-${{ github.ref }}
229 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
231 - uses: git-for-windows/setup-git-for-windows-sdk@v1
232 - name: download tracked files and build artifacts
233 uses: actions/download-artifact@v4
236 path: ${{github.workspace}}
237 - name: extract tracked files and build artifacts
239 run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz
244 run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
245 - name: print test failures
246 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
248 run: ci/print-test-failures.sh
249 - name: Upload failed tests' directories
250 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
251 uses: actions/upload-artifact@v4
253 name: failed-tests-windows
254 path: ${{env.FAILED_TEST_ARTIFACTS}}
256 name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}})
258 if: needs.ci-config.outputs.enabled == 'yes'
260 group: ${{ matrix.vector.jobname }}-${{ matrix.vector.pool }}-${{ github.ref }}
261 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
266 - jobname: linux-sha256
273 - jobname: linux-TEST-vars
284 - jobname: linux-gcc-default
287 - jobname: linux-leaks
290 - jobname: linux-asan-ubsan
294 CC: ${{matrix.vector.cc}}
295 CC_PACKAGE: ${{matrix.vector.cc_package}}
296 jobname: ${{matrix.vector.jobname}}
297 runs_on_pool: ${{matrix.vector.pool}}
298 runs-on: ${{matrix.vector.pool}}
300 - uses: actions/checkout@v4
301 - run: ci/install-dependencies.sh
302 - run: ci/run-build-and-tests.sh
303 - name: print test failures
304 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
305 run: ci/print-test-failures.sh
306 - name: Upload failed tests' directories
307 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
308 uses: actions/upload-artifact@v4
310 name: failed-tests-${{matrix.vector.jobname}}
311 path: ${{env.FAILED_TEST_ARTIFACTS}}
313 name: fuzz smoke test
315 if: needs.ci-config.outputs.enabled == 'yes'
318 runs-on: ubuntu-latest
320 - uses: actions/checkout@v4
321 - run: ci/install-dependencies.sh
322 - run: ci/run-build-and-minimal-fuzzers.sh
324 name: ${{matrix.vector.jobname}} (${{matrix.vector.image}})
326 if: needs.ci-config.outputs.enabled == 'yes'
328 group: dockerized-${{ matrix.vector.jobname }}-${{ matrix.vector.image }}-${{ github.ref }}
329 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
334 - jobname: linux-musl
337 image: daald/ubuntu32:xenial
341 jobname: ${{matrix.vector.jobname}}
342 runs-on: ubuntu-latest
343 container: ${{matrix.vector.image}}
345 - uses: actions/checkout@v4
346 if: matrix.vector.jobname != 'linux32'
347 - uses: actions/checkout@v1
348 if: matrix.vector.jobname == 'linux32'
349 - run: ci/install-docker-dependencies.sh
350 - run: ci/run-build-and-tests.sh
351 - name: print test failures
352 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
353 run: ci/print-test-failures.sh
354 - name: Upload failed tests' directories
355 if: failure() && env.FAILED_TEST_ARTIFACTS != '' && matrix.vector.jobname != 'linux32'
356 uses: actions/upload-artifact@v4
358 name: failed-tests-${{matrix.vector.jobname}}
359 path: ${{env.FAILED_TEST_ARTIFACTS}}
360 - name: Upload failed tests' directories
361 if: failure() && env.FAILED_TEST_ARTIFACTS != '' && matrix.vector.jobname == 'linux32'
362 uses: actions/upload-artifact@v1
364 name: failed-tests-${{matrix.vector.jobname}}
365 path: ${{env.FAILED_TEST_ARTIFACTS}}
368 if: needs.ci-config.outputs.enabled == 'yes'
370 jobname: StaticAnalysis
371 runs-on: ubuntu-22.04
373 group: static-analysis-${{ github.ref }}
374 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
376 - uses: actions/checkout@v4
377 - run: ci/install-dependencies.sh
378 - run: ci/run-static-analysis.sh
379 - run: ci/check-directional-formatting.bash
382 if: needs.ci-config.outputs.enabled == 'yes'
385 runs-on: ubuntu-20.04
387 group: sparse-${{ github.ref }}
388 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
390 - name: Download a current `sparse` package
391 # Ubuntu's `sparse` version is too old for us
392 uses: git-for-windows/get-azure-pipelines-artifact@v0
396 artifact: sparse-20.04
397 - name: Install the current `sparse` package
398 run: sudo dpkg -i sparse-20.04/sparse_*.deb
399 - uses: actions/checkout@v4
400 - name: Install other dependencies
401 run: ci/install-dependencies.sh
406 if: needs.ci-config.outputs.enabled == 'yes'
408 group: documentation-${{ github.ref }}
409 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
411 jobname: Documentation
412 runs-on: ubuntu-latest
414 - uses: actions/checkout@v4
415 - run: ci/install-dependencies.sh
416 - run: ci/test-documentation.sh