name: CI
on:
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test Suite
runs-on: ${{ matrix.os }}
if: github.actor != 'github-actions[bot]'
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust: [stable]
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock', '.gitignore') }}
- name: Run cargo check
run: cargo check --all-targets --all-features
- name: Install musl tools (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y musl-tools gcc-aarch64-linux-gnu
rustup target add x86_64-unknown-linux-musl
rustup target add aarch64-unknown-linux-musl
- name: Build release binary
run: cargo build --release --bin agenterra
- name: Build musl release binary (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
# Build x86_64 musl binary
cargo build --release --target x86_64-unknown-linux-musl --bin agenterra
# Build aarch64 musl binary with proper linker
export CC_aarch64_unknown_linux_musl=aarch64-linux-gnu-gcc
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc
cargo build --release --target aarch64-unknown-linux-musl --bin agenterra
- name: Run unit tests
run: cargo test --all-features
- name: Run integration tests
run: cargo test --test e2e_mcp_test
lint:
name: Linting
runs-on: ubuntu-latest
if: github.actor != 'github-actions[bot]'
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ github.job }}-${{ hashFiles('**/Cargo.lock', '.gitignore') }}
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings
security:
name: Security Audit
runs-on: ubuntu-latest
if: github.actor != 'github-actions[bot]'
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ github.job }}-${{ hashFiles('**/Cargo.lock', '.gitignore') }}
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Run security audit
run: cargo audit