v0.3.0 CI-final: proper rustfmt + 7-job CI + 15-badge README #54
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 | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| fmt: | |
| name: Format (rustfmt) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - name: cargo fmt --all --check | |
| run: cargo fmt --all --check | |
| clippy: | |
| name: Lint (clippy) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: cargo clippy | |
| run: cargo clippy --all-features --all-targets | |
| test: | |
| name: Test (ubuntu, stable) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: cargo test --all-features | |
| run: cargo test --all-features --verbose | |
| - name: cargo test --no-default-features | |
| run: cargo test --no-default-features --verbose | |
| build_no_std: | |
| name: Build no_std (Cortex-M4F) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: thumbv7em-none-eabihf | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: cargo build --target thumbv7em-none-eabihf | |
| run: cargo build --target thumbv7em-none-eabihf --no-default-features --release | |
| docs: | |
| name: Documentation (rustdoc) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: cargo doc --no-deps | |
| env: | |
| RUSTDOCFLAGS: -D warnings | |
| run: cargo doc --no-deps --all-features | |
| license: | |
| name: License files & SPDX | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: All five LICENSE files present | |
| run: | | |
| test -f LICENSE | |
| test -f LICENSE-APACHE | |
| test -f LICENSE-MIT | |
| test -f LICENSE-CC-BY-SA | |
| test -f vectors/LICENSE | |
| echo "✓ all 5 LICENSE files present" | |
| - name: SPDX identifiers correct | |
| run: | | |
| grep -q 'SPDX-License-Identifier: Apache-2.0 OR MIT' LICENSE | |
| grep -q 'SPDX-License-Identifier: CC-BY-SA-4.0' LICENSE-CC-BY-SA | |
| grep -q 'SPDX-License-Identifier: CC0-1.0' vectors/LICENSE | |
| echo "✓ all SPDX identifiers present and correct" | |
| ci_success: | |
| name: CI | |
| runs-on: ubuntu-latest | |
| needs: [fmt, clippy, test, build_no_std, docs, license] | |
| if: always() | |
| steps: | |
| - name: All jobs succeeded | |
| run: | | |
| if [ "${{ contains(needs.*.result, 'failure') }}" = "true" ] || \ | |
| [ "${{ contains(needs.*.result, 'cancelled') }}" = "true" ]; then | |
| echo "one or more jobs failed" | |
| exit 1 | |
| fi | |
| echo "all CI jobs passed" |