Skip to content

Commit 14ae9b1

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 <mjcheetham@outlook.com>
1 parent 743e746 commit 14ae9b1

File tree

2 files changed

+80
-34
lines changed

2 files changed

+80
-34
lines changed

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

Lines changed: 79 additions & 33 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,46 @@ 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+
mingwprefix: mingw64
173+
runner: windows-2019
174+
- name: aarch64
175+
artifact: pkg-aarch64
176+
toolchain: clang-aarch64
177+
mingwprefix: clangarm64
178+
runner: ['self-hosted', '1ES.Pool=github-arm64-pool']
179+
type:
154180
- name: installer
155181
fileprefix: Git
156182
- name: portable
157183
fileprefix: PortableGit
158-
fail-fast: false
184+
runs-on: ${{ matrix.arch.runner }}
159185
steps:
160-
- name: Download pkg-x86_64
186+
- name: Download ${{ matrix.arch.artifact }}
161187
uses: actions/download-artifact@v4
162188
with:
163-
name: pkg-x86_64
164-
path: pkg-x86_64
189+
name: ${{ matrix.arch.artifact }}
190+
path: ${{ matrix.arch.artifact }}
165191
- uses: git-for-windows/setup-git-for-windows-sdk@v1
166192
with:
167193
flavor: build-installers
194+
architecture: ${{ matrix.arch.name }}
168195
- name: Clone build-extra
169196
shell: bash
170197
run: |
@@ -194,7 +221,7 @@ jobs:
194221
EOF
195222
196223
sed -i -e '/^#include "file-list.iss"/a\
197-
Source: {#SourcePath}\\..\\git-update-git-for-windows.config; DestDir: {app}\\mingw64\\bin; Flags: replacesameversion; AfterInstall: DeleteFromVirtualStore' \
224+
Source: {#SourcePath}\\..\\git-update-git-for-windows.config; DestDir: {app}\\${{matrix.arch.mingwprefix}}\\bin; Flags: replacesameversion; AfterInstall: DeleteFromVirtualStore' \
198225
-e '/^Type: dirifempty; Name: {app}\\{#MINGW_BITNESS}$/i\
199226
Type: files; Name: {app}\\{#MINGW_BITNESS}\\bin\\git-update-git-for-windows.config\
200227
Type: dirifempty; Name: {app}\\{#MINGW_BITNESS}\\bin' \
@@ -204,15 +231,15 @@ jobs:
204231
run: |
205232
set -x
206233
207-
b=/mingw64/bin &&
234+
b=/${{matrix.arch.mingwprefix}}/bin &&
208235
209236
sed -i -e '6 a use_recently_seen=no' \
210237
$b/git-update-git-for-windows
211-
- name: Set the installer Publisher to the GitClient team
238+
- name: Set the installer Publisher to the Git Client team
212239
shell: bash
213240
run: |
214241
b=/usr/src/build-extra &&
215-
sed -i -e 's/^\(AppPublisher=\).*/\1The GitClient Team at Microsoft/' $b/installer/install.iss
242+
sed -i -e 's/^\(AppPublisher=\).*/\1The Git Client Team at Microsoft/' $b/installer/install.iss
216243
- name: Let the installer configure Visual Studio to use the installed Git
217244
shell: bash
218245
run: |
@@ -264,38 +291,38 @@ jobs:
264291
WizardSelectComponents('scalar');\n\
265292
#endif\n\
266293
end;" $b/installer/install.iss
267-
- name: Build 64-bit ${{matrix.artifact.name}}
294+
- name: Build ${{matrix.type.name}} (${{matrix.arch.name}})
268295
shell: bash
269296
run: |
270297
set -x
271298
272299
# Copy the PDB archive to the directory where `--include-pdbs` expects it
273300
b=/usr/src/build-extra &&
274301
mkdir -p $b/cached-source-packages &&
275-
cp pkg-x86_64/*-pdb* $b/cached-source-packages/ &&
302+
cp ${{matrix.arch.artifact}}/*-pdb* $b/cached-source-packages/ &&
276303
277304
# Build the installer, embedding PDBs
278305
eval $b/please.sh make_installers_from_mingw_w64_git --include-pdbs \
279306
--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 &&
307+
-o artifacts --${{matrix.type.name}} \
308+
--pkg=${{matrix.arch.artifact}}/mingw-w64-${{matrix.arch.toolchain}}-git-[0-9]*.tar.xz \
309+
--pkg=${{matrix.arch.artifact}}/mingw-w64-${{matrix.arch.toolchain}}-git-doc-html-[0-9]*.tar.xz &&
283310
284-
if test portable = '${{matrix.artifact.name}}' && test -n "$(git config alias.signtool)"
311+
if test portable = '${{matrix.type.name}}' && test -n "$(git config alias.signtool)"
285312
then
286313
git signtool artifacts/PortableGit-*.exe
287314
fi &&
288-
openssl dgst -sha256 artifacts/${{matrix.artifact.fileprefix}}-*.exe | sed "s/.* //" >artifacts/sha-256.txt
315+
openssl dgst -sha256 artifacts/${{matrix.type.fileprefix}}-*.exe | sed "s/.* //" >artifacts/sha-256.txt
289316
- name: Verify that .exe files are code-signed
290317
if: env.CODESIGN_P12 != '' && env.CODESIGN_PASS != ''
291318
shell: bash
292319
run: |
293320
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
321+
signtool verify //pa artifacts/${{matrix.type.fileprefix}}-*.exe
322+
- name: Publish ${{matrix.type.name}}-${{matrix.arch.name}}
296323
uses: actions/upload-artifact@v4
297324
with:
298-
name: win-${{matrix.artifact.name}}-x86_64
325+
name: win-${{matrix.type.name}}-${{matrix.arch.name}}
299326
path: artifacts
300327
# End build Windows installers
301328

@@ -603,6 +630,9 @@ jobs:
603630
- os: windows-latest
604631
artifact: win-installer-x86_64
605632
command: $PROGRAMFILES\Git\cmd\git.exe
633+
- os: ['self-hosted', '1ES.Pool=github-arm64-pool']
634+
artifact: win-installer-aarch64
635+
command: $PROGRAMFILES\Git\cmd\git.exe
606636
runs-on: ${{ matrix.component.os }}
607637
needs: [prereqs, windows_artifacts, create-macos-artifacts, create-linux-artifacts]
608638
steps:
@@ -612,20 +642,20 @@ jobs:
612642
name: ${{ matrix.component.artifact }}
613643

614644
- name: Install Windows
615-
if: contains(matrix.component.os, 'windows')
645+
if: contains(matrix.component.artifact, 'win-installer')
616646
shell: pwsh
617647
run: |
618648
$exePath = Get-ChildItem -Path ./*.exe | %{$_.FullName}
619649
Start-Process -Wait -FilePath "$exePath" -ArgumentList "/SILENT /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /ALLOWDOWNGRADE=1"
620650
621651
- name: Install Linux
622-
if: contains(matrix.component.os, 'ubuntu')
652+
if: contains(matrix.component.artifact, 'linux')
623653
run: |
624654
debpath=$(find ./*.deb)
625655
sudo apt install $debpath
626656
627657
- name: Install macOS
628-
if: contains(matrix.component.os, 'macos')
658+
if: contains(matrix.component.artifact, 'macos')
629659
run: |
630660
# avoid letting Homebrew's `git` in `/opt/homebrew/bin` override `/usr/local/bin/git`
631661
arch="$(uname -m)"
@@ -673,18 +703,30 @@ jobs:
673703
needs.create-macos-artifacts.result == 'success' &&
674704
needs.windows_artifacts.result == 'success')
675705
steps:
676-
- name: Download Windows portable installer
706+
- name: Download Windows portable (x86_64)
677707
uses: actions/download-artifact@v4
678708
with:
679709
name: win-portable-x86_64
680710
path: win-portable-x86_64
681711

682-
- name: Download Windows x86_64 installer
712+
- name: Download Windows portable (aarch64)
713+
uses: actions/download-artifact@v4
714+
with:
715+
name: win-portable-aarch64
716+
path: win-portable-aarch64
717+
718+
- name: Download Windows installer (x86_64)
683719
uses: actions/download-artifact@v4
684720
with:
685721
name: win-installer-x86_64
686722
path: win-installer-x86_64
687723

724+
- name: Download Windows installer (aarch64)
725+
uses: actions/download-artifact@v4
726+
with:
727+
name: win-installer-aarch64
728+
path: win-installer-aarch64
729+
688730
- name: Download macOS artifacts
689731
uses: actions/download-artifact@v4
690732
with:
@@ -754,10 +796,14 @@ jobs:
754796
}
755797
756798
await Promise.all([
757-
// Upload Windows artifacts
799+
// Upload Windows x86_64 artifacts
758800
uploadDirectoryToRelease('win-installer-x86_64', ['.exe']),
759801
uploadDirectoryToRelease('win-portable-x86_64', ['.exe']),
760802
803+
// Upload Windows aarch64 artifacts
804+
uploadDirectoryToRelease('win-installer-aarch64', ['.exe']),
805+
uploadDirectoryToRelease('win-portable-aarch64', ['.exe']),
806+
761807
// Upload Mac artifacts
762808
uploadDirectoryToRelease('macos-artifacts'),
763809

.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)