| 1 | name: CI |
| 2 | on: |
| 3 | push: |
| 4 | branches: [main] |
| 5 | pull_request: |
| 6 | merge_group: |
| 7 | jobs: |
| 8 | check: |
| 9 | runs-on: ubuntu-latest |
| 10 | steps: |
| 11 | - uses: actions/checkout@v7 |
| 12 | - uses: dtolnay/rust-toolchain@stable |
| 13 | with: |
| 14 | components: rustfmt, clippy |
| 15 | - uses: actions/cache@v6 |
| 16 | with: |
| 17 | path: | |
| 18 | ~/.cargo/registry |
| 19 | ~/.cargo/git |
| 20 | target |
| 21 | key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} |
| 22 | restore-keys: cargo-${{ runner.os }}- |
| 23 | - name: Formatting |
| 24 | run: cargo fmt --check |
| 25 | - name: Lints |
| 26 | run: cargo clippy --all-targets -- -D warnings |
| 27 | - name: Every flag is documented |
| 28 | run: | |
| 29 | missing="" |
| 30 | for flag in $(grep -o 'arg == "-[^"]*"' src/lib.rs | cut -d'"' -f2 | sort -u); do |
| 31 | grep '^|' README.md | grep -qF -- "$flag" || missing="$missing $flag" |
| 32 | done |
| 33 | if [ -n "$missing" ]; then |
| 34 | echo "Flags missing from the README options table:$missing" |
| 35 | exit 1 |
| 36 | fi |
| 37 | - name: Tests |
| 38 | run: cargo test |