Files
anyllm-proxy/.github/workflows/ci.yml
T
whit3rabbit c9e9221caf ci: add cargo-audit step to catch crates with known CVEs
Runs after cargo test in the test job. Uses --locked for reproducibility.
2026-03-27 23:45:36 -05:00

108 lines
3.2 KiB
YAML

name: CI
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --check
- name: Clippy
run: cargo clippy -- -D warnings
- name: Build
run: cargo build
- name: Test
run: cargo test
- name: Security audit
run: |
cargo install cargo-audit --locked --quiet
cargo audit
build-release:
name: Build (${{ matrix.target }})
needs: test
if: startsWith(github.ref, 'refs/tags/v')
strategy:
fail-fast: false
matrix:
include:
# Linux x86_64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: anyllm_proxy
# Linux ARM64 (native GitHub runner)
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
binary: anyllm_proxy
# macOS Apple Silicon
- os: macos-latest
target: aarch64-apple-darwin
binary: anyllm_proxy
# macOS Intel
- os: macos-latest
target: x86_64-apple-darwin
binary: anyllm_proxy
# Windows x86_64
- os: windows-latest
target: x86_64-pc-windows-msvc
binary: anyllm_proxy.exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build
run: cargo build --release -p anyllm_proxy --target ${{ matrix.target }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: anyllm_proxy-${{ matrix.target }}
path: target/${{ matrix.target }}/release/${{ matrix.binary }}
publish:
name: Publish to crates.io
needs: [test, build-release]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# Publish in dependency order. --no-verify skips re-building from the
# packed tarball; the test job already verified the build.
# Sleeps give the crates.io index time to propagate before dependents publish.
- name: Publish anyllm_translate
run: cargo publish -p anyllm_translate
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Wait for index propagation
run: sleep 30
- name: Publish anyllm_client
run: cargo publish -p anyllm_client --no-verify
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Wait for index propagation
run: sleep 30
- name: Publish anyllm_proxy
run: cargo publish -p anyllm_proxy --no-verify
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}