Skip to content

Commit 6d52ba3

Browse files
committed
ci-artifacts: build Git and run its test suite
Now that Git for Windows no longer needs to rely on Azure VMs in my personal Azure account to run the Windows/ARM64 automation, it is time to "un-drop" the more expensive parts of the `ci-artifacts` workflow that had not been ported from the x86_64 flavor to the aarch64 one. In fact, this is more than just a revert because the x86_64 flavor has seen dramatic improvements, e.g. refactoring running the test suite into a reusable workflow. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 0da8fb0 commit 6d52ba3

File tree

2 files changed

+179
-39
lines changed

2 files changed

+179
-39
lines changed

.github/workflows/ci-artifacts.yml

Lines changed: 63 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
minimal-sdk-artifact:
1818
if: github.repository_owner == 'git-for-windows'
1919
runs-on: windows-11-arm
20+
outputs:
21+
git-artifacts-extract-location: ${{ steps.git-artifacts-extract-location.outputs.result }}
2022
steps:
2123
- name: clone git-sdk-arm64
2224
run: |
@@ -36,6 +38,35 @@ jobs:
3638
- name: compress artifact
3739
shell: bash
3840
run: mkdir artifacts && (cd minimal-sdk && tar cvf - * .[0-9A-Za-z]*) | gzip -1 >artifacts/git-sdk-aarch64-minimal.tar.gz
41+
- name: upload minimal-sdk artifact
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: minimal-sdk
45+
path: artifacts/git-sdk-aarch64-minimal.tar.gz
46+
- name: clone git.git's `master`
47+
run: git clone --depth=1 --branch master https://github.com/git/git ..\git
48+
- name: build current `master` of git.git
49+
shell: bash
50+
run: |
51+
set -x
52+
. /etc/profile
53+
test "$(cygpath -aw /)" = "${{github.workspace}}\minimal-sdk" || exit 1
54+
test "$(type -p gcc)" = "/clangarm64/bin/gcc" || exit 1
55+
make -C ../git DEVELOPER=1 NO_PERL=1 SKIP_DASHED_BUILT_INS=YesPlease -j8 all strip
56+
- name: compress git artifacts
57+
shell: bash
58+
run: tar -C .. -czf git-artifacts.tar.gz --exclude '*.a' --exclude '*.o' --exclude .git --exclude .depend git
59+
- name: upload git artifacts for testing
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: git-artifacts
63+
path: git-artifacts.tar.gz
64+
- name: determine where `git-artifacts` want to be extracted
65+
id: git-artifacts-extract-location
66+
shell: bash
67+
run: |
68+
cd .. &&
69+
echo "result=$(pwd)" >>$GITHUB_OUTPUT
3970
- name: create zip and 7z SFX variants of the minimal SDK
4071
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
4172
shell: bash
@@ -44,51 +75,44 @@ jobs:
4475
do
4576
git --git-dir=git-sdk-arm64.git show HEAD:$path >${path##*/}
4677
done &&
47-
(cd minimal-sdk && ../7z.exe a -mmt=on -mx9 ../artifacts/git-sdk-aarch64-minimal.zip * .?*) &&
78+
mkdir minimal-sdk-extra &&
79+
(cd minimal-sdk && ../7z.exe a -mmt=on -mx9 ../minimal-sdk-extra/git-sdk-aarch64-minimal.zip * .?*) &&
4880
(cd minimal-sdk && ../7z.exe a -t7z -mmt=on -m0=lzma -mqs -mlc=8 -mx=9 -md=256M -mfb=273 -ms=256M -sfx../7zCon.sfx \
49-
../artifacts/git-sdk-aarch64-minimal.7z.exe * .?*)
50-
- name: run some tests
51-
shell: bash
52-
run: |
53-
set -x
54-
. /etc/profile
55-
56-
# cygpath works
57-
test "$(cygpath -aw /)" = "${{github.workspace}}\minimal-sdk" || exit 1
58-
59-
# comes with Clang and can compile a DLL
60-
test "$(type -p clang)" = "/clangarm64/bin/clang" || exit 1
61-
cat >dll.c <<-\EOF &&
62-
__attribute__((dllexport)) int increment(int i)
63-
{
64-
return i + 1;
65-
}
66-
EOF
67-
68-
clang -Wall -g -O2 -shared -o sample.dll dll.c || exit 1
69-
ls -la
81+
../minimal-sdk-extra/git-sdk-aarch64-minimal.7z.exe * .?*)
82+
- name: upload minimal-sdk-extra artifacts
83+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: minimal-sdk-extra
87+
path: minimal-sdk-extra
7088

71-
# stat works
72-
test "stat is /usr/bin/stat" = "$(type stat)" || exit 1
73-
stat /usr/bin/stat.exe || exit 1
89+
test-minimal-sdk:
90+
needs: minimal-sdk-artifact
91+
uses: ./.github/workflows/test-ci-artifacts.yml
92+
with:
93+
git-artifacts-extract-location: ${{ needs.minimal-sdk-artifact.outputs.git-artifacts-extract-location }}
94+
permissions:
95+
contents: read
7496

