diff --git a/.gitea/workflows/rust-quality.yml b/.gitea/workflows/rust-quality.yml new file mode 100644 index 0000000..28af5cf --- /dev/null +++ b/.gitea/workflows/rust-quality.yml @@ -0,0 +1,67 @@ +name: Rust Quality Checks + +on: + push: + branches: [ main, dev ] + paths: + - 'bridge/**' + - '.gitea/workflows/rust-quality.yml' + pull_request: + branches: [ main ] + paths: + - 'bridge/**' + +jobs: + rust-checks: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install Rust nightly + uses: https://github.com/actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + components: rustfmt, clippy + + - name: Cache Rust dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + bridge/target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('bridge/Cargo.lock', 'bridge/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Check formatting + run: | + cd bridge + cargo fmt -- --check + + - name: Run clippy + run: | + cd bridge + cargo clippy --all-targets --all-features -- -D warnings + + - name: Check for unused dependencies + run: | + cd bridge + cargo install cargo-udeps --locked || true + cargo +nightly udeps || true + + - name: Security audit + run: | + cd bridge + cargo install cargo-audit --locked || true + cargo audit || true + + - name: Build documentation + run: | + cd bridge + cargo doc --no-deps --document-private-items