Skip to content

build-and-deploy: add support for arm64 builds #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
description: 'The ref containing the package definition'
required: true
architecture:
description: 'The architecture to build for (only for MSYS packages)'
description: 'The architecture to build for (only for MSYS packages and all arm64 builds)'
required: false
actor:
description: The GitHub user on whose behalf this workflow is run
Expand All @@ -37,7 +37,7 @@ env:

jobs:
build:
runs-on: windows-latest
runs-on: ${{ github.event.inputs.architecture == 'aarch64' && fromJSON('["Windows", "ARM64"]') || 'windows-latest' }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't use env.ARCHITECTURE here so had to resort to github.event.inputs.architecture.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, the environment requires the runner to already run, and that requires runs-on to be specified ;-)

steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -135,6 +135,8 @@ jobs:
flavor: ${{ env.PACKAGE_TO_BUILD == 'mingw-w64-git' && 'build-installers' || 'full' }}
architecture: ${{ env.ARCHITECTURE || 'x86_64' }}
msys: ${{ env.REPO == 'MSYS2-packages' || env.PACKAGE_TO_BUILD == 'git-for-windows-keyring' }}
# We only have to clean up on self-hosted runners
cleanup: ${{ runner.arch == 'ARM64' && true || false }}

- name: Clone ${{ env.REPO }}
shell: bash
Expand Down Expand Up @@ -209,8 +211,10 @@ jobs:
printf '#!/bin/sh\n\nexec /mingw64/bin/git.exe "$@"\n' >/usr/bin/git
} &&
MINGW_ARCHS_TO_BUILD=$(test "$ARCHITECTURE" == "aarch64" && echo "clangarm64" || echo "mingw32 mingw64")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dennisameling I hope you don't mind that I edited this: We can either use a Bash-style ternary (with $ARCHITECTURE) or use GitHub workflow syntax (${{ env.ARCHITECTURE == 'aarch64' && 'clangarm64' || 'mingw32 mingw64' }}), but we should not mix them. I opted for the former.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me! 👍🏼

cd "/usr/src/$REPO/$PACKAGE_TO_BUILD" &&
MAKEFLAGS=-j6 PKGEXT='.pkg.tar.xz' MINGW_ARCH="mingw32 mingw64" $MAKEPKG -s --noconfirm &&
MAKEFLAGS=-j6 PKGEXT='.pkg.tar.xz' MINGW_ARCH=$MINGW_ARCHS_TO_BUILD $MAKEPKG -s --noconfirm &&
cp *.pkg.tar* "$dir/" &&
MAKEFLAGS=-j6 SRCEXT='.src.tar.gz' MINGW_ARCH=mingw64 $MAKEPKG --allsource &&
Expand Down