Skip to content

Commit 889cacb

Browse files
sgngitster
authored andcommitted
ci: configure GitHub Actions for CI/PR
This patch adds CI builds via GitHub Actions. While the underlying technology is at least _very_ similar to that of Azure Pipelines, GitHub Actions are much easier to set up than Azure Pipelines: - no need to install a GitHub App, - no need to set up an Azure DevOps account, - all you need to do is push to your fork on GitHub. Therefore, it makes a lot of sense for us to have a working GitHub Actions setup. While copy/editing `azure-pipelines.yml` into `.github/workflows/main.yml`, we also use the opportunity to accelerate the step that sets up a minimal subset of Git for Windows' SDK in the Windows-build job: - we now download a `.tar.xz` stored in Azure Blobs and extract it simultaneously by calling `curl` and piping the result to `tar`, - decompressing via `xz`, - all three utilities are installed together with Git for Windows At the same time, we also make use of the matrix build feature, which reduces the amount of repeated text by quite a bit. Also, we do away with the parts that try to mount a file share on which `prove` can store data between runs. It is just too complicated to set up, and most times the tree changes anyway, so there is little return on investment there. Initial-patch-by: Johannes Schindelin <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Đoàn Trần Công Danh <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4fef632 commit 889cacb

File tree

1 file changed

+212
-0
lines changed

1 file changed

+212
-0
lines changed

