name: Build (Reusable)
on:
workflow_call:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-latest
target: aarch64-pc-windows-msvc
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix.target }}
profile: minimal
- name: Install dependencies on Linux
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y libasound2-dev
- name: Install dependencies
run: cargo fetch
- name: Build binary
run: cargo build --release --target ${{ matrix.target }}
- name: Create zip archive on Linux or macOS
if: matrix.os != 'windows-latest'
run: zip -j fbdplay-${{ matrix.target }}.zip target/${{ matrix.target }}/release/fbdplay
- name: Create zip archive on Windows
if: matrix.os == 'windows-latest'
run: |
powershell Compress-Archive -Path target/${{ matrix.target }}/release/fbdplay.exe -DestinationPath fbdplay-${{ matrix.target }}.zip
- name: Upload production artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-binary-zip
path: fbdplay-${{ matrix.target }}.zip