Skip to content

Commit

Permalink
[CI] Build for macOS ARM64 (#163)
Browse files Browse the repository at this point in the history
* [CI] Build for macOS ARM64

* Use macos-14 runner

* Build AMD64 on macos-12 and ARM64 on macos-14
  • Loading branch information
iamazeem authored Mar 19, 2024
1 parent f9a46ec commit 9135bba
Showing 1 changed file with 45 additions and 12 deletions.
57 changes: 45 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ name: ci
on:
push:
branches: [main]
paths-ignore:
- "**.md"
paths-ignore: ['**.md']
pull_request:
branches: [main]
paths-ignore:
- "**.md"
paths-ignore: ['**.md']
release:
types: [published]

Expand All @@ -17,7 +15,7 @@ jobs:
name: ci
strategy:
matrix:
os: [ubuntu-20.04, macos-12]
os: [ubuntu-20.04, macos-12, macos-14]

runs-on: ${{ matrix.os }}

Expand All @@ -27,6 +25,7 @@ jobs:
AMD64_LINUX_CLANG: amd64-linux-clang
AMD64_WINDOWS_MINGW: amd64-windows-mingw
AMD64_MACOSX_GCC: amd64-macosx-gcc
ARM64_MACOSX_GCC: arm64-macosx-gcc
AMD64_FREEBSD_GCC: amd64-freebsd-gcc
ARTIFACT_DIR: .artifacts
ARTIFACT_RETENTION_DAYS: 5
Expand All @@ -36,13 +35,13 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
TAG=$(echo $GITHUB_REF | cut -d '/' -f3)
TAG="$GITHUB_REF_NAME"
echo "TAG: $TAG"
if [[ $TAG == "v"* ]]; then
TAG="${TAG:1}"
fi
echo "TAG: $TAG"
echo "TAG=$TAG" >> $GITHUB_ENV
echo "TAG=$TAG" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -54,7 +53,7 @@ jobs:
sudo apt install -y mingw-w64 rpm alien nuget
sudo apt remove -y jq
- name: Set up macOS
- name: Set up macOS (AMD64 and ARM64)
if: runner.os == 'macOS'
run: |
brew install coreutils tree autoconf automake libtool
Expand Down Expand Up @@ -125,7 +124,7 @@ jobs:
./scripts/ci-create-nuget-package.sh
- name: Build on macOS (${{ env.AMD64_MACOSX_GCC }})
if: runner.os == 'macOS'
if: matrix.os == 'macos-12'
env:
PREFIX: ${{ env.AMD64_MACOSX_GCC }}
CC: gcc-11
Expand All @@ -136,6 +135,18 @@ jobs:
./scripts/ci-build.sh
./$PREFIX/bin/zsv version
- name: Build on macOS (${{ env.ARM64_MACOSX_GCC }})
if: matrix.os == 'macos-14'
env:
PREFIX: ${{ env.ARM64_MACOSX_GCC }}
CC: gcc-11
MAKE: make
RUN_TESTS: false
shell: bash
run: |
./scripts/ci-build.sh
./$PREFIX/bin/zsv version
# --- Upload build artifacts ---

- name: Prepare build artifacts for upload
Expand Down Expand Up @@ -230,7 +241,7 @@ jobs:
if-no-files-found: error

- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_MACOSX_GCC }}.zip)
if: runner.os == 'macOS'
if: matrix.os == 'macos-12'
uses: actions/upload-artifact@v4
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_MACOSX_GCC }}.zip
Expand All @@ -240,6 +251,17 @@ jobs:
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error

- name: Upload (zsv-${{ env.TAG }}-${{ env.ARM64_MACOSX_GCC }}.zip)
if: matrix.os == 'macos-14'
uses: actions/upload-artifact@v4
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.ARM64_MACOSX_GCC }}.zip
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error

- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_FREEBSD_GCC }}.zip)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -285,7 +307,7 @@ jobs:
if-no-files-found: error

- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_MACOSX_GCC }}.tar.gz)
if: runner.os == 'macOS'
if: matrix.os == 'macos-12'
uses: actions/upload-artifact@v4
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_MACOSX_GCC }}.tar.gz
Expand All @@ -295,6 +317,17 @@ jobs:
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error

- name: Upload (zsv-${{ env.TAG }}-${{ env.ARM64_MACOSX_GCC }}.tar.gz)
if: matrix.os == 'macos-14'
uses: actions/upload-artifact@v4
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.ARM64_MACOSX_GCC }}.tar.gz
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error

- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_FREEBSD_GCC }}.tar.gz)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -322,7 +355,7 @@ jobs:
# --- Update homebrew tap ---

- name: Update homebrew tap (liquidaty/homebrew-zsv)
if: ${{ startsWith(github.ref, 'refs/tags/v') && runner.os == 'macOS' }}
if: ${{ startsWith(github.ref, 'refs/tags/v') && matrix.os == 'macos-12' }}
env:
HOMEBREW_TAP_DEPLOY_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
TAG: ${{ env.TAG }}
Expand Down

0 comments on commit 9135bba

Please sign in to comment.