]>
Commit | Line | Data |
---|---|---|
889cacb6 ĐTCD |
1 | name: CI/PR |
2 | ||
3 | on: [push, pull_request] | |
4 | ||
5 | env: | |
6 | DEVELOPER: 1 | |
7 | ||
8 | jobs: | |
e76eec35 | 9 | ci-config: |
055747cd AM |
10 | runs-on: ubuntu-latest |
11 | outputs: | |
7d78d5fc | 12 | enabled: ${{ steps.check-ref.outputs.enabled }}${{ steps.skip-if-redundant.outputs.enabled }} |
055747cd AM |
13 | steps: |
14 | - name: try to clone ci-config branch | |
055747cd AM |
15 | run: | |
16 | git -c protocol.version=2 clone \ | |
17 | --no-tags \ | |
18 | --single-branch \ | |
19 | -b ci-config \ | |
20 | --depth 1 \ | |
21 | --no-checkout \ | |
22 | --filter=blob:none \ | |
23 | https://github.com/${{ github.repository }} \ | |
24 | config-repo && | |
b01aff8c | 25 | cd config-repo && |
2fcf7a8c | 26 | git checkout HEAD -- ci/config || : ignore |
055747cd AM |
27 | - id: check-ref |
28 | name: check whether CI is enabled for ref | |
29 | run: | | |
30 | enabled=yes | |
31 | if test -x config-repo/ci/config/allow-ref && | |
32 | ! config-repo/ci/config/allow-ref '${{ github.ref }}' | |
33 | then | |
34 | enabled=no | |
35 | fi | |
36 | echo "::set-output name=enabled::$enabled" | |
7d78d5fc JS |
37 | - name: skip if the commit or tree was already tested |
38 | id: skip-if-redundant | |
39 | uses: actions/github-script@v3 | |
40 | if: steps.check-ref.outputs.enabled == 'yes' | |
41 | with: | |
42 | github-token: ${{secrets.GITHUB_TOKEN}} | |
43 | script: | | |
d6d66837 JS |
44 | try { |
45 | // Figure out workflow ID, commit and tree | |
46 | const { data: run } = await github.actions.getWorkflowRun({ | |
47 | owner: context.repo.owner, | |
48 | repo: context.repo.repo, | |
49 | run_id: context.runId, | |
50 | }); | |
51 | const workflow_id = run.workflow_id; | |
52 | const head_sha = run.head_sha; | |
53 | const tree_id = run.head_commit.tree_id; | |
7d78d5fc | 54 | |
d6d66837 JS |
55 | // See whether there is a successful run for that commit or tree |
56 | const { data: runs } = await github.actions.listWorkflowRuns({ | |
57 | owner: context.repo.owner, | |
58 | repo: context.repo.repo, | |
59 | per_page: 500, | |
60 | status: 'success', | |
61 | workflow_id, | |
62 | }); | |
63 | for (const run of runs.workflow_runs) { | |
64 | if (head_sha === run.head_sha) { | |
65 | core.warning(`Successful run for the commit ${head_sha}: ${run.html_url}`); | |
66 | core.setOutput('enabled', ' but skip'); | |
67 | break; | |
68 | } | |
69 | if (run.head_commit && tree_id === run.head_commit.tree_id) { | |
70 | core.warning(`Successful run for the tree ${tree_id}: ${run.html_url}`); | |
71 | core.setOutput('enabled', ' but skip'); | |
72 | break; | |
73 | } | |
7d78d5fc | 74 | } |
d6d66837 JS |
75 | } catch (e) { |
76 | core.warning(e); | |
7d78d5fc | 77 | } |
e76eec35 | 78 | |
889cacb6 | 79 | windows-build: |
e76eec35 JK |
80 | needs: ci-config |
81 | if: needs.ci-config.outputs.enabled == 'yes' | |
889cacb6 ĐTCD |
82 | runs-on: windows-latest |
83 | steps: | |
84 | - uses: actions/checkout@v1 | |
85 | - name: download git-sdk-64-minimal | |
86 | shell: bash | |
857341c1 JS |
87 | run: | |
88 | ## Get artifact | |
89 | urlbase=https://dev.azure.com/git-for-windows/git/_apis/build/builds | |
90 | id=$(curl "$urlbase?definitions=22&statusFilter=completed&resultFilter=succeeded&\$top=1" | | |
91 | jq -r ".value[] | .id") | |
92 | download_url="$(curl "$urlbase/$id/artifacts" | | |
93 | jq -r '.value[] | select(.name == "git-sdk-64-minimal").resource.downloadUrl')" | |
94 | curl --connect-timeout 10 --retry 5 --retry-delay 0 --retry-max-time 240 \ | |
95 | -o artifacts.zip "$download_url" | |
96 | ||
97 | ## Unzip and remove the artifact | |
98 | unzip artifacts.zip | |
99 | rm artifacts.zip | |
889cacb6 ĐTCD |
100 | - name: build |
101 | shell: powershell | |
102 | env: | |
103 | HOME: ${{runner.workspace}} | |
104 | MSYSTEM: MINGW64 | |
105 | NO_PERL: 1 | |
106 | run: | | |
107 | & .\git-sdk-64-minimal\usr\bin\bash.exe -lc @" | |
108 | printf '%s\n' /git-sdk-64-minimal/ >>.git/info/exclude | |
109 | ||
110 | ci/make-test-artifacts.sh artifacts | |
111 | "@ | |
112 | - name: upload build artifacts | |
113 | uses: actions/upload-artifact@v1 | |
114 | with: | |
115 | name: windows-artifacts | |
116 | path: artifacts | |
857341c1 JS |
117 | - name: upload git-sdk-64-minimal |
118 | uses: actions/upload-artifact@v1 | |
119 | with: | |
120 | name: git-sdk-64-minimal | |
121 | path: git-sdk-64-minimal | |
889cacb6 ĐTCD |
122 | windows-test: |
123 | runs-on: windows-latest | |
124 | needs: [windows-build] | |
125 | strategy: | |
2b0e14f6 | 126 | fail-fast: false |
889cacb6 ĐTCD |
127 | matrix: |
128 | nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
129 | steps: | |
130 | - uses: actions/checkout@v1 | |
889cacb6 ĐTCD |
131 | - name: download build artifacts |
132 | uses: actions/download-artifact@v1 | |
133 | with: | |
134 | name: windows-artifacts | |
135 | path: ${{github.workspace}} | |
136 | - name: extract build artifacts | |
137 | shell: bash | |
138 | run: tar xf artifacts.tar.gz | |
857341c1 JS |
139 | - name: download git-sdk-64-minimal |
140 | uses: actions/download-artifact@v1 | |
141 | with: | |
142 | name: git-sdk-64-minimal | |
143 | path: ${{github.workspace}}/git-sdk-64-minimal/ | |
889cacb6 ĐTCD |
144 | - name: test |
145 | shell: powershell | |
146 | run: | | |
147 | & .\git-sdk-64-minimal\usr\bin\bash.exe -lc @" | |
148 | # Let Git ignore the SDK | |
149 | printf '%s\n' /git-sdk-64-minimal/ >>.git/info/exclude | |
150 | ||
151 | ci/run-test-slice.sh ${{matrix.nr}} 10 | |
152 | "@ | |
153 | - name: ci/print-test-failures.sh | |
154 | if: failure() | |
155 | shell: powershell | |
156 | run: | | |
157 | & .\git-sdk-64-minimal\usr\bin\bash.exe -lc ci/print-test-failures.sh | |
f72f328b JS |
158 | - name: Upload failed tests' directories |
159 | if: failure() && env.FAILED_TEST_ARTIFACTS != '' | |
160 | uses: actions/upload-artifact@v1 | |
161 | with: | |
162 | name: failed-tests-windows | |
163 | path: ${{env.FAILED_TEST_ARTIFACTS}} | |
889cacb6 | 164 | vs-build: |
e76eec35 JK |
165 | needs: ci-config |
166 | if: needs.ci-config.outputs.enabled == 'yes' | |
889cacb6 ĐTCD |
167 | env: |
168 | MSYSTEM: MINGW64 | |
169 | NO_PERL: 1 | |
170 | GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'" | |
171 | runs-on: windows-latest | |
172 | steps: | |
173 | - uses: actions/checkout@v1 | |
174 | - name: download git-sdk-64-minimal | |
175 | shell: bash | |
857341c1 JS |
176 | run: | |
177 | ## Get artifact | |
178 | urlbase=https://dev.azure.com/git-for-windows/git/_apis/build/builds | |
179 | id=$(curl "$urlbase?definitions=22&statusFilter=completed&resultFilter=succeeded&\$top=1" | | |
180 | jq -r ".value[] | .id") | |
181 | download_url="$(curl "$urlbase/$id/artifacts" | | |
182 | jq -r '.value[] | select(.name == "git-sdk-64-minimal").resource.downloadUrl')" | |
183 | curl --connect-timeout 10 --retry 5 --retry-delay 0 --retry-max-time 240 \ | |
184 | -o artifacts.zip "$download_url" | |
185 | ||
186 | ## Unzip and remove the artifact | |
187 | unzip artifacts.zip | |
188 | rm artifacts.zip | |
958a5f5d DA |
189 | - name: initialize vcpkg |
190 | uses: actions/checkout@v2 | |
191 | with: | |
192 | repository: 'microsoft/vcpkg' | |
193 | path: 'compat/vcbuild/vcpkg' | |
889cacb6 ĐTCD |
194 | - name: download vcpkg artifacts |
195 | shell: powershell | |
196 | run: | | |
197 | $urlbase = "https://dev.azure.com/git/git/_apis/build/builds" | |
198 | $id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=9&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id | |
199 | $downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[0].resource.downloadUrl | |
200 | (New-Object Net.WebClient).DownloadFile($downloadUrl, "compat.zip") | |
201 | Expand-Archive compat.zip -DestinationPath . -Force | |
202 | Remove-Item compat.zip | |
203 | - name: add msbuild to PATH | |
17c13069 | 204 | uses: microsoft/setup-msbuild@v1 |
4c2c38e8 SS |
205 | - name: copy dlls to root |
206 | shell: powershell | |
207 | run: | | |
208 | & compat\vcbuild\vcpkg_copy_dlls.bat release | |
209 | if (!$?) { exit(1) } | |
210 | - name: generate Visual Studio solution | |
211 | shell: bash | |
212 | run: | | |
213 | cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows \ | |
4c2c38e8 | 214 | -DMSGFMT_EXE=`pwd`/git-sdk-64-minimal/mingw64/bin/msgfmt.exe -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON |
889cacb6 ĐTCD |
215 | - name: MSBuild |
216 | run: msbuild git.sln -property:Configuration=Release -property:Platform=x64 -maxCpuCount:4 -property:PlatformToolset=v142 | |
217 | - name: bundle artifact tar | |
218 | shell: powershell | |
219 | env: | |
220 | MSVC: 1 | |
221 | VCPKG_ROOT: ${{github.workspace}}\compat\vcbuild\vcpkg | |
222 | run: | | |
889cacb6 ĐTCD |
223 | & git-sdk-64-minimal\usr\bin\bash.exe -lc @" |
224 | mkdir -p artifacts && | |
225 | eval \"`$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts 2>&1 | grep ^tar)\" | |
226 | "@ | |
227 | - name: upload build artifacts | |
228 | uses: actions/upload-artifact@v1 | |
229 | with: | |
230 | name: vs-artifacts | |
231 | path: artifacts | |
232 | vs-test: | |
233 | runs-on: windows-latest | |
857341c1 | 234 | needs: [vs-build, windows-build] |
889cacb6 | 235 | strategy: |
2b0e14f6 | 236 | fail-fast: false |
889cacb6 ĐTCD |
237 | matrix: |
238 | nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
239 | steps: | |
240 | - uses: actions/checkout@v1 | |
857341c1 JS |
241 | - name: download git-sdk-64-minimal |
242 | uses: actions/download-artifact@v1 | |
243 | with: | |
244 | name: git-sdk-64-minimal | |
245 | path: ${{github.workspace}}/git-sdk-64-minimal/ | |
889cacb6 ĐTCD |
246 | - name: download build artifacts |
247 | uses: actions/download-artifact@v1 | |
248 | with: | |
249 | name: vs-artifacts | |
250 | path: ${{github.workspace}} | |
251 | - name: extract build artifacts | |
252 | shell: bash | |
253 | run: tar xf artifacts.tar.gz | |
4c2c38e8 | 254 | - name: test |
889cacb6 ĐTCD |
255 | shell: powershell |
256 | env: | |
257 | MSYSTEM: MINGW64 | |
258 | NO_SVN_TESTS: 1 | |
259 | GIT_TEST_SKIP_REBASE_P: 1 | |
260 | run: | | |
857341c1 | 261 | & .\git-sdk-64-minimal\usr\bin\bash.exe -lc @" |
889cacb6 | 262 | # Let Git ignore the SDK and the test-cache |
857341c1 | 263 | printf '%s\n' /git-sdk-64-minimal/ /test-cache/ >>.git/info/exclude |
889cacb6 | 264 | |
4c2c38e8 | 265 | ci/run-test-slice.sh ${{matrix.nr}} 10 |
889cacb6 | 266 | "@ |
4c2c38e8 SS |
267 | - name: ci/print-test-failures.sh |
268 | if: failure() | |
269 | shell: powershell | |
270 | run: | | |
271 | & .\git-sdk-64-minimal\usr\bin\bash.exe -lc ci/print-test-failures.sh | |
272 | - name: Upload failed tests' directories | |
273 | if: failure() && env.FAILED_TEST_ARTIFACTS != '' | |
274 | uses: actions/upload-artifact@v1 | |
275 | with: | |
276 | name: failed-tests-windows | |
277 | path: ${{env.FAILED_TEST_ARTIFACTS}} | |
889cacb6 | 278 | regular: |
e76eec35 JK |
279 | needs: ci-config |
280 | if: needs.ci-config.outputs.enabled == 'yes' | |
889cacb6 | 281 | strategy: |
2b0e14f6 | 282 | fail-fast: false |
889cacb6 ĐTCD |
283 | matrix: |
284 | vector: | |
285 | - jobname: linux-clang | |
286 | cc: clang | |
287 | pool: ubuntu-latest | |
288 | - jobname: linux-gcc | |
289 | cc: gcc | |
290 | pool: ubuntu-latest | |
291 | - jobname: osx-clang | |
292 | cc: clang | |
293 | pool: macos-latest | |
294 | - jobname: osx-gcc | |
295 | cc: gcc | |
296 | pool: macos-latest | |
6c280b41 | 297 | - jobname: linux-gcc-default |
889cacb6 ĐTCD |
298 | cc: gcc |
299 | pool: ubuntu-latest | |
300 | env: | |
301 | CC: ${{matrix.vector.cc}} | |
302 | jobname: ${{matrix.vector.jobname}} | |
303 | runs-on: ${{matrix.vector.pool}} | |
304 | steps: | |
305 | - uses: actions/checkout@v1 | |
306 | - run: ci/install-dependencies.sh | |
307 | - run: ci/run-build-and-tests.sh | |
308 | - run: ci/print-test-failures.sh | |
309 | if: failure() | |
f72f328b JS |
310 | - name: Upload failed tests' directories |
311 | if: failure() && env.FAILED_TEST_ARTIFACTS != '' | |
312 | uses: actions/upload-artifact@v1 | |
313 | with: | |
314 | name: failed-tests-${{matrix.vector.jobname}} | |
315 | path: ${{env.FAILED_TEST_ARTIFACTS}} | |
889cacb6 | 316 | dockerized: |
e76eec35 JK |
317 | needs: ci-config |
318 | if: needs.ci-config.outputs.enabled == 'yes' | |
889cacb6 | 319 | strategy: |
2b0e14f6 | 320 | fail-fast: false |
889cacb6 ĐTCD |
321 | matrix: |
322 | vector: | |
323 | - jobname: linux-musl | |
324 | image: alpine | |
325 | - jobname: Linux32 | |
326 | image: daald/ubuntu32:xenial | |
327 | env: | |
328 | jobname: ${{matrix.vector.jobname}} | |
329 | runs-on: ubuntu-latest | |
330 | container: ${{matrix.vector.image}} | |
331 | steps: | |
332 | - uses: actions/checkout@v1 | |
333 | - run: ci/install-docker-dependencies.sh | |
334 | - run: ci/run-build-and-tests.sh | |
335 | - run: ci/print-test-failures.sh | |
336 | if: failure() | |
f72f328b JS |
337 | - name: Upload failed tests' directories |
338 | if: failure() && env.FAILED_TEST_ARTIFACTS != '' | |
339 | uses: actions/upload-artifact@v1 | |
340 | with: | |
341 | name: failed-tests-${{matrix.vector.jobname}} | |
342 | path: ${{env.FAILED_TEST_ARTIFACTS}} | |
889cacb6 | 343 | static-analysis: |
e76eec35 JK |
344 | needs: ci-config |
345 | if: needs.ci-config.outputs.enabled == 'yes' | |
889cacb6 ĐTCD |
346 | env: |
347 | jobname: StaticAnalysis | |
d051ed77 | 348 | runs-on: ubuntu-18.04 |
889cacb6 ĐTCD |
349 | steps: |
350 | - uses: actions/checkout@v1 | |
351 | - run: ci/install-dependencies.sh | |
352 | - run: ci/run-static-analysis.sh | |
e6105966 JS |
353 | sparse: |
354 | needs: ci-config | |
355 | if: needs.ci-config.outputs.enabled == 'yes' | |
356 | env: | |
357 | jobname: sparse | |
358 | runs-on: ubuntu-20.04 | |
359 | steps: | |
360 | - name: Download a current `sparse` package | |
361 | # Ubuntu's `sparse` version is too old for us | |
362 | uses: git-for-windows/get-azure-pipelines-artifact@v0 | |
363 | with: | |
364 | repository: git/git | |
365 | definitionId: 10 | |
366 | artifact: sparse-20.04 | |
367 | - name: Install the current `sparse` package | |
368 | run: sudo dpkg -i sparse-20.04/sparse_*.deb | |
e6105966 | 369 | - uses: actions/checkout@v2 |
27f45ccf JK |
370 | - name: Install other dependencies |
371 | run: ci/install-dependencies.sh | |
e6105966 | 372 | - run: make sparse |
889cacb6 | 373 | documentation: |
e76eec35 JK |
374 | needs: ci-config |
375 | if: needs.ci-config.outputs.enabled == 'yes' | |
889cacb6 ĐTCD |
376 | env: |
377 | jobname: Documentation | |
378 | runs-on: ubuntu-latest | |
379 | steps: | |
380 | - uses: actions/checkout@v1 | |
381 | - run: ci/install-dependencies.sh | |
382 | - run: ci/test-documentation.sh |