Add cross-compilation setup to deployment workflow #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Precompile Binaries | |
on: | |
push: | |
branches: | |
- main | |
- oleander-patch-1 | |
concurrency: | |
group: deploy-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu] | |
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: Set up cross-compilation environment | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y pkg-config-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 | |
- name: Build for ${{ matrix.target }} | |
run: | | |
rustup target add ${{ matrix.target }} | |
cargo build --release --target ${{ matrix.target }} | |
- name: Install dependencies | |
run: sudo apt-get install -y musl-tools | |
- name: Install cargo-binstall | |
run: cargo install cargo-binstall | |
- name: Build for ${{ matrix.target }} | |
run: | | |
rustup target add ${{ matrix.target }} | |
cargo build --release --target ${{ matrix.target }} | |
- name: Upload binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/ |