From f75d5dba84173e060ed902358ba7b378fc62fc02 Mon Sep 17 00:00:00 2001 From: iTrooz Date: Thu, 16 Nov 2023 22:31:46 +0100 Subject: [PATCH] git: Add MacOS M1 GitHub Action (#1425) I said I'll do it in #1414 Warning: the output zip does not pass SIP (System Integrity Protection), and I have no plan to do it for now. So if someone here has a Mac, feel free to to try to fix the problem (which is probably our build system) Link #1109 --------- Co-authored-by: Nik --- .github/workflows/build.yml | 40 ++++++++++++++++++ dist/macOS/arm64.Dockerfile | 54 ++++++++++++------------ dist/macOS/arm64.crosscompile.Dockerfile | 2 +- 3 files changed, 69 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f6fb7684..c5d479018 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -238,6 +238,46 @@ jobs: name: macOS DMG${{matrix.suffix}} x86_64 path: build/*.dmg + macos-arm64: + runs-on: ubuntu-22.04 + name: 🍎 macOS 12.1 arm64 + steps: + - name: 🧰 Checkout + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: 📁 Restore docker /cache + uses: actions/cache@v3 + with: + path: cache + key: build-macos-arm64-cache + + - name: 🐳 Inject /cache into docker + uses: reproducible-containers/buildkit-cache-dance@v2.1.2 # Doesn't work with a MacOS runner ? + with: + cache-source: cache + cache-target: /cache + + - name: 🛠️ Build using docker + run: | + docker buildx build . -f dist/macOS/arm64.Dockerfile --progress=plain --build-arg 'JOBS=4' --build-arg "BUILD_TYPE=$(BUILD_TYPE)" --build-context imhex=$(pwd) --output out + + - name: ⬆️ Upload artifacts + uses: actions/upload-pages-artifact@v2 + with: + name: macOS ZIP arm64 + path: out/ + + # See https://github.com/actions/cache/issues/342#issuecomment-1711054115 + - name: 🗑️ Delete old cache + continue-on-error: true + env: + GH_TOKEN: ${{ github.token }} + run: | + gh extension install actions/gh-actions-cache + gh actions-cache delete "build-macos-arm64-cache" --confirm + # Ubuntu build ubuntu: strategy: diff --git a/dist/macOS/arm64.Dockerfile b/dist/macOS/arm64.Dockerfile index bd80ad8eb..e3d4ce2e2 100644 --- a/dist/macOS/arm64.Dockerfile +++ b/dist/macOS/arm64.Dockerfile @@ -1,5 +1,5 @@ -# see arm64.crosscompile.Dockerfile -FROM crosscompile as build +# This base image is also known as "crosscompile". See arm64.crosscompile.Dockerfile +FROM ghcr.io/itrooz/macos-crosscompile:clang17-nosdk as build ENV MACOSX_DEPLOYMENT_TARGET 12.1 @@ -22,8 +22,16 @@ if [ "$CUSTOM_GLFW" ]; then fi EOF -## Assume the SDK has been removed from the image, and copy it again -COPY SDK /osxcross/target/SDK +RUN --mount=type=cache,target=/cache <