75-
# unzip works
76-
test "unzip is /usr/bin/unzip" = "$(type unzip)" || exit 1
77-
git init unzip-test &&
78-
echo TEST >unzip-test/README &&
79-
git -C unzip-test add -A &&
80-
git -C unzip-test -c user.name=A -c [email protected] commit -m 'Testing, testing...' &&
81-
git --git-dir=unzip-test/.git archive -o test.zip HEAD &&
82-
unzip -v test.zip >unzip-test.out &&
83-
cat unzip-test.out &&
84-
test "grep is /usr/bin/grep" = "$(type grep)" || exit 1
85-
grep README unzip-test.out
97+
publish-release-assets:
98+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
99+
runs-on: ubuntu-latest
100+
needs: test-minimal-sdk
101+
steps:
102+
- name: download minimal-sdk artifact
103+
uses: actions/download-artifact@v4
104+
with:
105+
name: minimal-sdk
106+
path: ${{github.workspace}}
107+
- name: download minimal-sdk artifact
108+
uses: actions/download-artifact@v4
109+
with:
110+
name: minimal-sdk-extra
111+
path: ${{github.workspace}}
86112
- name: publish release assets
87-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
88113
uses: actions/github-script@v7
89114
with:
90115
script: |
91-
process.chdir('artifacts')
92116
const req = { owner: context.repo.owner, repo: context.repo.repo }
93117
// find or create the GitHub release named `ci-artifacts`
94118
const release = await (async () => {
@@ -157,4 +181,4 @@ jobs:
157181
...req,
158182
ref: 'tags/ci-artifacts',
159183
sha: process.env.GITHUB_SHA,
160-
})
184+
})
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: test-ci-artifacts
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
git-artifacts-extract-location:
7+
required: true
8+
type: string
9+
10+
env:
11+
LC_CTYPE: C.UTF-8
12+
13+
jobs:
14+
test-minimal-sdk:
15+
runs-on: windows-11-arm
16+
strategy:
17+
matrix:
18+
# 0..16 permuted according to the matrix builds' timings as of git/git@9fadedd63
19+
nr: [9, 6, 13, 0, 8, 5, 2, 16, 15, 11, 10, 1, 7, 3, 14, 12, 4]
20+
steps:
21+
- name: download minimal-sdk artifact
22+
uses: actions/download-artifact@v4
23+
with:
24+
name: minimal-sdk
25+
path: ${{github.workspace}}
26+
- name: uncompress minimal-sdk
27+
shell: bash
28+
run: |
29+
mkdir -p minimal-sdk &&
30+
tar -C minimal-sdk -xzf git-sdk-aarch64-minimal.tar.gz &&
31+
cygpath -aw minimal-sdk/usr/bin >>$GITHUB_PATH
32+
- name: download git artifacts
33+
uses: actions/download-artifact@v4
34+
with:
35+
name: git-artifacts
36+
path: ${{github.workspace}}
37+
- name: uncompress git-artifacts
38+
shell: bash
39+
env:
40+
GIT_ARTIFACTS_EXTRACT_LOCATION: ${{ inputs.git-artifacts-extract-location }}
41+
run: |
42+
mkdir -p "$GIT_ARTIFACTS_EXTRACT_LOCATION" &&
43+
tar -C "$GIT_ARTIFACTS_EXTRACT_LOCATION" -xzf git-artifacts.tar.gz
44+
- name: test
45+
shell: bash
46+
run: |
47+
set -x
48+
. /etc/profile
49+
test "$(cygpath -aw /)" = "${{github.workspace}}\minimal-sdk" || exit 1
50+
cd "$GIT_ARTIFACTS_EXTRACT_LOCATION"/git/t &&
51+
make T="$(ls -S t[0-9]*.sh | awk '!((NR+${{matrix.nr}})%17)' | tr '\n' \ )" prove || {
52+
for d in trash*
53+
do
54+
t=${d#trash directory.}
55+
echo ===========================
56+
echo Failed: $t.sh
57+
cat test-results/$t.out
58+
done
59+
exit 1
60+
}
61+
env:
62+
GIT_ARTIFACTS_EXTRACT_LOCATION: ${{ inputs.git-artifacts-extract-location }}
63+
GIT_TEST_OPTS: --verbose-log -x --no-chain-lint
64+
GIT_PROVE_OPTS: --timer --jobs 8
65+
NO_SVN_TESTS: 1
66+
assorted-validations:
67+
runs-on: windows-11-arm
68+
steps:
69+
- name: download minimal-sdk artifact
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: minimal-sdk
73+
path: ${{github.workspace}}
74+
- name: uncompress minimal-sdk
75+
shell: bash
76+
run: |
77+
mkdir -p minimal-sdk &&
78+
tar -C minimal-sdk -xzf git-sdk-aarch64-minimal.tar.gz &&
79+
cygpath -aw minimal-sdk/usr/bin >>$GITHUB_PATH
80+
- name: run some tests
81+
shell: bash
82+
run: |
83+
set -x
84+
. /etc/profile
85+
86+
# cygpath works
87+
test "$(cygpath -aw /)" = "${{github.workspace}}\minimal-sdk" || exit 1
88+
89+
# comes with GCC and can compile a DLL
90+
test "$(type -p gcc)" = "/clangarm64/bin/gcc" || exit 1
91+
cat >dll.c <<-\EOF &&
92+
__attribute__((dllexport)) int increment(int i)
93+
{
94+
return i + 1;
95+
}
96+
EOF
97+
98+
gcc -Wall -g -O2 -shared -o sample.dll dll.c || exit 1
99+
ls -la
100+
101+
# stat works
102+
test "stat is /usr/bin/stat" = "$(type stat)" || exit 1
103+
stat /usr/bin/stat.exe || exit 1
104+
105+
# unzip works
106+
test "unzip is /usr/bin/unzip" = "$(type unzip)" || exit 1
107+
git init unzip-test &&
108+
echo TEST >unzip-test/README &&
109+
git -C unzip-test add -A &&
110+
git -C unzip-test -c user.name=A -c [email protected] commit -m 'Testing, testing...' &&
111+
git --git-dir=unzip-test/.git archive -o test.zip HEAD &&
112+
unzip -v test.zip >unzip-test.out &&
113+
cat unzip-test.out &&
114+
test "grep is /usr/bin/grep" = "$(type grep)" || exit 1
115+
grep README unzip-test.out
116+

0 commit comments

Comments
 (0)