name: CI
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Install system dependencies
run: sudo apt-get install -y libclang-dev
- name: Cache cargo registry and build artifacts
uses: Swatinem/rust-cache@v2
- name: Lint
run: cargo clippy --all-targets -- -D warnings
env:
ONDE_APP_ID: ${{ secrets.ONDE_APP_ID }}
ONDE_APP_SECRET: ${{ secrets.ONDE_APP_SECRET }}
GRESIQ_API_KEY: ${{ secrets.GRESIQ_API_KEY }}
GRESIQ_API_SECRET: ${{ secrets.GRESIQ_API_SECRET }}
HF_TOKEN: ${{ secrets.HF_TOKEN }}
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install system dependencies
run: sudo apt-get install -y libclang-dev
- name: Cache cargo registry and build artifacts
uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo test --locked --verbose
env:
ONDE_APP_ID: ${{ secrets.ONDE_APP_ID }}
ONDE_APP_SECRET: ${{ secrets.ONDE_APP_SECRET }}
GRESIQ_API_KEY: ${{ secrets.GRESIQ_API_KEY }}
GRESIQ_API_SECRET: ${{ secrets.GRESIQ_API_SECRET }}
HF_TOKEN: ${{ secrets.HF_TOKEN }}
check:
name: Cargo check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install system dependencies
run: sudo apt-get install -y libclang-dev
- name: Cache cargo registry and build artifacts
uses: Swatinem/rust-cache@v2
- name: Cargo check
run: cargo check --locked
env:
ONDE_APP_ID: ${{ secrets.ONDE_APP_ID }}
ONDE_APP_SECRET: ${{ secrets.ONDE_APP_SECRET }}
GRESIQ_API_KEY: ${{ secrets.GRESIQ_API_KEY }}
GRESIQ_API_SECRET: ${{ secrets.GRESIQ_API_SECRET }}
HF_TOKEN: ${{ secrets.HF_TOKEN }}
build:
name: Build (aarch64-apple-darwin)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin
- name: Cache cargo registry and build artifacts
uses: Swatinem/rust-cache@v2
- name: Build release binary
run: cargo build --release --locked --target aarch64-apple-darwin
env:
ONDE_APP_ID: ${{ secrets.ONDE_APP_ID }}
ONDE_APP_SECRET: ${{ secrets.ONDE_APP_SECRET }}
GRESIQ_API_KEY: ${{ secrets.GRESIQ_API_KEY }}
GRESIQ_API_SECRET: ${{ secrets.GRESIQ_API_SECRET }}
HF_TOKEN: ${{ secrets.HF_TOKEN }}
ci:
name: CI status
runs-on: ubuntu-latest
needs:
- fmt
- clippy
- test
- check
- build
if: always()
steps:
- name: Verify all required jobs succeeded
run: |
test "${{ needs.fmt.result }}" = "success"
test "${{ needs.clippy.result }}" = "success"
test "${{ needs.test.result }}" = "success"
test "${{ needs.check.result }}" = "success"
test "${{ needs.build.result }}" = "success"