3 on: [push, pull_request]
11 runs-on: ubuntu-latest
13 enabled: ${{ steps.check-ref.outputs.enabled }}${{ steps.skip-if-redundant.outputs.enabled }}
14 skip_concurrent: ${{ steps.check-ref.outputs.skip_concurrent }}
16 - name: try to clone ci-config branch
18 git -c protocol.version=2 clone \
25 https://github.com/${{ github.repository }} \
28 git checkout HEAD -- ci/config || : ignore
30 name: check whether CI is enabled for ref
33 if test -x config-repo/ci/config/allow-ref &&
34 ! config-repo/ci/config/allow-ref '${{ github.ref }}'
40 if test -x config-repo/ci/config/skip-concurrent &&
41 ! config-repo/ci/config/skip-concurrent '${{ github.ref }}'
45 echo "enabled=$enabled" >>$GITHUB_OUTPUT
46 echo "skip_concurrent=$skip_concurrent" >>$GITHUB_OUTPUT
47 - name: skip if the commit or tree was already tested
49 uses: actions/github-script@v6
50 if: steps.check-ref.outputs.enabled == 'yes'
52 github-token: ${{secrets.GITHUB_TOKEN}}
55 // Figure out workflow ID, commit and tree
56 const { data: run } = await github.rest.actions.getWorkflowRun({
57 owner: context.repo.owner,
58 repo: context.repo.repo,
59 run_id: context.runId,
61 const workflow_id = run.workflow_id;
62 const head_sha = run.head_sha;
63 const tree_id = run.head_commit.tree_id;
65 // See whether there is a successful run for that commit or tree
66 const { data: runs } = await github.rest.actions.listWorkflowRuns({
67 owner: context.repo.owner,
68 repo: context.repo.repo,
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');
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');
92 if: needs.ci-config.outputs.enabled == 'yes'
93 runs-on: windows-latest
95 group: windows-build-${{ github.ref }}
96 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
98 - uses: actions/checkout@v3
99 - uses: git-for-windows/setup-git-for-windows-sdk@v1
103 HOME: ${{runner.workspace}}
105 run: . /etc/profile && ci/make-test-artifacts.sh artifacts
106 - name: zip up tracked files
107 run: git archive -o artifacts/tracked.tar.gz HEAD
108 - name: upload tracked files and build artifacts
109 uses: actions/upload-artifact@v3
111 name: windows-artifacts
115 runs-on: windows-latest
116 needs: [ci-config, windows-build]
120 nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
122 group: windows-test-${{ matrix.nr }}-${{ github.ref }}
123 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
125 - name: download tracked files and build artifacts
126 uses: actions/download-artifact@v3
128 name: windows-artifacts
129 path: ${{github.workspace}}
130 - name: extract tracked files and build artifacts
132 run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz
133 - uses: git-for-windows/setup-git-for-windows-sdk@v1
136 run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
137 - name: print test failures
138 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
140 run: ci/print-test-failures.sh
141 - name: Upload failed tests' directories
142 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
143 uses: actions/upload-artifact@v3
145 name: failed-tests-windows
146 path: ${{env.FAILED_TEST_ARTIFACTS}}
150 if: github.event.repository.owner.login == 'git-for-windows' && needs.ci-config.outputs.enabled == 'yes'
153 GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'"
154 runs-on: windows-latest
156 group: vs-build-${{ github.ref }}
157 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
159 - uses: actions/checkout@v3
160 - uses: git-for-windows/setup-git-for-windows-sdk@v1
161 - name: initialize vcpkg
162 uses: actions/checkout@v3
164 repository: 'microsoft/vcpkg'
165 path: 'compat/vcbuild/vcpkg'
166 - name: download vcpkg artifacts
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
176 uses: microsoft/setup-msbuild@v1
177 - name: copy dlls to root
179 run: compat\vcbuild\vcpkg_copy_dlls.bat release
180 - name: generate Visual Studio solution
183 cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows \
184 -DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON
186 run: msbuild git.sln -property:Configuration=Release -property:Platform=x64 -maxCpuCount:4 -property:PlatformToolset=v142
187 - name: bundle artifact tar
191 VCPKG_ROOT: ${{github.workspace}}\compat\vcbuild\vcpkg
193 mkdir -p artifacts &&
194 eval "$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)"
195 - name: zip up tracked files
196 run: git archive -o artifacts/tracked.tar.gz HEAD
197 - name: upload tracked files and build artifacts
198 uses: actions/upload-artifact@v3
204 runs-on: windows-latest
205 needs: [ci-config, vs-build]
209 nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
211 group: vs-test-${{ matrix.nr }}-${{ github.ref }}
212 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
214 - uses: git-for-windows/setup-git-for-windows-sdk@v1
215 - name: download tracked files and build artifacts
216 uses: actions/download-artifact@v3
219 path: ${{github.workspace}}
220 - name: extract tracked files and build artifacts
222 run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz
227 run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
228 - name: print test failures
229 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
231 run: ci/print-test-failures.sh
232 - name: Upload failed tests' directories
233 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
234 uses: actions/upload-artifact@v3
236 name: failed-tests-windows
237 path: ${{env.FAILED_TEST_ARTIFACTS}}
239 name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}})
241 if: needs.ci-config.outputs.enabled == 'yes'
243 group: ${{ matrix.vector.jobname }}-${{ matrix.vector.pool }}-${{ github.ref }}
244 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
249 - jobname: linux-clang
252 - jobname: linux-sha256
259 - jobname: linux-TEST-vars
270 - jobname: linux-gcc-default
273 - jobname: linux-leaks
276 - jobname: linux-asan
279 - jobname: linux-ubsan
283 CC: ${{matrix.vector.cc}}
284 CC_PACKAGE: ${{matrix.vector.cc_package}}
285 jobname: ${{matrix.vector.jobname}}
286 runs_on_pool: ${{matrix.vector.pool}}
287 runs-on: ${{matrix.vector.pool}}
289 - uses: actions/checkout@v3
290 - run: ci/install-dependencies.sh
291 - run: ci/run-build-and-tests.sh
292 - run: ci/print-test-failures.sh
293 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
294 - name: Upload failed tests' directories
295 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
296 uses: actions/upload-artifact@v3
298 name: failed-tests-${{matrix.vector.jobname}}
299 path: ${{env.FAILED_TEST_ARTIFACTS}}
301 name: ${{matrix.vector.jobname}} (${{matrix.vector.image}})
303 if: needs.ci-config.outputs.enabled == 'yes'
305 group: dockerized-${{ matrix.vector.jobname }}-${{ matrix.vector.image }}-${{ github.ref }}
306 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
311 - jobname: linux-musl
314 image: daald/ubuntu32:xenial
318 jobname: ${{matrix.vector.jobname}}
319 runs-on: ubuntu-latest
320 container: ${{matrix.vector.image}}
322 - uses: actions/checkout@v3
323 if: matrix.vector.jobname != 'linux32'
324 - uses: actions/checkout@v1
325 if: matrix.vector.jobname == 'linux32'
326 - run: ci/install-docker-dependencies.sh
327 - run: ci/run-build-and-tests.sh
328 - run: ci/print-test-failures.sh
329 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
330 - name: Upload failed tests' directories
331 if: failure() && env.FAILED_TEST_ARTIFACTS != '' && matrix.vector.jobname != 'linux32'
332 uses: actions/upload-artifact@v3
334 name: failed-tests-${{matrix.vector.jobname}}
335 path: ${{env.FAILED_TEST_ARTIFACTS}}
336 - name: Upload failed tests' directories
337 if: failure() && env.FAILED_TEST_ARTIFACTS != '' && matrix.vector.jobname == 'linux32'
338 uses: actions/upload-artifact@v1
340 name: failed-tests-${{matrix.vector.jobname}}
341 path: ${{env.FAILED_TEST_ARTIFACTS}}
344 if: needs.ci-config.outputs.enabled == 'yes'
346 jobname: StaticAnalysis
347 runs-on: ubuntu-22.04
349 group: static-analysis-${{ github.ref }}
350 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
352 - uses: actions/checkout@v3
353 - run: ci/install-dependencies.sh
354 - run: ci/run-static-analysis.sh
355 - run: ci/check-directional-formatting.bash
358 if: needs.ci-config.outputs.enabled == 'yes'
361 runs-on: ubuntu-20.04
363 group: sparse-${{ github.ref }}
364 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
366 - name: Download a current `sparse` package
367 # Ubuntu's `sparse` version is too old for us
368 uses: git-for-windows/get-azure-pipelines-artifact@v0
372 artifact: sparse-20.04
373 - name: Install the current `sparse` package
374 run: sudo dpkg -i sparse-20.04/sparse_*.deb
375 - uses: actions/checkout@v3
376 - name: Install other dependencies
377 run: ci/install-dependencies.sh
382 if: needs.ci-config.outputs.enabled == 'yes'
384 group: documentation-${{ github.ref }}
385 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
387 jobname: Documentation
388 runs-on: ubuntu-latest
390 - uses: actions/checkout@v3
391 - run: ci/install-dependencies.sh
392 - run: ci/test-documentation.sh