Skip to content

Commit

Permalink
ci(artifact): add target for macos on apple silicon (#2163)
Browse files Browse the repository at this point in the history
This commit adds macOS target on Apple Silicon. Komodo wallet GUI has a new dependency that is incompatible with x86 architecture on macOS, breaking the current solution of building for x86 and running on Rosetta.
  • Loading branch information
CharlVS authored Jul 16, 2024
1 parent e8ab882 commit 7f56e95
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,67 @@ jobs:
if: ${{ env.FILE_SERVER_KEY != '' }}
run: python3 ./scripts/ci/upload_artifact.py "${{ env.BRANCH_NAME }}" "/uploads/${{ env.BRANCH_NAME }}"

mac-arm64:
timeout-minutes: 60
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install toolchain
run: |
rustup toolchain install nightly-2023-06-01 --no-self-update --profile=minimal
rustup default nightly-2023-06-01
rustup target add aarch64-apple-darwin
- name: Install build deps
uses: ./.github/actions/deps-install
with:
deps: ('protoc', 'python3', 'paramiko')

- name: Calculate commit hash for PR commit
if: github.event_name == 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV

- name: Calculate commit hash for merge commit
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache

- name: Build
run: |
rm -f ./MM_VERSION
echo $COMMIT_HASH > ./MM_VERSION
cargo build --release --target aarch64-apple-darwin
- name: Compress mm2 build output
env:
AVAILABLE: ${{ secrets.FILE_SERVER_KEY }}
if: ${{ env.AVAILABLE != '' }}
run: |
NAME="mm2_$COMMIT_HASH-mac-arm64.zip"
zip $NAME target/aarch64-apple-darwin/release/mm2 -j
mkdir $BRANCH_NAME
mv $NAME ./$BRANCH_NAME/
- name: Compress kdf build output
env:
AVAILABLE: ${{ secrets.FILE_SERVER_KEY }}
if: ${{ env.AVAILABLE != '' }}
run: |
NAME="kdf_$COMMIT_HASH-mac-arm64.zip"
zip $NAME target/aarch64-apple-darwin/release/kdf -j
mv $NAME ./$BRANCH_NAME/
- name: Upload build artifact
env:
FILE_SERVER_HOST: ${{ secrets.FILE_SERVER_HOST }}
FILE_SERVER_USERNAME: ${{ secrets.FILE_SERVER_USERNAME }}
FILE_SERVER_PORT: ${{ secrets.FILE_SERVER_PORT }}
FILE_SERVER_KEY: ${{ secrets.FILE_SERVER_KEY }}
if: ${{ env.FILE_SERVER_KEY != '' }}
run: python3 ./scripts/ci/upload_artifact.py "${{ env.BRANCH_NAME }}" "/uploads/${{ env.BRANCH_NAME }}"

win-x86-64:
timeout-minutes: 60
runs-on: windows-latest
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,61 @@ jobs:
if: ${{ env.FILE_SERVER_KEY != '' }}
run: python3 ./scripts/ci/upload_artifact.py "${{ env.BRANCH_NAME }}" "/uploads/${{ env.BRANCH_NAME }}"

mac-arm64:
timeout-minutes: 60
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install toolchain
run: |
rustup toolchain install nightly-2023-06-01 --no-self-update --profile=minimal
rustup default nightly-2023-06-01
rustup target add aarch64-apple-darwin
- name: Install build deps
uses: ./.github/actions/deps-install
with:
deps: ('protoc', 'python3', 'paramiko')

- name: Calculate commit hash for PR commit
if: github.event_name == 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV

- name: Calculate commit hash for merge commit
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache

- name: Build
run: |
rm -f ./MM_VERSION
echo $COMMIT_HASH > ./MM_VERSION
cargo build --release --target aarch64-apple-darwin
- name: Compress mm2 build output
run: |
NAME="mm2_$COMMIT_HASH-mac-arm64.zip"
zip $NAME target/aarch64-apple-darwin/release/mm2 -j
mkdir $BRANCH_NAME
mv $NAME ./$BRANCH_NAME/
- name: Compress kdf build output
run: |
NAME="kdf_$COMMIT_HASH-mac-arm64.zip"
zip $NAME target/aarch64-apple-darwin/release/kdf -j
mv $NAME ./$BRANCH_NAME/
- name: Upload build artifact
env:
FILE_SERVER_HOST: ${{ secrets.FILE_SERVER_HOST }}
FILE_SERVER_USERNAME: ${{ secrets.FILE_SERVER_USERNAME }}
FILE_SERVER_PORT: ${{ secrets.FILE_SERVER_PORT }}
FILE_SERVER_KEY: ${{ secrets.FILE_SERVER_KEY }}
if: ${{ env.FILE_SERVER_KEY != '' }}
run: python3 ./scripts/ci/upload_artifact.py "${{ env.BRANCH_NAME }}" "/uploads/${{ env.BRANCH_NAME }}"

win-x86-64:
timeout-minutes: 60
runs-on: windows-latest
Expand Down

0 comments on commit 7f56e95

Please sign in to comment.