Skip to content

Commit 9300298

Browse files
committed
Merge pull request #83 from dscho/run-gits-test-suite
ci: run Git's entire test suite
2 parents 55cd7cb + 66a0df8 commit 9300298

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

0 commit comments

Comments
 (0)