Skip to content

Commit ba77083

Browse files
authored
Merge pull request #37 from git-for-windows/use-hosted-windows-arm64-runners
ci: use hosted Windows/ARM64 runners and extend `ci-artifacts` again
2 parents 268b60e + 1b7ec02 commit ba77083

File tree

6 files changed

+308
-164
lines changed

6 files changed

+308
-164
lines changed

.github/workflows/check-for-missing-dlls.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ env:
1111
jobs:
1212
check:
1313
if: github.repository_owner == 'git-for-windows'
14-
runs-on: [Windows, ARM64]
14+
runs-on: windows-11-arm
1515
steps:
1616
- name: clone git-sdk-arm64
1717
shell: bash

.github/workflows/ci-artifacts.yml

Lines changed: 187 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -1,160 +1,187 @@
1-
name: ci-artifacts
2-
3-
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
8-
9-
# For the continuous `ci-artifacts` release
10-
permissions:
11-
contents: write
12-
13-
env:
14-
LC_CTYPE: C.UTF-8
15-
16-
jobs:
17-
minimal-sdk-artifact:
18-
if: github.repository_owner == 'git-for-windows'
19-
runs-on: [Windows, ARM64]
20-
steps:
21-
- name: clone git-sdk-arm64
22-
run: |
23-
git init --bare git-sdk-arm64.git &&
24-
git --git-dir=git-sdk-arm64.git remote add origin https://github.com/${{github.repository}} &&
25-
git --git-dir=git-sdk-arm64.git config remote.origin.promisor true &&
26-
git --git-dir=git-sdk-arm64.git config remote.origin.partialCloneFilter blob:none &&
27-
git --git-dir=git-sdk-arm64.git fetch --depth=1 origin ${{github.sha}} &&
28-
git --git-dir=git-sdk-arm64.git update-ref --no-deref HEAD ${{github.sha}}
29-
- name: clone build-extra
30-
run: git clone --depth=1 --single-branch -b main https://github.com/git-for-windows/build-extra
31-
- name: build git-sdk-arm64-minimal-sdk
32-
shell: bash
33-
run: |
34-
sh -x ./build-extra/please.sh create-sdk-artifact --sdk=git-sdk-arm64.git minimal-sdk &&
35-
cygpath -aw minimal-sdk/usr/bin >>$GITHUB_PATH
36-
- name: compress artifact
37-
shell: bash
38-
run: mkdir artifacts && (cd minimal-sdk && tar cvf - * .[0-9A-Za-z]*) | gzip -1 >artifacts/git-sdk-aarch64-minimal.tar.gz
39-
- name: create zip and 7z SFX variants of the minimal SDK
40-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
41-
shell: bash
42-
run: |
43-
for path in clangarm64/bin/7z.exe clangarm64/bin/7z.dll clangarm64/lib/7zip/7zCon.sfx clangarm64/bin/libc++.dll
44-
do
45-
git --git-dir=git-sdk-arm64.git show HEAD:$path >${path##*/}
46-
done &&
47-
(cd minimal-sdk && ../7z.exe a -mmt=on -mx9 ../artifacts/git-sdk-aarch64-minimal.zip * .?*) &&
48-
(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
70-
71-
# stat works
72-
test "stat is /usr/bin/stat" = "$(type stat)" || exit 1
73-
stat /usr/bin/stat.exe || exit 1
74-
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
86-
- name: publish release assets
87-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
88-
uses: actions/github-script@v7
89-
with:
90-
script: |
91-
process.chdir('artifacts')
92-
const req = { owner: context.repo.owner, repo: context.repo.repo }
93-
// find or create the GitHub release named `ci-artifacts`
94-
const release = await (async () => {
95-
try {
96-
return await github.rest.repos.getReleaseByTag({ ...req, tag: 'ci-artifacts' });
97-
} catch (e) {
98-
if (e.status === 404) {
99-
// create the `ci-artifacts` GitHub release based on the current revision
100-
const workflowRunsURL = `${context.serverUrl}/${
101-
process.env.GITHUB_WORKFLOW_REF.replace(/\/\.github\/workflows\/([^@]+).*/, '/actions/workflows/$1')
102-
}`
103-
return await github.rest.repos.createRelease({
104-
... req,
105-
tag_name: 'ci-artifacts',
106-
body: `Continuous release of \`ci-artifacts\`
107-
108-
This release is automatically updated by the [ci-artifacts](${workflowRunsURL}) workflow.
109-
110-
For technical reasons, allow up to a minute for release assets to be missing while they are updated.`,
111-
});
112-
}
113-
throw e;
114-
}
115-
})()
116-
117-
const fs = require('fs')
118-
for (const fileName of [
119-
'git-sdk-aarch64-minimal.tar.gz',
120-
'git-sdk-aarch64-minimal.zip',
121-
'git-sdk-aarch64-minimal.7z.exe',
122-
]) {
123-
console.log(`Uploading ${fileName}`)
124-
const uploadReq = {
125-
...req,
126-
release_id: release.data.id,
127-
name: fileName,
128-
headers: {
129-
'content-length': (await fs.promises.stat(fileName)).size,
130-
},
131-
data: fs.createReadStream(fileName),
132-
}
133-
134-
// if the asset does not yet exist, simply upload it
135-
const originalAsset = release.data.assets.filter(asset => asset.name === fileName).pop()
136-
if (!originalAsset) {
137-
const asset = await github.rest.repos.uploadReleaseAsset(uploadReq)
138-
console.log(`Uploaded to ${asset.data.browser_download_url}`)
139-
continue
140-
}
141-
142-
// otherwise upload it using a temporary file name,
143-
// then delete the old asset
144-
// and then rename the new asset;
145-
// this way, the asset is not missing for a long time
146-
const asset = await github.rest.repos.uploadReleaseAsset({ ...uploadReq, name: `tmp.${fileName}` })
147-
await github.rest.repos.deleteReleaseAsset({ ...req, asset_id: originalAsset.id })
148-
const updatedAsset = await github.rest.repos.updateReleaseAsset({...req,
149-
asset_id: asset.data.id,
150-
name: fileName,
151-
label: fileName,
152-
})
153-
console.log(`Updated ${updatedAsset.data.browser_download_url}`)
154-
}
155-
156-
await github.rest.git.updateRef({
157-
...req,
158-
ref: 'tags/ci-artifacts',
159-
sha: process.env.GITHUB_SHA,
160-
})
1+
name: ci-artifacts
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
# For the continuous `ci-artifacts` release
10+
permissions:
11+
contents: write
12+
13+
env:
14+
LC_CTYPE: C.UTF-8
15+
16+
jobs:
17+
minimal-sdk-artifact:
18+
if: github.repository_owner == 'git-for-windows'
19+
runs-on: windows-11-arm
20+
outputs:
21+
git-artifacts-extract-location: ${{ steps.git-artifacts-extract-location.outputs.result }}
22+
steps:
23+
- name: clone git-sdk-arm64
24+
run: |
25+
git init --bare git-sdk-arm64.git &&
26+
git --git-dir=git-sdk-arm64.git remote add origin https://github.com/${{github.repository}} &&
27+
git --git-dir=git-sdk-arm64.git config remote.origin.promisor true &&
28+
git --git-dir=git-sdk-arm64.git config remote.origin.partialCloneFilter blob:none &&
29+
git --git-dir=git-sdk-arm64.git fetch --depth=1 origin ${{github.sha}} &&
30+
git --git-dir=git-sdk-arm64.git update-ref --no-deref HEAD ${{github.sha}}
31+
- name: clone build-extra
32+
run: git clone --depth=1 --single-branch -b main https://github.com/git-for-windows/build-extra
33+
- name: build git-sdk-arm64-minimal-sdk
34+
shell: bash
35+
run: |
36+
sh -x ./build-extra/please.sh create-sdk-artifact --sdk=git-sdk-arm64.git minimal-sdk &&
37+
cygpath -aw minimal-sdk/usr/bin >>$GITHUB_PATH
38+
- name: compress artifact
39+
shell: bash
40+
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-for-windows/git's `main`
47+
run: git clone --depth=1 --branch main https://github.com/git-for-windows/git ..\git
48+
- name: build current `main` of git-for-windows/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: show build-options
57+
shell: bash
58+
run: ../git/git version --build-options
59+
- name: compress git artifacts
60+
shell: bash
61+
run: tar -C .. -czf git-artifacts.tar.gz --exclude '*.a' --exclude '*.o' --exclude .git --exclude .depend git
62+
- name: upload git artifacts for testing
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: git-artifacts
66+
path: git-artifacts.tar.gz
67+
- name: determine where `git-artifacts` want to be extracted
68+
id: git-artifacts-extract-location
69+
shell: bash
70+
run: |
71+
cd .. &&
72+
echo "result=$(pwd)" >>$GITHUB_OUTPUT
73+
- name: create zip and 7z SFX variants of the minimal SDK
74+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
75+
shell: bash
76+
run: |
77+
for path in clangarm64/bin/7z.exe clangarm64/bin/7z.dll clangarm64/lib/7zip/7zCon.sfx clangarm64/bin/libc++.dll
78+
do
79+
git --git-dir=git-sdk-arm64.git show HEAD:$path >${path##*/}
80+
done &&
81+
mkdir minimal-sdk-extra &&
82+
(cd minimal-sdk && ../7z.exe a -mmt=on -mx9 ../minimal-sdk-extra/git-sdk-aarch64-minimal.zip * .?*) &&
83+
(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 \
84+
../minimal-sdk-extra/git-sdk-aarch64-minimal.7z.exe * .?*)
85+
- name: upload minimal-sdk-extra artifacts
86+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: minimal-sdk-extra
90+
path: minimal-sdk-extra
91+
92+
test-minimal-sdk:
93+
needs: minimal-sdk-artifact
94+
uses: ./.github/workflows/test-ci-artifacts.yml
95+
with:
96+
git-artifacts-extract-location: ${{ needs.minimal-sdk-artifact.outputs.git-artifacts-extract-location }}
97+
permissions:
98+
contents: read
99+
100+
publish-release-assets:
101+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
102+
runs-on: ubuntu-latest
103+
needs: test-minimal-sdk
104+
steps:
105+
- name: download minimal-sdk artifact
106+
uses: actions/download-artifact@v4
107+
with:
108+
name: minimal-sdk
109+
path: ${{github.workspace}}
110+
- name: download minimal-sdk artifact
111+
uses: actions/download-artifact@v4
112+
with:
113+
name: minimal-sdk-extra
114+
path: ${{github.workspace}}
115+
- name: publish release assets
116+
uses: actions/github-script@v7
117+
with:
118+
script: |
119+
const req = { owner: context.repo.owner, repo: context.repo.repo }
120+
// find or create the GitHub release named `ci-artifacts`
121+
const release = await (async () => {
122+
try {
123+
return await github.rest.repos.getReleaseByTag({ ...req, tag: 'ci-artifacts' });
124+
} catch (e) {
125+
if (e.status === 404) {
126+
// create the `ci-artifacts` GitHub release based on the current revision
127+
const workflowRunsURL = `${context.serverUrl}/${
128+
process.env.GITHUB_WORKFLOW_REF.replace(/\/\.github\/workflows\/([^@]+).*/, '/actions/workflows/$1')
129+
}`
130+
return await github.rest.repos.createRelease({
131+
... req,
132+
tag_name: 'ci-artifacts',
133+
body: `Continuous release of \`ci-artifacts\`
134+
135+
This release is automatically updated by the [ci-artifacts](${workflowRunsURL}) workflow.
136+
137+
For technical reasons, allow up to a minute for release assets to be missing while they are updated.`,
138+
});
139+
}
140+
throw e;
141+
}
142+
})()
143+
144+
const fs = require('fs')
145+
for (const fileName of [
146+
'git-sdk-aarch64-minimal.tar.gz',
147+
'git-sdk-aarch64-minimal.zip',
148+
'git-sdk-aarch64-minimal.7z.exe',
149+
]) {
150+
console.log(`Uploading ${fileName}`)
151+
const uploadReq = {
152+
...req,
153+
release_id: release.data.id,
154+
name: fileName,
155+
headers: {
156+
'content-length': (await fs.promises.stat(fileName)).size,
157+
},
158+
data: fs.createReadStream(fileName),
159+
}
160+
161+
// if the asset does not yet exist, simply upload it
162+
const originalAsset = release.data.assets.filter(asset => asset.name === fileName).pop()
163+
if (!originalAsset) {
164+
const asset = await github.rest.repos.uploadReleaseAsset(uploadReq)
165+
console.log(`Uploaded to ${asset.data.browser_download_url}`)
166+
continue
167+
}
168+
169+
// otherwise upload it using a temporary file name,
170+
// then delete the old asset
171+
// and then rename the new asset;
172+
// this way, the asset is not missing for a long time
173+
const asset = await github.rest.repos.uploadReleaseAsset({ ...uploadReq, name: `tmp.${fileName}` })
174+
await github.rest.repos.deleteReleaseAsset({ ...req, asset_id: originalAsset.id })
175+
const updatedAsset = await github.rest.repos.updateReleaseAsset({...req,
176+
asset_id: asset.data.id,
177+
name: fileName,
178+
label: fileName,
179+
})
180+
console.log(`Updated ${updatedAsset.data.browser_download_url}`)
181+
}
182+
183+
await github.rest.git.updateRef({
184+
...req,
185+
ref: 'tags/ci-artifacts',
186+
sha: process.env.GITHUB_SHA,
187+
})

.github/workflows/git-artifacts.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
jobs:
2020
build:
2121
if: github.repository_owner == 'git-for-windows'
22-
runs-on: [Windows, ARM64]
22+
runs-on: windows-11-arm
2323
steps:
2424
- name: Configure user
2525
shell: bash
@@ -134,7 +134,7 @@ jobs:
134134
retention-days: 1
135135

136136
artifacts:
137-
runs-on: [Windows, ARM64]
137+
runs-on: windows-11-arm
138138
needs: [build]
139139
strategy:
140140
matrix:

.github/workflows/sync.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ env:
1717
jobs:
1818
sync:
1919
if: github.repository_owner == 'git-for-windows' || github.event.inputs.debug_with_ssh_key != ''
20-
runs-on: [Windows, ARM64]
20+
runs-on: windows-11-arm
2121
environment: sync
2222
steps:
2323
- name: clone git-sdk-arm64

0 commit comments

Comments
 (0)