Skip to content

Commit 32bb57c

Browse files
committed
aarch64: add support for Windows on ARM
Add support for building Microsoft Git on Windows/ARM64. We use a custom 1ES pool that we maintain to provide ARM64 GitHub runners that have the latest Git for Windows ARM64 installed. Signed-off-by: Matthew John Cheetham <[email protected]>
1 parent 743e746 commit 32bb57c

File tree

2 files changed

+76
-32
lines changed

2 files changed

+76
-32
lines changed

.github/workflows/build-git-installers.yml

Lines changed: 75 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,25 @@ jobs:
5050
test "${{ steps.tag.outputs.version }}" == "$(sed -n 's/^GIT_VERSION = //p'< GIT-VERSION-FILE)" || die "GIT-VERSION-FILE tag does not match ${{ steps.tag.outputs.name }}"
5151
# End check prerequisites for the workflow
5252

53-
# Build Windows installers (x86_64 installer & portable)
53+
# Build Windows installers (x86_64 & aarch64; installer & portable)
5454
windows_pkg:
55-
runs-on: windows-2019
5655
environment: release
5756
needs: prereqs
57+
strategy:
58+
fail-fast: false
59+
matrix:
60+
arch:
61+
- name: x86_64
62+
artifact: pkg-x86_64
63+
toolchain: x86_64
64+
mingwprefix: /mingw64
65+
runner: windows-2019
66+
- name: aarch64
67+
artifact: pkg-aarch64
68+
toolchain: clang-aarch64
69+
mingwprefix: /clangarm64
70+
runner: ['self-hosted', '1ES.Pool=github-arm64-pool']
71+
runs-on: ${{ matrix.arch.runner }}
5872
env:
5973
GPG_OPTIONS: "--batch --yes --no-tty --list-options no-show-photos --verify-options no-show-photos --pinentry-mode loopback"
6074
HOME: "${{github.workspace}}\\home"
@@ -72,6 +86,7 @@ jobs:
7286
- uses: git-for-windows/setup-git-for-windows-sdk@v1
7387
with:
7488
flavor: build-installers
89+
architecture: ${{ matrix.arch.name }}
7590
- name: Clone build-extra
7691
shell: bash
7792
run: |
@@ -112,17 +127,17 @@ jobs:
112127
git config --global user.email "<${info#*<}"
113128
env:
114129
GPGKEY: ${{secrets.GPGKEY}}
115-
- name: Build mingw-w64-x86_64-git
130+
- name: Build mingw-w64-${{matrix.arch.toolchain}}-git
116131
env:
117132
GPGKEY: "${{secrets.GPGKEY}}"
118133
shell: bash
119134
run: |
120135
set -x
121136
122137
# Make sure that there is a `/usr/bin/git` that can be used by `makepkg-mingw`
123-
printf '#!/bin/sh\n\nexec /mingw64/bin/git.exe "$@"\n' >/usr/bin/git &&
138+
printf '#!/bin/sh\n\nexec ${{matrix.arch.mingwprefix}}/bin/git.exe "$@"\n' >/usr/bin/git &&
124139
125-
sh -x /usr/src/build-extra/please.sh build-mingw-w64-git --only-64-bit --build-src-pkg -o artifacts HEAD &&
140+
sh -x /usr/src/build-extra/please.sh build-mingw-w64-git --only-${{matrix.arch.name}} --build-src-pkg -o artifacts HEAD &&
126141
if test -n "$GPGKEY"
127142
then
128143
for tar in artifacts/*.tar*
@@ -137,34 +152,44 @@ jobs:
137152
cp PKGBUILD.$version PKGBUILD &&
138153
git commit -s -m "mingw-w64-git: new version ($version)" PKGBUILD &&
139154
git bundle create "$b"/MINGW-packages.bundle origin/main..main)
140-
- name: Publish mingw-w64-x86_64-git
155+
- name: Publish mingw-w64-${{matrix.arch.toolchain}}-git
141156
uses: actions/upload-artifact@v4
142157
with:
143-
name: pkg-x86_64
158+
name: "${{ matrix.arch.artifact }}"
144159
path: artifacts
145160
windows_artifacts:
146-
runs-on: windows-2019
147161
environment: release
148162
needs: [prereqs, windows_pkg]
149163
env:
150164
HOME: "${{github.workspace}}\\home"
151165
strategy:
166+
fail-fast: false
152167
matrix:
153-
artifact:
168+
arch:
169+
- name: x86_64
170+
artifact: pkg-x86_64
171+
toolchain: x86_64
172+
runner: windows-2019
173+
- name: aarch64
174+
artifact: pkg-aarch64
175+
toolchain: clang-aarch64
176+
runner: ['self-hosted', '1ES.Pool=github-arm64-pool']
177+
type:
154178
- name: installer
155179
fileprefix: Git
156180
- name: portable
157181
fileprefix: PortableGit
158-
fail-fast: false
182+
runs-on: ${{ matrix.arch.runner }}
159183
steps:
160-
- name: Download pkg-x86_64
184+
- name: Download ${{ matrix.arch.artifact }}
161185
uses: actions/download-artifact@v4
162186
with:
163-
name: pkg-x86_64
164-
path: pkg-x86_64
187+
name: ${{ matrix.arch.artifact }}
188+
path: ${{ matrix.arch.artifact }}
165189
- uses: git-for-windows/setup-git-for-windows-sdk@v1
166190
with:
167191
flavor: build-installers
192+
architecture: ${{ matrix.arch.name }}
168193
- name: Clone build-extra
169194
shell: bash
170195
run: |
@@ -208,11 +233,11 @@ jobs:
208233
209234
sed -i -e '6 a use_recently_seen=no' \
210235
$b/git-update-git-for-windows
211-
- name: Set the installer Publisher to the GitClient team
236+
- name: Set the installer Publisher to the Git Client team
212237
shell: bash
213238
run: |
214239
b=/usr/src/build-extra &&
215-
sed -i -e 's/^\(AppPublisher=\).*/\1The GitClient Team at Microsoft/' $b/installer/install.iss
240+
sed -i -e 's/^\(AppPublisher=\).*/\1The Git Client Team at Microsoft/' $b/installer/install.iss
216241
- name: Let the installer configure Visual Studio to use the installed Git
217242
shell: bash
218243
run: |
@@ -264,38 +289,38 @@ jobs:
264289
WizardSelectComponents('scalar');\n\
265290
#endif\n\
266291
end;" $b/installer/install.iss
267-
- name: Build 64-bit ${{matrix.artifact.name}}
292+
- name: Build ${{matrix.type.name}} (${{matrix.arch.name}})
268293
shell: bash
269294
run: |
270295
set -x
271296
272297
# Copy the PDB archive to the directory where `--include-pdbs` expects it
273298
b=/usr/src/build-extra &&
274299
mkdir -p $b/cached-source-packages &&
275-
cp pkg-x86_64/*-pdb* $b/cached-source-packages/ &&
300+
cp ${{matrix.arch.artifact}}/*-pdb* $b/cached-source-packages/ &&
276301
277302
# Build the installer, embedding PDBs
278303
eval $b/please.sh make_installers_from_mingw_w64_git --include-pdbs \
279304
--version=${{ needs.prereqs.outputs.tag_version }} \
280-
-o artifacts --${{matrix.artifact.name}} \
281-
--pkg=pkg-x86_64/mingw-w64-x86_64-git-[0-9]*.tar.xz \
282-
--pkg=pkg-x86_64/mingw-w64-x86_64-git-doc-html-[0-9]*.tar.xz &&
305+
-o artifacts --${{matrix.type.name}} \
306+
--pkg=${{matrix.arch.artifact}}/mingw-w64-${{matrix.arch.toolchain}}-git-[0-9]*.tar.xz \
307+
--pkg=${{matrix.arch.artifact}}/mingw-w64-${{matrix.arch.toolchain}}-git-doc-html-[0-9]*.tar.xz &&
283308
284-
if test portable = '${{matrix.artifact.name}}' && test -n "$(git config alias.signtool)"
309+
if test portable = '${{matrix.type.name}}' && test -n "$(git config alias.signtool)"
285310
then
286311
git signtool artifacts/PortableGit-*.exe
287312
fi &&
288-
openssl dgst -sha256 artifacts/${{matrix.artifact.fileprefix}}-*.exe | sed "s/.* //" >artifacts/sha-256.txt
313+
openssl dgst -sha256 artifacts/${{matrix.type.fileprefix}}-*.exe | sed "s/.* //" >artifacts/sha-256.txt
289314
- name: Verify that .exe files are code-signed
290315
if: env.CODESIGN_P12 != '' && env.CODESIGN_PASS != ''
291316
shell: bash
292317
run: |
293318
PATH=$PATH:"/c/Program Files (x86)/Windows Kits/10/App Certification Kit/" \
294-
signtool verify //pa artifacts/${{matrix.artifact.fileprefix}}-*.exe
295-
- name: Publish ${{matrix.artifact.name}}-x86_64
319+
signtool verify //pa artifacts/${{matrix.type.fileprefix}}-*.exe
320+
- name: Publish ${{matrix.type.name}}-${{matrix.arch.name}}
296321
uses: actions/upload-artifact@v4
297322
with:
298-
name: win-${{matrix.artifact.name}}-x86_64
323+
name: win-${{matrix.type.name}}-${{matrix.arch.name}}
299324
path: artifacts
300325
# End build Windows installers
301326

@@ -603,6 +628,9 @@ jobs:
603628
- os: windows-latest
604629
artifact: win-installer-x86_64
605630
command: $PROGRAMFILES\Git\cmd\git.exe
631+
- os: ['self-hosted', '1ES.Pool=github-arm64-pool']
632+
artifact: win-installer-aarch64
633+
command: $PROGRAMFILES\Git\cmd\git.exe
606634
runs-on: ${{ matrix.component.os }}
607635
needs: [prereqs, windows_artifacts, create-macos-artifacts, create-linux-artifacts]
608636
steps:
@@ -612,20 +640,20 @@ jobs:
612640
name: ${{ matrix.component.artifact }}
613641

614642
- name: Install Windows
615-
if: contains(matrix.component.os, 'windows')
643+
if: contains(matrix.component.artifact, 'win-installer')
616644
shell: pwsh
617645
run: |
618646
$exePath = Get-ChildItem -Path ./*.exe | %{$_.FullName}
619647
Start-Process -Wait -FilePath "$exePath" -ArgumentList "/SILENT /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /ALLOWDOWNGRADE=1"
620648
621649
- name: Install Linux
622-
if: contains(matrix.component.os, 'ubuntu')
650+
if: contains(matrix.component.artifact, 'linux')
623651
run: |
624652
debpath=$(find ./*.deb)
625653
sudo apt install $debpath
626654
627655
- name: Install macOS
628-
if: contains(matrix.component.os, 'macos')
656+
if: contains(matrix.component.artifact, 'macos')
629657
run: |
630658
# avoid letting Homebrew's `git` in `/opt/homebrew/bin` override `/usr/local/bin/git`
631659
arch="$(uname -m)"
@@ -673,18 +701,30 @@ jobs:
673701
needs.create-macos-artifacts.result == 'success' &&
674702
needs.windows_artifacts.result == 'success')
675703
steps:
676-
- name: Download Windows portable installer
704+
- name: Download Windows portable (x86_64)
677705
uses: actions/download-artifact@v4
678706
with:
679707
name: win-portable-x86_64
680708
path: win-portable-x86_64
681709

682-
- name: Download Windows x86_64 installer
710+
- name: Download Windows portable (aarch64)
711+
uses: actions/download-artifact@v4
712+
with:
713+
name: win-portable-aarch64
714+
path: win-portable-aarch64
715+
716+
- name: Download Windows installer (x86_64)
683717
uses: actions/download-artifact@v4
684718
with:
685719
name: win-installer-x86_64
686720
path: win-installer-x86_64
687721

722+
- name: Download Windows installer (aarch64)
723+
uses: actions/download-artifact@v4
724+
with:
725+
name: win-installer-aarch64
726+
path: win-installer-aarch64
727+
688728
- name: Download macOS artifacts
689729
uses: actions/download-artifact@v4
690730
with:
@@ -754,10 +794,14 @@ jobs:
754794
}
755795
756796
await Promise.all([
757-
// Upload Windows artifacts
797+
// Upload Windows x86_64 artifacts
758798
uploadDirectoryToRelease('win-installer-x86_64', ['.exe']),
759799
uploadDirectoryToRelease('win-portable-x86_64', ['.exe']),
760800
801+
// Upload Windows aarch64 artifacts
802+
uploadDirectoryToRelease('win-installer-aarch64', ['.exe']),
803+
uploadDirectoryToRelease('win-portable-aarch64', ['.exe']),
804+
761805
// Upload Mac artifacts
762806
uploadDirectoryToRelease('macos-artifacts'),
763807

.github/workflows/clangarm64-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ defaults:
99

1010
jobs:
1111
clang-build:
12-
runs-on: [Windows, ARM64]
12+
runs-on: ['self-hosted', '1ES.Pool=github-arm64-pool']
1313
env:
1414
NO_PERL: 1
1515
steps:

0 commit comments

Comments
 (0)