name: Rust CI
on:
workflow_call:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
rust:
name: Rust CI
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
steps:
- uses: actions/checkout@v7
- name: Validate release workflows
if: matrix.os == 'ubuntu-latest'
run: ruby .github/scripts/validate_release_workflows.rb
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-ci
- name: Check
run: cargo check --all-features --locked
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-features --locked -- -W clippy::all -A clippy::missing_docs_in_private_items -A clippy::pedantic
- name: Build
run: cargo build --all-features --locked
- name: Test
run: cargo test --all-features --locked
windows:
name: Windows build
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: windows-ci
- name: Check supported binary
run: cargo check --all-features --locked --bin winx-code-agent
- name: Build supported release binary
run: cargo build --release --locked --bin winx-code-agent