Skip to content

Commit

Permalink
Refactor deploy workflow to separate x86 and arm builds
Browse files Browse the repository at this point in the history
  • Loading branch information
oleander committed Nov 16, 2024
1 parent 2b6f73d commit 8cbb8e7
Showing 1 changed file with 30 additions and 17 deletions.
47 changes: 30 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ concurrency:
cancel-in-progress: true

jobs:
build:
build-x86:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu]
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -27,27 +24,43 @@ jobs:
override: true
components: rustfmt, clippy

- name: Set up cross-compilation environment
- name: Build for x86_64-unknown-linux-gnu
run: |
sudo dpkg --add-architecture arm64
sudo apt-get update
sudo apt-get install -y pkg-config gcc-aarch64-linux-gnu
echo 'export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig' >> $GITHUB_ENV
echo 'export PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu' >> $GITHUB_ENV
rustup target add x86_64-unknown-linux-gnu
cargo build --release --target x86_64-unknown-linux-gnu
- name: Install dependencies
run: sudo apt-get install -y musl-tools
- name: Install cargo-binstall
run: cargo install cargo-binstall

- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: binaries-x86_64
path: target/x86_64-unknown-linux-gnu/release/

build-arm:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy

- name: Build for ${{ matrix.target }}
- name: Build for aarch64-apple-darwin
run: |
rustup target add ${{ matrix.target }}
cargo build --release --target ${{ matrix.target }}
rustup target add aarch64-apple-darwin
cargo build --release --target aarch64-apple-darwin
- name: Install cargo-binstall
run: cargo install cargo-binstall

- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.target }}
path: target/${{ matrix.target }}/release/
name: binaries-arm
path: target/aarch64-apple-darwin/release/

0 comments on commit 8cbb8e7

Please sign in to comment.