Merge pull request #31 from ubiquitous-factory/dependabot/cargo/serde… #110
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
| ## references: | |
| # cache: https://github.com/actions/cache/blob/main/examples.md#rust---cargo | |
| # audit: https://github.com/actions-rs/audit-check | |
| # "needs": https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds | |
| name: Build | |
| on: | |
| push: | |
| branches: [ '*' ] | |
| paths-ignore: | |
| - "**/docs/**" | |
| - "**.md" | |
| pull_request: | |
| branches: [ main ] | |
| workflow_call: | |
| merge_group: | |
| jobs: | |
| typos: | |
| name: typos | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: crate-ci/typos@master | |
| with: | |
| config: ./typos.toml | |
| check: | |
| name: check | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ['ubuntu-latest'] | |
| runs-on: ${{ matrix.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: setup | rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| default: true | |
| profile: minimal | |
| components: clippy, rustfmt | |
| - uses: Swatinem/rust-cache@v1 | |
| - run: cargo check | |
| lint: | |
| name: lint | |
| needs: check | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ['ubuntu-latest'] | |
| cargo-cmd: | |
| - fmt --all -- --check | |
| - clippy --all-targets --all-features -- -D warnings | |
| runs-on: ${{ matrix.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: setup | rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| default: true | |
| profile: minimal | |
| components: clippy, rustfmt | |
| - uses: Swatinem/rust-cache@v1 | |
| - run: cargo ${{ matrix['cargo-cmd'] }} | |
| tests: | |
| name: test | |
| needs: check | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ['ubuntu-latest'] | |
| rust: [ nightly, stable ] | |
| runs-on: ${{ matrix.version }} | |
| continue-on-error: ${{ matrix.rust == 'nightly' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: setup | rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| default: true | |
| profile: minimal | |
| - uses: Swatinem/rust-cache@v1 | |
| - name: git test setup preparation | |
| run: | | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "Your Name" | |
| # - name: Install SSH key | |
| # uses: shimataro/ssh-key-action@v2 | |
| # with: | |
| # key: ${{ secrets.CI_SSH_PRIVATE_KEY_TESTING }} | |
| # # figured by `ssh-keyscan github.com` | |
| # known_hosts: ${{ secrets.KNOWN_HOSTS }} | |
| # if_key_exists: replace # replace / ignore / fail; optional (defaults to fail) | |
| - name: cargo test | |
| run: cargo test --verbose --all --locked | |
| - name: smoke tests | |
| run: | | |
| cargo run -- --version | |
| cargo run -- --help | |
| coverage: | |
| name: code coverage | |
| needs: check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: setup | rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: nightly | |
| default: true | |
| profile: minimal | |
| components: clippy, rustfmt | |
| - name: git test setup preparation | |
| run: | | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "Your Name" | |
| - name: coverage test | |
| run: cargo +nightly test --verbose --all --locked | |
| env: | |
| CARGO_INCREMENTAL: '0' | |
| RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' | |
| RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' | |
| - name: rust-grcov | |
| # You may pin to the exact commit or the version. | |
| # uses: actions-rs/grcov@bb47b1ed7883a1502fa6875d562727ace2511248 | |
| uses: actions-rs/[email protected] | |
| - name: Codecov | |
| uses: codecov/codecov-action@v4 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| # Repository upload token - get it from codecov.io. Required only for private repositories | |
| # token: # optional | |
| # Specify whether the Codecov output should be verbose | |
| verbose: true | |
| fail_ci_if_error: false | |
| audit: | |
| name: security audit | |
| needs: check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: setup | rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| default: true | |
| profile: minimal | |
| - uses: Swatinem/rust-cache@v1 | |
| - name: audit | |
| uses: actions-rs/audit-check@v1 | |
| continue-on-error: true | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| publish-dry-run: | |
| name: publish dry run | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: setup | rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| default: true | |
| profile: minimal | |
| - uses: Swatinem/rust-cache@v1 | |
| - run: cargo publish --dry-run | |
| docs: | |
| name: docs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: setup | rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| default: true | |
| profile: minimal | |
| - uses: Swatinem/rust-cache@v1 | |
| - name: check documentation | |
| env: | |
| RUSTDOCFLAGS: -D warnings | |
| run: cargo doc --no-deps --all-features |