chore: update release workflow to install nFPM via APT #119
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: CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
name: Test Suite | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
rust: [1.71.0] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
components: rustfmt, clippy | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Check formatting | |
run: cargo fmt --all -- --check | |
- name: Clippy | |
continue-on-error: true | |
run: cargo clippy --all-targets --all-features | |
- name: Run tests | |
run: cargo test --workspace | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
# Linux builds | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
artifact_name: lla-linux-amd64 | |
pkg_formats: "deb,rpm,apk,pacman" | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
artifact_name: lla-linux-arm64 | |
cross_compile: true | |
pkg_formats: "deb,rpm,apk,pacman" | |
- os: ubuntu-latest | |
target: i686-unknown-linux-gnu | |
artifact_name: lla-linux-i686 | |
cross_compile: true | |
pkg_formats: "deb,rpm,apk,pacman" | |
# macOS builds | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
artifact_name: lla-macos-amd64 | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
artifact_name: lla-macos-arm64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: 1.71.0 | |
targets: ${{ matrix.target }} | |
- name: Install cross-compilation tools | |
if: matrix.cross_compile && runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-aarch64-linux-gnu gcc-i686-linux-gnu | |
sudo apt-get install -y crossbuild-essential-arm64 crossbuild-essential-i386 | |
- name: Set cross-compilation environment | |
if: matrix.cross_compile && runner.os == 'Linux' | |
run: | | |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
echo "CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER=i686-linux-gnu-gcc" >> $GITHUB_ENV | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.target }} | |
- name: Build release | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Prepare binary (Unix) | |
if: runner.os != 'Windows' | |
run: | | |
cp target/${{ matrix.target }}/release/lla ${{ matrix.artifact_name }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.artifact_name }} | |
path: ${{ matrix.artifact_name }} |