name: CI
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
jobs:
lint:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd with:
persist-credentials: false
- name: Install pinned toolchain + components
run: |
rustup show
rustup component add clippy rustfmt
- uses: Swatinem/rust-cache@42dc69e1aa15d09112580998cf2ef0119e2e91ae with:
cache-on-failure: true
- name: Run clippy
run: cargo clippy --all-targets -- -D warnings
- name: Run cargo fmt
run: cargo fmt -- --check
- name: Security audit
run: |
cargo install cargo-audit --locked || true
cargo audit || true
test:
needs: lint
permissions:
contents: read
strategy:
fail-fast: true
matrix:
os: [macos-latest, ubuntu-latest]
rust: [nightly, stable]
runs-on: ${{ matrix.os }}
continue-on-error: false
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd with:
persist-credentials: false
- uses: Swatinem/rust-cache@42dc69e1aa15d09112580998cf2ef0119e2e91ae with:
cache-on-failure: true
- name: Set up Rust
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 with:
toolchain: ${{ matrix.rust }}
- name: Install fish (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt install fish
- name: Install fish (macOS)
if: startsWith(matrix.os, 'macos')
run: brew install fish
- name: Run integration tests
run: fish ./scripts/integration-tests
- name: Run cargo test
run: cargo test