]> git.ipfire.org Git - thirdparty/git.git/blob - .github/workflows/main.yml
Merge branch 'en/sparse-with-submodule-doc'
[thirdparty/git.git] / .github / workflows / main.yml
1 name: CI/PR
2
3 on: [push, pull_request]
4
5 env:
6 DEVELOPER: 1
7
8 jobs:
9 ci-config:
10 runs-on: ubuntu-latest
11 outputs:
12 enabled: ${{ steps.check-ref.outputs.enabled }}
13 steps:
14 - name: try to clone ci-config branch
15 continue-on-error: true
16 run: |
17 git -c protocol.version=2 clone \
18 --no-tags \
19 --single-branch \
20 -b ci-config \
21 --depth 1 \
22 --no-checkout \
23 --filter=blob:none \
24 https://github.com/${{ github.repository }} \
25 config-repo &&
26 cd config-repo &&
27 git checkout HEAD -- ci/config
28 - id: check-ref
29 name: check whether CI is enabled for ref
30 run: |
31 enabled=yes
32 if test -x config-repo/ci/config/allow-ref &&
33 ! config-repo/ci/config/allow-ref '${{ github.ref }}'
34 then
35 enabled=no
36 fi
37 echo "::set-output name=enabled::$enabled"
38
39 windows-build:
40 needs: ci-config
41 if: needs.ci-config.outputs.enabled == 'yes'
42 runs-on: windows-latest
43 steps:
44 - uses: actions/checkout@v1
45 - name: download git-sdk-64-minimal
46 shell: bash
47 run: |
48 ## Get artifact
49 urlbase=https://dev.azure.com/git-for-windows/git/_apis/build/builds
50 id=$(curl "$urlbase?definitions=22&statusFilter=completed&resultFilter=succeeded&\$top=1" |
51 jq -r ".value[] | .id")
52 download_url="$(curl "$urlbase/$id/artifacts" |
53 jq -r '.value[] | select(.name == "git-sdk-64-minimal").resource.downloadUrl')"
54 curl --connect-timeout 10 --retry 5 --retry-delay 0 --retry-max-time 240 \
55 -o artifacts.zip "$download_url"
56
57 ## Unzip and remove the artifact
58 unzip artifacts.zip
59 rm artifacts.zip
60 - name: build
61 shell: powershell
62 env:
63 HOME: ${{runner.workspace}}
64 MSYSTEM: MINGW64
65 NO_PERL: 1
66 run: |
67 & .\git-sdk-64-minimal\usr\bin\bash.exe -lc @"
68 printf '%s\n' /git-sdk-64-minimal/ >>.git/info/exclude
69
70 ci/make-test-artifacts.sh artifacts
71 "@
72 - name: upload build artifacts
73 uses: actions/upload-artifact@v1
74 with:
75 name: windows-artifacts
76 path: artifacts
77 - name: upload git-sdk-64-minimal
78 uses: actions/upload-artifact@v1
79 with:
80 name: git-sdk-64-minimal
81 path: git-sdk-64-minimal
82 windows-test:
83 runs-on: windows-latest
84 needs: [windows-build]
85 strategy:
86 matrix:
87 nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
88 steps:
89 - uses: actions/checkout@v1
90 - name: download build artifacts
91 uses: actions/download-artifact@v1
92 with:
93 name: windows-artifacts
94 path: ${{github.workspace}}
95 - name: extract build artifacts
96 shell: bash
97 run: tar xf artifacts.tar.gz
98 - name: download git-sdk-64-minimal
99 uses: actions/download-artifact@v1
100 with:
101 name: git-sdk-64-minimal
102 path: ${{github.workspace}}/git-sdk-64-minimal/
103 - name: test
104 shell: powershell
105 run: |
106 & .\git-sdk-64-minimal\usr\bin\bash.exe -lc @"
107 # Let Git ignore the SDK
108 printf '%s\n' /git-sdk-64-minimal/ >>.git/info/exclude
109
110 ci/run-test-slice.sh ${{matrix.nr}} 10
111 "@
112 - name: ci/print-test-failures.sh
113 if: failure()
114 shell: powershell
115 run: |
116 & .\git-sdk-64-minimal\usr\bin\bash.exe -lc ci/print-test-failures.sh
117 - name: Upload failed tests' directories
118 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
119 uses: actions/upload-artifact@v1
120 with:
121 name: failed-tests-windows
122 path: ${{env.FAILED_TEST_ARTIFACTS}}
123 vs-build:
124 needs: ci-config
125 if: needs.ci-config.outputs.enabled == 'yes'
126 env:
127 MSYSTEM: MINGW64
128 NO_PERL: 1
129 GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'"
130 runs-on: windows-latest
131 steps:
132 - uses: actions/checkout@v1
133 - name: download git-sdk-64-minimal
134 shell: bash
135 run: |
136 ## Get artifact
137 urlbase=https://dev.azure.com/git-for-windows/git/_apis/build/builds
138 id=$(curl "$urlbase?definitions=22&statusFilter=completed&resultFilter=succeeded&\$top=1" |
139 jq -r ".value[] | .id")
140 download_url="$(curl "$urlbase/$id/artifacts" |
141 jq -r '.value[] | select(.name == "git-sdk-64-minimal").resource.downloadUrl')"
142 curl --connect-timeout 10 --retry 5 --retry-delay 0 --retry-max-time 240 \
143 -o artifacts.zip "$download_url"
144
145 ## Unzip and remove the artifact
146 unzip artifacts.zip
147 rm artifacts.zip
148 - name: generate Visual Studio solution
149 shell: powershell
150 run: |
151 & .\git-sdk-64-minimal\usr\bin\bash.exe -lc @"
152 make NDEBUG=1 DEVELOPER=1 vcxproj
153 "@
154 if (!$?) { exit(1) }
155 - name: download vcpkg artifacts
156 shell: powershell
157 run: |
158 $urlbase = "https://dev.azure.com/git/git/_apis/build/builds"
159 $id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=9&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id
160 $downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[0].resource.downloadUrl
161 (New-Object Net.WebClient).DownloadFile($downloadUrl, "compat.zip")
162 Expand-Archive compat.zip -DestinationPath . -Force
163 Remove-Item compat.zip
164 - name: add msbuild to PATH
165 uses: microsoft/setup-msbuild@v1.0.0
166 - name: MSBuild
167 run: msbuild git.sln -property:Configuration=Release -property:Platform=x64 -maxCpuCount:4 -property:PlatformToolset=v142
168 - name: bundle artifact tar
169 shell: powershell
170 env:
171 MSVC: 1
172 VCPKG_ROOT: ${{github.workspace}}\compat\vcbuild\vcpkg
173 run: |
174 & compat\vcbuild\vcpkg_copy_dlls.bat release
175 if (!$?) { exit(1) }
176 & git-sdk-64-minimal\usr\bin\bash.exe -lc @"
177 mkdir -p artifacts &&
178 eval \"`$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts 2>&1 | grep ^tar)\"
179 "@
180 - name: upload build artifacts
181 uses: actions/upload-artifact@v1
182 with:
183 name: vs-artifacts
184 path: artifacts
185 vs-test:
186 runs-on: windows-latest
187 needs: [vs-build, windows-build]
188 strategy:
189 matrix:
190 nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
191 steps:
192 - uses: actions/checkout@v1
193 - name: download git-sdk-64-minimal
194 uses: actions/download-artifact@v1
195 with:
196 name: git-sdk-64-minimal
197 path: ${{github.workspace}}/git-sdk-64-minimal/
198 - name: download build artifacts
199 uses: actions/download-artifact@v1
200 with:
201 name: vs-artifacts
202 path: ${{github.workspace}}
203 - name: extract build artifacts
204 shell: bash
205 run: tar xf artifacts.tar.gz
206 - name: test (parallel)
207 shell: powershell
208 env:
209 MSYSTEM: MINGW64
210 NO_SVN_TESTS: 1
211 GIT_TEST_SKIP_REBASE_P: 1
212 run: |
213 & .\git-sdk-64-minimal\usr\bin\bash.exe -lc @"
214 # Let Git ignore the SDK and the test-cache
215 printf '%s\n' /git-sdk-64-minimal/ /test-cache/ >>.git/info/exclude
216
217 cd t &&
218 PATH=\"`$PWD/helper:`$PATH\" &&
219 test-tool.exe run-command testsuite --jobs=10 -V -x --write-junit-xml \
220 `$(test-tool.exe path-utils slice-tests \
221 ${{matrix.nr}} 10 t[0-9]*.sh)
222 "@
223 regular:
224 needs: ci-config
225 if: needs.ci-config.outputs.enabled == 'yes'
226 strategy:
227 matrix:
228 vector:
229 - jobname: linux-clang
230 cc: clang
231 pool: ubuntu-latest
232 - jobname: linux-gcc
233 cc: gcc
234 pool: ubuntu-latest
235 - jobname: osx-clang
236 cc: clang
237 pool: macos-latest
238 - jobname: osx-gcc
239 cc: gcc
240 pool: macos-latest
241 - jobname: GETTEXT_POISON
242 cc: gcc
243 pool: ubuntu-latest
244 env:
245 CC: ${{matrix.vector.cc}}
246 jobname: ${{matrix.vector.jobname}}
247 runs-on: ${{matrix.vector.pool}}
248 steps:
249 - uses: actions/checkout@v1
250 - run: ci/install-dependencies.sh
251 - run: ci/run-build-and-tests.sh
252 - run: ci/print-test-failures.sh
253 if: failure()
254 - name: Upload failed tests' directories
255 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
256 uses: actions/upload-artifact@v1
257 with:
258 name: failed-tests-${{matrix.vector.jobname}}
259 path: ${{env.FAILED_TEST_ARTIFACTS}}
260 dockerized:
261 needs: ci-config
262 if: needs.ci-config.outputs.enabled == 'yes'
263 strategy:
264 matrix:
265 vector:
266 - jobname: linux-musl
267 image: alpine
268 - jobname: Linux32
269 image: daald/ubuntu32:xenial
270 env:
271 jobname: ${{matrix.vector.jobname}}
272 runs-on: ubuntu-latest
273 container: ${{matrix.vector.image}}
274 steps:
275 - uses: actions/checkout@v1
276 - run: ci/install-docker-dependencies.sh
277 - run: ci/run-build-and-tests.sh
278 - run: ci/print-test-failures.sh
279 if: failure()
280 - name: Upload failed tests' directories
281 if: failure() && env.FAILED_TEST_ARTIFACTS != ''
282 uses: actions/upload-artifact@v1
283 with:
284 name: failed-tests-${{matrix.vector.jobname}}
285 path: ${{env.FAILED_TEST_ARTIFACTS}}
286 static-analysis:
287 needs: ci-config
288 if: needs.ci-config.outputs.enabled == 'yes'
289 env:
290 jobname: StaticAnalysis
291 runs-on: ubuntu-latest
292 steps:
293 - uses: actions/checkout@v1
294 - run: ci/install-dependencies.sh
295 - run: ci/run-static-analysis.sh
296 documentation:
297 needs: ci-config
298 if: needs.ci-config.outputs.enabled == 'yes'
299 env:
300 jobname: Documentation
301 runs-on: ubuntu-latest
302 steps:
303 - uses: actions/checkout@v1
304 - run: ci/install-dependencies.sh
305 - run: ci/test-documentation.sh