Skip to content

Migrate to cargo workspaces and introduce github workflows #1

Migrate to cargo workspaces and introduce github workflows

Migrate to cargo workspaces and introduce github workflows #1

Workflow file for this run

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, windows-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
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests
run: cargo test --all-features --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
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact_name: lla-linux-arm64
- os: ubuntu-latest
target: i686-unknown-linux-gnu
artifact_name: lla-linux-i686
# 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
# Windows builds
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: lla-windows-amd64.exe
- os: windows-latest
target: i686-pc-windows-msvc
artifact_name: lla-windows-i686.exe
- os: windows-latest
target: aarch64-pc-windows-msvc
artifact_name: lla-windows-arm64.exe
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: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu gcc-i686-linux-gnu
- 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 (Windows)
if: runner.os == 'Windows'
run: |
cp target/${{ matrix.target }}/release/lla.exe ${{ matrix.artifact_name }}
- 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 }}