|
| 1 | +name: Rust CI for WSLPlugins-rs |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + pull_request: |
| 7 | + branches: ["main"] |
| 8 | + |
| 9 | +env: |
| 10 | + CARGO_TERM_COLOR: always |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-and-validate: |
| 14 | + runs-on: windows-latest |
| 15 | + |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + toolchain: ["stable", "nightly"] |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout Code |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Install Rust (Matrix) |
| 25 | + shell: pwsh |
| 26 | + run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} |
| 27 | + |
| 28 | + - name: Lint with Clippy (Stable Only) |
| 29 | + if: matrix.toolchain == 'stable' |
| 30 | + run: cargo clippy --all-targets --all-features -- -D warnings |
| 31 | + |
| 32 | + - name: Check Code Formatting (Stable Only) |
| 33 | + if: matrix.toolchain == 'stable' |
| 34 | + run: cargo fmt -- --check |
| 35 | + |
| 36 | + - name: Build the Project |
| 37 | + run: cargo build --verbose |
| 38 | + |
| 39 | + - name: Run Tests |
| 40 | + run: cargo test --verbose |
| 41 | + |
| 42 | + - name: Generate Documentation (Stable Only) |
| 43 | + if: matrix.toolchain == 'stable' |
| 44 | + run: cargo doc --no-deps |
| 45 | + |
| 46 | + - name: Generate Documentation for Docs.rs (Nightly Only) |
| 47 | + if: matrix.toolchain == 'nightly' |
| 48 | + shell: pwsh |
| 49 | + run: | |
| 50 | + $env:RUSTDOCFLAGS = "--cfg docsrs" |
| 51 | + cargo +nightly doc --no-deps |
| 52 | +
|
| 53 | + - name: Install and Run Security Audit (Nightly Only) |
| 54 | + if: matrix.toolchain == 'nightly' |
| 55 | + run: | |
| 56 | + cargo install cargo-audit |
| 57 | + cargo audit |
0 commit comments