.github/workflows/main.yml

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
name: CI/PR
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
DEVELOPER: 1
7+
8+
jobs:
9+
windows-build:
10+
runs-on: windows-latest
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: download git-sdk-64-minimal
14+
shell: bash
15+
run: a=git-sdk-64-minimal && mkdir -p $a && curl -# https://wingit.blob.core.windows.net/ci-artifacts/$a.tar.xz | tar -C $a -xJf -
16+
- name: build
17+
shell: powershell
18+
env:
19+
HOME: ${{runner.workspace}}
20+
MSYSTEM: MINGW64
21+
NO_PERL: 1
22+
run: |
23+
& .\git-sdk-64-minimal\usr\bin\bash.exe -lc @"
24+
printf '%s\n' /git-sdk-64-minimal/ >>.git/info/exclude
25+
26+
ci/make-test-artifacts.sh artifacts
27+
"@
28+
- name: upload build artifacts
29+
uses: actions/upload-artifact@v1
30+
with:
31+
name: windows-artifacts
32+
path: artifacts
33+
windows-test:
34+
runs-on: windows-latest
35+
needs: [windows-build]
36+
strategy:
37+
matrix:
38+
nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
39+
steps:
40+
- uses: actions/checkout@v1
41+
- name: download git-sdk-64-minimal
42+
shell: bash
43+
run: a=git-sdk-64-minimal && mkdir -p $a && curl -# https://wingit.blob.core.windows.net/ci-artifacts/$a.tar.xz | tar -C $a -xJf -
44+
- name: download build artifacts
45+
uses: actions/download-artifact@v1
46+
with:
47+
name: windows-artifacts
48+
path: ${{github.workspace}}
49+
- name: extract build artifacts
50+
shell: bash
51+
run: tar xf artifacts.tar.gz
52+
- name: test
53+
shell: powershell
54+
run: |
55+
& .\git-sdk-64-minimal\usr\bin\bash.exe -lc @"
56+
# Let Git ignore the SDK
57+
printf '%s\n' /git-sdk-64-minimal/ >>.git/info/exclude
58+
59+
ci/run-test-slice.sh ${{matrix.nr}} 10
60+
"@
61+
- name: ci/print-test-failures.sh
62+
if: failure()
63+
shell: powershell
64+
run: |
65+
& .\git-sdk-64-minimal\usr\bin\bash.exe -lc ci/print-test-failures.sh
66+
vs-build:
67+
env:
68+
MSYSTEM: MINGW64
69+
NO_PERL: 1
70+
GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'"
71+
runs-on: windows-latest
72+
steps:
73+
- uses: actions/checkout@v1
74+
- name: download git-sdk-64-minimal
75+
shell: bash
76+
run: a=git-sdk-64-minimal && mkdir -p $a && curl -# https://wingit.blob.core.windows.net/ci-artifacts/$a.tar.xz | tar -C $a -xJf -
77+
- name: generate Visual Studio solution
78+
shell: powershell
79+
run: |
80+
& .\git-sdk-64-minimal\usr\bin\bash.exe -lc @"
81+
make NDEBUG=1 DEVELOPER=1 vcxproj
82+
"@
83+
if (!$?) { exit(1) }
84+
- name: download vcpkg artifacts
85+
shell: powershell
86+
run: |
87+
$urlbase = "https://dev.azure.com/git/git/_apis/build/builds"
88+
$id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=9&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id
89+
$downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[0].resource.downloadUrl
90+
(New-Object Net.WebClient).DownloadFile($downloadUrl, "compat.zip")
91+
Expand-Archive compat.zip -DestinationPath . -Force
92+
Remove-Item compat.zip
93+
- name: add msbuild to PATH
94+
uses: microsoft/[email protected]
95+
- name: MSBuild
96+
run: msbuild git.sln -property:Configuration=Release -property:Platform=x64 -maxCpuCount:4 -property:PlatformToolset=v142
97+
- name: bundle artifact tar
98+
shell: powershell
99+
env:
100+
MSVC: 1
101+
VCPKG_ROOT: ${{github.workspace}}\compat\vcbuild\vcpkg
102+
run: |
103+
& compat\vcbuild\vcpkg_copy_dlls.bat release
104+
if (!$?) { exit(1) }
105+
& git-sdk-64-minimal\usr\bin\bash.exe -lc @"
106+
mkdir -p artifacts &&
107+
eval \"`$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts 2>&1 | grep ^tar)\"
108+
"@
109+
- name: upload build artifacts
110+
uses: actions/upload-artifact@v1
111+
with:
112+
name: vs-artifacts
113+
path: artifacts
114+
vs-test:
115+
runs-on: windows-latest
116+
needs: [vs-build]
117+
strategy:
118+
matrix:
119+
nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
120+
steps:
121+
- uses: actions/checkout@v1
122+
- name: download git-64-portable
123+
shell: bash
124+
run: a=git-64-portable && mkdir -p $a && curl -# https://wingit.blob.core.windows.net/ci-artifacts/$a.tar.xz | tar -C $a -xJf -
125+
- name: download build artifacts
126+
uses: actions/download-artifact@v1
127+
with:
128+
name: vs-artifacts
129+
path: ${{github.workspace}}
130+
- name: extract build artifacts
131+
shell: bash
132+
run: tar xf artifacts.tar.gz
133+
- name: test (parallel)
134+
shell: powershell
135+
env:
136+
MSYSTEM: MINGW64
137+
NO_SVN_TESTS: 1
138+
GIT_TEST_SKIP_REBASE_P: 1
139+
run: |
140+
& git-64-portable\git-cmd.exe --command=usr\bin\bash.exe -lc @"
141+
# Let Git ignore the SDK and the test-cache
142+
printf '%s\n' /git-64-portable/ /test-cache/ >>.git/info/exclude
143+
144+
cd t &&
145+
PATH=\"`$PWD/helper:`$PATH\" &&
146+
test-tool.exe run-command testsuite --jobs=10 -V -x --write-junit-xml \
147+
`$(test-tool.exe path-utils slice-tests \
148+
${{matrix.nr}} 10 t[0-9]*.sh)
149+
"@
150+
regular:
151+
strategy:
152+
matrix:
153+
vector:
154+
- jobname: linux-clang
155+
cc: clang
156+
pool: ubuntu-latest
157+
- jobname: linux-gcc
158+
cc: gcc
159+
pool: ubuntu-latest
160+
- jobname: osx-clang
161+
cc: clang
162+
pool: macos-latest
163+
- jobname: osx-gcc
164+
cc: gcc
165+
pool: macos-latest
166+
- jobname: GETTEXT_POISON
167+
cc: gcc
168+
pool: ubuntu-latest
169+
env:
170+
CC: ${{matrix.vector.cc}}
171+
jobname: ${{matrix.vector.jobname}}
172+
runs-on: ${{matrix.vector.pool}}
173+
steps:
174+
- uses: actions/checkout@v1
175+
- run: ci/install-dependencies.sh
176+
- run: ci/run-build-and-tests.sh
177+
- run: ci/print-test-failures.sh
178+
if: failure()
179+
dockerized:
180+
strategy:
181+
matrix:
182+
vector:
183+
- jobname: linux-musl
184+
image: alpine
185+
- jobname: Linux32
186+
image: daald/ubuntu32:xenial
187+
env:
188+
jobname: ${{matrix.vector.jobname}}
189+
runs-on: ubuntu-latest
190+
container: ${{matrix.vector.image}}
191+
steps:
192+
- uses: actions/checkout@v1
193+
- run: ci/install-docker-dependencies.sh
194+
- run: ci/run-build-and-tests.sh
195+
- run: ci/print-test-failures.sh
196+
if: failure()
197+
static-analysis:
198+
env:
199+
jobname: StaticAnalysis
200+
runs-on: ubuntu-latest
201+
steps:
202+
- uses: actions/checkout@v1
203+
- run: ci/install-dependencies.sh
204+
- run: ci/run-static-analysis.sh
205+
documentation:
206+
env:
207+
jobname: Documentation
208+
runs-on: ubuntu-latest
209+
steps:
210+
- uses: actions/checkout@v1
211+
- run: ci/install-dependencies.sh
212+
- run: ci/test-documentation.sh

0 commit comments

Comments
 (0)