Skip to content

Commit 882031d

Browse files
committed
Merge pull request #83 from dscho/run-gits-test-suite
ci: run Git's entire test suite
2 parents 3b8d002 + 454f7a4 commit 882031d

File tree

1 file changed

+181
-0
lines changed

1 file changed

+181
-0
lines changed

.github/workflows/build.yaml

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

0 commit comments

Comments
 (0)