Skip to content
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

Add Apple Silicon (M1) binary to releases #88

Merged
merged 2 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
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
24 changes: 24 additions & 0 deletions .github/workflows/build-m1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build M1

on: workflow_dispatch

jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: aarch64-apple-darwin
default: true
- name: Fetch dependencies
run: cargo fetch
- name: Build in release mode
run: |
SDKROOT=$(xcrun -sdk macosx --show-sdk-path)
MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)
cargo build --release --frozen --target aarch64-apple-darwin
- name: list file
run: ls -al ./target/aarch64-apple-darwin/release/
10 changes: 3 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ jobs:
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout master
uses: actions/checkout@master
- uses: actions/checkout@v2
- name: Fetch dependencies
run: cargo fetch
- name: Build in release mode
Expand All @@ -28,8 +27,7 @@ jobs:
env:
CLICOLOR_FORCE: 1
steps:
- name: Checkout master
uses: actions/checkout@master
- uses: actions/checkout@v2
- name: Add Ruby for a test that requires it
uses: actions/setup-ruby@master
with:
Expand All @@ -48,10 +46,8 @@ jobs:
run: cargo test --frozen

format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@master
- uses: actions/checkout@v2
- name: Verify formatting is correct
run: cargo fmt --all -- --check
49 changes: 42 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ on:

jobs:
release-linux:
name: Build and attach linux binary
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@master
- uses: actions/checkout@v2
- name: Fetch dependencies
run: cargo fetch
- name: Build in release mode
Expand All @@ -31,12 +29,43 @@ jobs:
with:
assets: ./*.zip

release-macos:
name: Build and attach macOS binary
release-macos-aarch64:
runs-on: macos-latest
steps:
- name: Checkout master
uses: actions/checkout@master
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: aarch64-apple-darwin
default: true
- name: Fetch dependencies
run: cargo fetch
- name: Build in release mode
run: |
SDKROOT=$(xcrun -sdk macosx --show-sdk-path)
MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)
cargo build --release --frozen --target aarch64-apple-darwin
- name: Add the version tag to the binary name
run: |
VERSION_TAG=$(jq --raw-output '.release.tag_name' "$GITHUB_EVENT_PATH")
TARGET=aarch64-apple-darwin
NAME=mask-$VERSION_TAG-$TARGET
mkdir $NAME
mv ./target/$TARGET/release/mask ./$NAME/mask
chmod +x ./$NAME/mask
zip -r $NAME.zip $NAME
# NOTE: cannot use the attach-release-assets action because macOS doesn't support docker-based actions.
# Luckily we can just run the bash script directly.
- name: Attach the binary to the release
run: ./.github/actions/attach-release-assets/run.sh ./*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release-macos-x86-64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -62,10 +91,16 @@ jobs:
run: ./.github/actions/attach-release-assets/run.sh ./*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release-homebrew:
needs: release-macos-x86-64
runs-on: ubuntu-latest
steps:
- name: Bump homebrew-core formula
uses: mislav/bump-homebrew-formula-action@v1
if: "!contains(github.ref, '-')" # skip prereleases
env:
COMMITTER_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
with:
# Sends a PR to homebrew-core to update the formula
formula-name: mask