Validation #191
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: Validation | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| merge_group: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| # Cancel jobs for previous commits in the same branch. | |
| # On main `head_ref` is not available and `run_id` is always unique. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| formatting: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - uses: ./.github/actions/setup-tools | |
| with: | |
| tombi: true | |
| - run: cargo fmt --all -- --check | |
| - run: tombi format --check | |
| - run: tombi lint | |
| clippy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-bin: "false" | |
| cache-on-failure: true | |
| - run: cargo clippy --workspace --all-targets --all-features -- -D warnings | |
| tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-bin: "false" | |
| cache-on-failure: true | |
| - run: cargo test --workspace --all-targets --all-features --verbose -- --ignored | |
| - name: Check for uncommitted Cargo.lock changes | |
| run: | | |
| if ! git diff --exit-code Cargo.lock; then | |
| echo "::error::Cargo.lock has uncommitted changes. Please commit them." | |
| exit 1 | |
| fi | |
| docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-bin: "false" | |
| cache-on-failure: true | |
| - run: cargo doc --workspace --all-features --no-deps | |
| env: | |
| RUSTDOCFLAGS: "-D warnings" | |
| docsrs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # No submodules as we want to test that docs generate without FreeRTOS sources available. | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-bin: "false" | |
| cache-on-failure: true | |
| - uses: ./.github/actions/setup-tools | |
| with: | |
| cargo-docs-rs: true | |
| - run: | | |
| rm -r .cargo # Remove the environment variables related to FreeRTOS source. | |
| cargo docs-rs -p veecle-freertos-sys | |
| cargo docs-rs -p veecle-freertos-integration | |
| commits: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'merge_group' }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: ./.github/actions/setup-tools | |
| with: | |
| convco: true | |
| - name: Check conventional commits | |
| # We require squash-merge, which means only one commit will be added per PR. | |
| # We cannot check the complete history as it contains a commit that doesn't follow conventional commits. | |
| run: convco check -n 1 | |
| yamllint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - run: pipx run yamllint . | |
| deny: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - uses: EmbarkStudios/cargo-deny-action@v2 | |
| validate: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - formatting | |
| - clippy | |
| - tests | |
| - docs | |
| - docsrs | |
| - commits | |
| - yamllint | |
| - deny | |
| if: always() | |
| steps: | |
| - run: exit 1 | |
| if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }} |