separate native / cross compile toolchains #9
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 Release binaries | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
- os: windows-latest | |
target: x86_64-pc-windows-gnu | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
default: true | |
- name: Cargo Clean | |
run: cargo clean | |
- name: Install dependencies for cross-compilation | |
if: matrix.target == 'aarch64-unknown-linux-gnu' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-aarch64-linux-gnu | |
- name: Build (Cross-Compile) | |
if: matrix.target == 'aarch64-unknown-linux-gnu' | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
command: build | |
args: --release --target ${{ matrix.target }} -vv | |
- name: Build (Native Toolchain) | |
if: matrix.target != 'aarch64-unknown-linux-gnu' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --target ${{ matrix.target }} -vv | |
- name: Upload Release Asset | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mosaic-${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/mosaic${{ matrix.target == 'x86_64-pc-windows-gnu' && '.exe' || '' }} |