|
| 1 | +name: Quality |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + schedule: |
| 8 | + - cron: '0 6 * * 1' # Mondays 06:00 UTC — pick up new advisories |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + stub-checks: |
| 13 | + name: Stub checks |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Install Rust |
| 19 | + uses: dtolnay/rust-toolchain@stable |
| 20 | + with: |
| 21 | + components: rustfmt, clippy |
| 22 | + |
| 23 | + - name: Find stub directory |
| 24 | + id: stub |
| 25 | + run: | |
| 26 | + DIR=$(find stubs -mindepth 1 -maxdepth 1 -type d | head -1) |
| 27 | + echo "dir=$DIR" >> "$GITHUB_OUTPUT" |
| 28 | +
|
| 29 | + - name: cargo fmt |
| 30 | + if: steps.stub.outputs.dir |
| 31 | + working-directory: ${{ steps.stub.outputs.dir }} |
| 32 | + run: cargo fmt -- --check |
| 33 | + |
| 34 | + - name: cargo clippy |
| 35 | + if: steps.stub.outputs.dir |
| 36 | + working-directory: ${{ steps.stub.outputs.dir }} |
| 37 | + run: cargo clippy --all-targets -- -D warnings |
| 38 | + |
| 39 | + - name: cargo build |
| 40 | + if: steps.stub.outputs.dir |
| 41 | + working-directory: ${{ steps.stub.outputs.dir }} |
| 42 | + run: cargo build --release |
| 43 | + |
| 44 | + audit: |
| 45 | + name: cargo-audit |
| 46 | + runs-on: ubuntu-latest |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@v4 |
| 49 | + - name: Find stub directory |
| 50 | + id: stub |
| 51 | + run: | |
| 52 | + DIR=$(find stubs -mindepth 1 -maxdepth 1 -type d | head -1) |
| 53 | + echo "dir=$DIR" >> "$GITHUB_OUTPUT" |
| 54 | + - name: Audit |
| 55 | + if: steps.stub.outputs.dir |
| 56 | + uses: rustsec/audit-check@v2.0.0 |
| 57 | + with: |
| 58 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + working-directory: ${{ steps.stub.outputs.dir }} |
| 60 | + |
| 61 | + license-consistency: |
| 62 | + name: License consistency |
| 63 | + runs-on: ubuntu-latest |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v4 |
| 66 | + - name: Check license trio is present |
| 67 | + run: | |
| 68 | + set -e |
| 69 | + test -f LICENSE |
| 70 | + grep -q "Business Source License 1.1" LICENSE |
| 71 | + test -f examples/LICENSE |
| 72 | + grep -q "Apache License" examples/LICENSE |
| 73 | + echo "license trio (BSL-1.1 root, Apache-2.0 examples) intact" |
| 74 | + - name: Check stub Cargo.toml license-file |
| 75 | + run: | |
| 76 | + set -e |
| 77 | + for cargo in stubs/*/Cargo.toml; do |
| 78 | + grep -q '^license-file = "LICENSE"' "$cargo" || (echo "$cargo missing license-file"; exit 1) |
| 79 | + test -f "$(dirname "$cargo")/LICENSE" |
| 80 | + done |
| 81 | + echo "stub license-file references valid" |
0 commit comments