]> git.ipfire.org Git - thirdparty/git.git/blob - .github/workflows/main.yml
bisect: document command line arguments for "bisect start"
[thirdparty/git.git] / .github / workflows / main.yml
1 name: CI
2
3 on: [push, pull_request]
4
5 env:
6 DEVELOPER: 1
7
8 jobs:
9 ci-config:
10 name: config
11 runs-on: ubuntu-latest
12 outputs:
13 enabled: ${{ steps.check-ref.outputs.enabled }}${{ steps.skip-if-redundant.outputs.enabled }}
14 skip_concurrent: ${{ steps.check-ref.outputs.skip_concurrent }}
15 steps:
16 - name: try to clone ci-config branch
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 &&
27 cd config-repo &&
28 git checkout HEAD -- ci/config || : ignore
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
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
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
48 id: skip-if-redundant
49 uses: actions/github-script@v6
50 if: steps.check-ref.outputs.enabled == 'yes'
51 with:
52 github-token: ${{secrets.GITHUB_TOKEN}}
53 script: |
54 try {
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,
60 });
61 const workflow_id = run.workflow_id;
62 const head_sha = run.head_sha;
63 const tree_id = run.head_commit.tree_id;
64
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,
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 }
84 }
85 } catch (e) {
86 core.warning(e);
87 }
88
89 windows-build:
90 name: win build
91 needs: ci-config
92 if: needs.ci-config.outputs.enabled == 'yes'
93 runs-on: windows-latest
94 concurrency:
95 group: windows-build-${{ github.ref }}
96 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
97 steps:
98 - uses: actions/checkout@v3
99 - uses: git-for-windows/setup-git-for-windows-sdk@v1
100 - name: build
101 shell: bash
102 env:
103 HOME: ${{runner.workspace}}
104 NO_PERL: 1
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
110 with:
111 name: windows-artifacts
112 path: artifacts
113 windows-test:
114 name: win test
115 runs-on: windows-latest
116 needs: [ci-config, windows-build]
117 strategy:
118 fail-fast: false
119 matrix:
120 nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
121 concurrency:
122 group: windows-test-${{ matrix.nr }}-${{ github.ref }}
123 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
124 steps:
125 - name: download tracked files and build artifacts
126 uses: actions/download-artifact@v3
127 with:
128 name: windows-artifacts
129 path: ${{github.workspace}}
130 - name: extract tracked files and build artifacts
131 shell: bash
132 run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz
133 - uses: git-for-windows/setup-git-for-windows-sdk@v1
134 - name: test
135 shell: bash
136 run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
137 - name: print test failures
138 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
139 shell: bash
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
144 with:
145 name: failed-tests-windows
146 path: ${{env.FAILED_TEST_ARTIFACTS}}
147 vs-build:
148 name: win+VS build
149 needs: ci-config
150 if: github.event.repository.owner.login == 'git-for-windows' && needs.ci-config.outputs.enabled == 'yes'
151 env:
152 NO_PERL: 1
153 GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'"
154 runs-on: windows-latest
155 concurrency:
156 group: vs-build-${{ github.ref }}
157 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
158 steps:
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
163 with:
164 repository: 'microsoft/vcpkg'
165 path: 'compat/vcbuild/vcpkg'
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
176 uses: microsoft/setup-msbuild@v1
177 - name: copy dlls to root
178 shell: cmd
179 run: compat\vcbuild\vcpkg_copy_dlls.bat release
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 \
184 -DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON
185 - name: MSBuild
186 run: msbuild git.sln -property:Configuration=Release -property:Platform=x64 -maxCpuCount:4 -property:PlatformToolset=v142
187 - name: bundle artifact tar
188 shell: bash
189 env:
190 MSVC: 1
191 VCPKG_ROOT: ${{github.workspace}}\compat\vcbuild\vcpkg
192 run: |
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
199 with:
200 name: vs-artifacts
201 path: artifacts
202 vs-test:
203 name: win+VS test
204 runs-on: windows-latest
205 needs: [ci-config, vs-build]
206 strategy:
207 fail-fast: false
208 matrix:
209 nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
210 concurrency:
211 group: vs-test-${{ matrix.nr }}-${{ github.ref }}
212 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
213 steps:
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
217 with:
218 name: vs-artifacts
219 path: ${{github.workspace}}
220 - name: extract tracked files and build artifacts
221 shell: bash
222 run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz
223 - name: test
224 shell: bash
225 env:
226 NO_SVN_TESTS: 1
227 run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
228 - name: print test failures
229 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
230 shell: bash
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
235 with:
236 name: failed-tests-windows
237 path: ${{env.FAILED_TEST_ARTIFACTS}}
238 regular:
239 name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}})
240 needs: ci-config
241 if: needs.ci-config.outputs.enabled == 'yes'
242 concurrency:
243 group: ${{ matrix.vector.jobname }}-${{ matrix.vector.pool }}-${{ github.ref }}
244 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
245 strategy:
246 fail-fast: false
247 matrix:
248 vector:
249 - jobname: linux-clang
250 cc: clang
251 pool: ubuntu-latest
252 - jobname: linux-sha256
253 cc: clang
254 pool: ubuntu-latest
255 - jobname: linux-gcc
256 cc: gcc
257 cc_package: gcc-8
258 pool: ubuntu-20.04
259 - jobname: linux-TEST-vars
260 cc: gcc
261 cc_package: gcc-8
262 pool: ubuntu-20.04
263 - jobname: osx-clang
264 cc: clang
265 pool: macos-12
266 - jobname: osx-gcc
267 cc: gcc
268 cc_package: gcc-9
269 pool: macos-12
270 - jobname: linux-gcc-default
271 cc: gcc
272 pool: ubuntu-latest
273 - jobname: linux-leaks
274 cc: gcc
275 pool: ubuntu-latest
276 - jobname: linux-asan
277 cc: gcc
278 pool: ubuntu-latest
279 - jobname: linux-ubsan
280 cc: gcc
281 pool: ubuntu-latest
282 env:
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}}
288 steps:
289 - uses: actions/checkout@v3
290 - run: ci/install-dependencies.sh
291 - run: ci/run-build-and-tests.sh
292 - name: print test failures
293 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
294 run: ci/print-test-failures.sh
295 - name: Upload failed tests' directories
296 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
297 uses: actions/upload-artifact@v3
298 with:
299 name: failed-tests-${{matrix.vector.jobname}}
300 path: ${{env.FAILED_TEST_ARTIFACTS}}
301 dockerized:
302 name: ${{matrix.vector.jobname}} (${{matrix.vector.image}})
303 needs: ci-config
304 if: needs.ci-config.outputs.enabled == 'yes'
305 concurrency:
306 group: dockerized-${{ matrix.vector.jobname }}-${{ matrix.vector.image }}-${{ github.ref }}
307 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
308 strategy:
309 fail-fast: false
310 matrix:
311 vector:
312 - jobname: linux-musl
313 image: alpine
314 - jobname: linux32
315 image: daald/ubuntu32:xenial
316 - jobname: pedantic
317 image: fedora
318 env:
319 jobname: ${{matrix.vector.jobname}}
320 runs-on: ubuntu-latest
321 container: ${{matrix.vector.image}}
322 steps:
323 - uses: actions/checkout@v3
324 if: matrix.vector.jobname != 'linux32'
325 - uses: actions/checkout@v1
326 if: matrix.vector.jobname == 'linux32'
327 - run: ci/install-docker-dependencies.sh
328 - run: ci/run-build-and-tests.sh
329 - name: print test failures
330 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
331 run: ci/print-test-failures.sh
332 - name: Upload failed tests' directories
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'
340 uses: actions/upload-artifact@v1
341 with:
342 name: failed-tests-${{matrix.vector.jobname}}
343 path: ${{env.FAILED_TEST_ARTIFACTS}}
344 static-analysis:
345 needs: ci-config
346 if: needs.ci-config.outputs.enabled == 'yes'
347 env:
348 jobname: StaticAnalysis
349 runs-on: ubuntu-22.04
350 concurrency:
351 group: static-analysis-${{ github.ref }}
352 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
353 steps:
354 - uses: actions/checkout@v3
355 - run: ci/install-dependencies.sh
356 - run: ci/run-static-analysis.sh
357 - run: ci/check-directional-formatting.bash
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
364 concurrency:
365 group: sparse-${{ github.ref }}
366 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
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
377 - uses: actions/checkout@v3
378 - name: Install other dependencies
379 run: ci/install-dependencies.sh
380 - run: make sparse
381 documentation:
382 name: documentation
383 needs: ci-config
384 if: needs.ci-config.outputs.enabled == 'yes'
385 concurrency:
386 group: documentation-${{ github.ref }}
387 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
388 env:
389 jobname: Documentation
390 runs-on: ubuntu-latest
391 steps:
392 - uses: actions/checkout@v3
393 - run: ci/install-dependencies.sh
394 - run: ci/test-documentation.sh