name: Lint, Build and Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
fmt:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: full
RUST_LOG: trace
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Check formatting
run: |
cargo --locked fmt -- --check
clippy:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: full
RUST_LOG: trace
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Catch common mistakes and unwrap calls
run: |
cargo --locked clippy -- -D warnings
test:
runs-on: ubuntu-latest
needs: [fmt, clippy]
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: full
RUST_LOG: trace
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rust-analyzer
- uses: Swatinem/rust-cache@v2
- name: Build and Test
run: |
cargo test --locked --workspace --release --all-features
- name: Upload the test daemons' logs
if: failure()
uses: actions/upload-artifact@v7
with:
name: test-daemon-logs
path: /tmp/rust-analyzer-mcp-sockets/*.log*
if-no-files-found: ignore
retention-days: 14