Skip to content

Commit 725b84b

Browse files
committed
ci: run Git's entire test suite
One particularly important part of Git for Windows' MSYS2 runtime is that it is used to run Git's tests, and regressions happened there: For example, the first iteration of MSYS2 runtime v3.5.5 caused plenty of hangs. To verify that this does not happen anymore, let's reuse what `setup-git-for-windows-sdk` uses in Git's very own CI: - determine the latest successful `ci-artifacts` workflow run in git-for-windows/git-sdk-64 - download its Git files and build artifacts - download its minimal-sdk - overwrite the MSYS2 runtime in the minimal-sdk - run the test suite and the assorted validations just like the `ci-artifacts` workflow (from which these jobs are copied) Signed-off-by: Johannes Schindelin <[email protected]>
1 parent e8cc96f commit 725b84b

File tree

1 file changed

+188
-0
lines changed

1 file changed

+188
-0
lines changed

.github/workflows/build.yaml

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,191 @@ jobs:
3737
with:
3838
name: install
3939
path: _dest/
40+
minimal-sdk-artifact:
41+
runs-on: windows-latest
42+
needs: [build]
43+
outputs:
44+
git-artifacts-extract-location: ${{ steps.git-artifacts-extract-location.outputs.result }}
45+
steps:
46+
- name: get latest successful ci-artifacts run
47+
id: ci-artifacts-run-id
48+
uses: actions/github-script@v7
49+
env:
50+
G4W_SDK_REPO: git-for-windows/git-sdk-64
51+
with:
52+
script: |
53+
const [ owner, repo ] = process.env.G4W_SDK_REPO.split('/')
54+
const info = await github.rest.actions.listWorkflowRuns({
55+
owner,
56+
repo,
57+
workflow_id: 938271, // ci-artifacts.yml
58+
status: 'success',
59+
per_page: 1
60+
})
61+
return info.data.workflow_runs[0].id
62+
- name: get the ci-artifacts build's artifacts
63+
shell: bash
64+
run: |
65+
run_id=${{ steps.ci-artifacts-run-id.outputs.result }} &&
66+
67+
curl -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \
68+
-L https://api.github.com/repos/$G4W_SDK_REPO/actions/runs/$run_id/artifacts |
69+
jq -r '.artifacts[] | [.name, .archive_download_url] | @tsv' |
70+
tr -d '\r' |
71+
while read name url
72+
do
73+
echo "$name"
74+
curl -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \
75+
-#sLo /tmp/"$name".zip "$url" &&
76+
unzip -qo /tmp/"$name".zip ||
77+
exit $?
78+
done
79+
ls -la
80+
- uses: actions/download-artifact@v4
81+
with:
82+
name: install
83+
- name: overwrite MSYS2 runtime with the just-built msys2-runtime
84+
shell: bash
85+
run: |
86+
set -x &&
87+
case "$MSYS2_RUNTIME_ARTIFACT_URL" in
88+
https://github.com/*/actions/runs/[0-9]*/artifacts/[0-9]*)
89+
MSYS2_RUNTIME_ARTIFACT_URL="$(echo "$MSYS2_RUNTIME_ARTIFACT_URL" |
90+
sed 's|^\(https://\)\(github.com/\)\(.*/actions/\)runs/[0-9]*/\(artifacts/[0-9]*\)$|\1api.\2repos/\3\4/zip|')"
91+
;;
92+
esac
93+
94+
curl -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \
95+
-fLo msys2-runtime.zip "$MSYS2_RUNTIME_ARTIFACT_URL" &&
96+
ls -lart &&
97+
mkdir minimal-sdk &&
98+
cd minimal-sdk &&
99+
tar xzf ../git-sdk-x86_64-minimal.tar.gz &&
100+
tar -C ../install cf - . | tar xf - &&
101+
tar cvf - * .[0-9A-Za-z]* | gzip -1 >../git-sdk-x86_64-minimal.tar.gz
102+
- name: upload minimal-sdk artifact
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: minimal-sdk
106+
path: git-sdk-x86_64-minimal.tar.gz
107+
- name: run `uname`
108+
run: minimal-sdk\usr\bin\uname.exe -a
109+
- name: determine where `git-artifacts` want to be extracted
110+
id: git-artifacts-extract-location
111+
shell: bash
112+
run: |
113+
echo "result=$(tar Oxf git-artifacts.tar.gz git/bin-wrappers/git |
114+
sed -n 's|^GIT_EXEC_PATH='\''\(.*\)/git'\''$|\1|p')" >>$GITHUB_OUTPUT
115+
- name: upload git artifacts for testing
116+
uses: actions/upload-artifact@v4
117+
with:
118+
name: git-artifacts
119+
path: git-artifacts.tar.gz
120+
test-minimal-sdk:
121+
runs-on: windows-latest
122+
needs: [minimal-sdk-artifact]
123+
strategy:
124+
matrix:
125+
# 0..16 permuted according to the matrix builds' timings as of git/git@9fadedd63
126+
nr: [9, 6, 13, 0, 8, 5, 2, 16, 15, 11, 10, 1, 7, 3, 14, 12, 4]
127+
fail-fast: false
128+
steps:
129+
- name: download minimal-sdk artifact
130+
uses: actions/download-artifact@v4
131+
with:
132+
name: minimal-sdk
133+
path: ${{github.workspace}}
134+
- name: uncompress minimal-sdk
135+
shell: bash
136+
run: |
137+
mkdir -p minimal-sdk &&
138+
tar -C minimal-sdk -xzf git-sdk-x86_64-minimal.tar.gz &&
139+
cygpath -aw minimal-sdk/usr/bin >>$GITHUB_PATH
140+
- name: download git artifacts
141+
uses: actions/download-artifact@v4
142+
with:
143+
name: git-artifacts
144+
path: ${{github.workspace}}
145+
- name: uncompress git-artifacts
146+
shell: bash
147+
env:
148+
GIT_ARTIFACTS_EXTRACT_LOCATION: ${{ needs.minimal-sdk-artifact.outputs.git-artifacts-extract-location }}
149+
run: |
150+
mkdir -p "$GIT_ARTIFACTS_EXTRACT_LOCATION" &&
151+
tar -C "$GIT_ARTIFACTS_EXTRACT_LOCATION" -xzf git-artifacts.tar.gz
152+
- name: test
153+
shell: bash
154+
run: |
155+
set -x
156+
. /etc/profile
157+
test "$(cygpath -aw /)" = "${{github.workspace}}\minimal-sdk" || exit 1
158+
cd "$GIT_ARTIFACTS_EXTRACT_LOCATION"/git/t &&
159+
make T="$(ls -S t[0-9]*.sh | awk '!((NR+${{matrix.nr}})%17)' | tr '\n' \ )" prove || {
160+
for d in trash*
161+
do
162+
t=${d#trash directory.}
163+
echo ===========================
164+
echo Failed: $t.sh
165+
cat test-results/$t.out
166+
done
167+
exit 1
168+
}
169+
env:
170+
GIT_ARTIFACTS_EXTRACT_LOCATION: ${{ needs.minimal-sdk-artifact.outputs.git-artifacts-extract-location }}
171+
PATH: ${{github.workspace}}\minimal-sdk\mingw64\bin;${{github.workspace}}\minimal-sdk\usr\bin;${{github.workspace}}\minimal-sdk\usr\bin\core_perl;C:\Windows\system32;C:\Windows;C:\Windows\system32\wbem
172+
GIT_TEST_OPTS: --verbose-log -x --no-chain-lint
173+
GIT_PROVE_OPTS: --timer --jobs 8
174+
NO_SVN_TESTS: 1
175+
assorted-validations:
176+
runs-on: windows-latest
177+
needs: [minimal-sdk-artifact]
178+
steps:
179+
- name: download minimal-sdk artifact
180+
uses: actions/download-artifact@v4
181+
with:
182+
name: minimal-sdk
183+
path: ${{github.workspace}}
184+
- name: uncompress minimal-sdk
185+
shell: bash
186+
run: |
187+
mkdir -p minimal-sdk &&
188+
tar -C minimal-sdk -xzf git-sdk-x86_64-minimal.tar.gz &&
189+
cygpath -aw minimal-sdk/usr/bin >>$GITHUB_PATH
190+
- name: run some tests
191+
shell: bash
192+
env:
193+
PATH: ${{github.workspace}}\minimal-sdk\mingw64\bin;${{github.workspace}}\minimal-sdk\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32\wbem
194+
run: |
195+
set -x
196+
. /etc/profile
197+
198+
# cygpath works
199+
test "$(cygpath -aw /)" = "${{github.workspace}}\minimal-sdk" || exit 1
200+
201+
# comes with GCC and can compile a DLL
202+
test "$(type -p gcc)" = "/mingw64/bin/gcc" || exit 1
203+
cat >dll.c <<-\EOF &&
204+
__attribute__((dllexport)) int increment(int i)
205+
{
206+
return i + 1;
207+
}
208+
EOF
209+
210+
gcc -Wall -g -O2 -shared -o sample.dll dll.c || exit 1
211+
ls -la
212+
213+
# stat works
214+
test "stat is /usr/bin/stat" = "$(type stat)" || exit 1
215+
stat /usr/bin/stat.exe || exit 1
216+
217+
# unzip works
218+
test "unzip is /usr/bin/unzip" = "$(type unzip)" || exit 1
219+
git init unzip-test &&
220+
echo TEST >unzip-test/README &&
221+
git -C unzip-test add -A &&
222+
git -C unzip-test -c user.name=A -c [email protected] commit -m 'Testing, testing...' &&
223+
git --git-dir=unzip-test/.git archive -o test.zip HEAD &&
224+
unzip -v test.zip >unzip-test.out &&
225+
cat unzip-test.out &&
226+
test "grep is /usr/bin/grep" = "$(type grep)" || exit 1
227+
grep README unzip-test.out

0 commit comments

Comments
 (0)