Repository navigation
chore: leaner bootstrap #1079
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Coding Practices | |
| permissions: | |
| contents: read | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| types: [opened, synchronize, reopened, converted_to_draft, ready_for_review] | |
| branches: ["*"] | |
| env: | |
| # NOTE: Necessary for cache | |
| CARGO_BUILD_TARGET: x86_64-unknown-linux-gnu | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| rust-toolchain: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - run: ./scripts/check-rust-toolchain-version | |
| changes: | |
| runs-on: ubuntu-24.04 | |
| # Required to expose outputs to dependent jobs (unused-dependencies, licenses-compatibility) | |
| outputs: | |
| crates: ${{ steps.changes.outputs.crates }} | |
| dependencies: ${{ steps.changes.outputs.dependencies }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dorny/paths-filter@v4 | |
| id: changes | |
| with: | |
| filters: | | |
| crates: | |
| - "crates/**" | |
| dependencies: | |
| - "Cargo.toml" | |
| - "Cargo.lock" | |
| - ".config/hakari.toml" | |
| - "crates/**/Cargo.toml" | |
| - "crates/**/Cargo.lock" | |
| changelog: | |
| needs: changes | |
| if: ${{ github.event_name == 'pull_request' && needs.changes.outputs.crates == 'true' }} | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Validate changelog updates | |
| id: validate | |
| continue-on-error: true | |
| run: python3 scripts/check-changelog --report-file changelog-check-report.md | |
| - name: Prepare changelog report artifact | |
| if: always() | |
| run: | | |
| mkdir -p changelog-check-artifact | |
| printf '%s\n' '${{ github.event.pull_request.number }}' > changelog-check-artifact/pr_number | |
| printf '%s\n' '${{ steps.validate.outcome }}' > changelog-check-artifact/outcome | |
| if [ -f changelog-check-report.md ]; then | |
| cp changelog-check-report.md changelog-check-artifact/report.md | |
| fi | |
| - name: Upload changelog report artifact | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: changelog-check-report | |
| path: changelog-check-artifact | |
| if-no-files-found: error | |
| - name: Fail on changelog validation errors | |
| if: steps.validate.outcome != 'success' | |
| run: | | |
| echo "Changelog validation failed." | |
| echo | |
| if [ -f changelog-check-report.md ]; then | |
| cat changelog-check-report.md | |
| else | |
| echo "No report file was generated; see the 'Validate changelog updates' step for details." | |
| fi | |
| exit 1 | |
| unused-dependencies: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: jaxxstorm/action-install-gh-release@v1.10.0 | |
| with: | |
| repo: bnjbvr/cargo-machete | |
| tag: v0.7.0 | |
| binaries-location: cargo-machete-v0.7.0-x86_64-unknown-linux-musl | |
| - run: cargo machete | |
| hakari: | |
| needs: changes | |
| if: ${{ needs.changes.outputs.dependencies == 'true' }} | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-hakari@0.9.38 | |
| - run: cargo hakari generate --diff | |
| licenses-compatibility: | |
| needs: changes | |
| if: ${{ needs.changes.outputs.dependencies == 'true' }} | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: jaxxstorm/action-install-gh-release@v1.10.0 | |
| with: | |
| repo: EmbarkStudios/cargo-deny | |
| tag: 0.16.4 | |
| binaries-location: cargo-deny-0.16.4-x86_64-unknown-linux-musl | |
| - run: cargo deny-amaru | |
| license-headers: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: viperproject/check-license-header@v2 | |
| with: | |
| path: . | |
| config: .github/check-license-header.config.json | |
| strict: false | |
| clippy: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/stage-peer-snapshots | |
| - uses: ./.github/actions/cache | |
| - run: cargo clippy-amaru | |
| formatting: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - run: cargo fmt-amaru | |
| docs: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - uses: ./.github/actions/stage-peer-snapshots | |
| - uses: ./.github/actions/cache | |
| - name: Check documentation | |
| run: | | |
| export RUSTDOCFLAGS="-D warnings" | |
| cargo doc --no-deps --workspace | |
| cargo doc -p amaru --no-deps --all-features |