name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets --all-features
test:
needs: [fmt, clippy]
strategy:
matrix:
target:
- os: ubuntu-latest
triple: x86_64-unknown-linux-gnu
profile: release
- os: macos-latest
triple: aarch64-apple-darwin
profile: release
- os: windows-latest
triple: x86_64-pc-windows-msvc
profile: debug
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target.triple }}
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ runner.os }}
- name: cargo test
run: |
if [ "${{ matrix.target.profile }}" = "release" ]; then
cargo test --release --target ${{ matrix.target.triple }}
else
cargo test --target ${{ matrix.target.triple }}
fi
shell: bash
build:
needs: [fmt, clippy]
strategy:
matrix:
target:
- os: ubuntu-latest
triple: x86_64-unknown-linux-gnu
profile: release
ext: ""
- os: macos-latest
triple: x86_64-apple-darwin
profile: release
ext: ""
- os: macos-latest
triple: aarch64-apple-darwin
profile: release
ext: ""
- os: windows-latest
triple: x86_64-pc-windows-msvc
profile: debug
ext: ".exe"
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target.triple }}
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ runner.os }}
- name: cargo build
run: |
if [ "${{ matrix.target.profile }}" = "release" ]; then
cargo build --release --target ${{ matrix.target.triple }}
else
cargo build --target ${{ matrix.target.triple }}
fi
shell: bash
- name: Upload binary
uses: actions/upload-artifact@v5
with:
name: rssume-${{ matrix.target.triple }}
path: target/${{ matrix.target.triple }}/${{ matrix.target.profile }}/rssume${{ matrix.target.ext }}