build container on push new release tag #5
Workflow file for this run
This file contains 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: Test and verify Rust contributions | |
on: | |
# Run if contributions to dev or main are proposed. | |
pull_request: | |
branches: | |
- main | |
- dev | |
types: | |
- opened | |
- edited | |
- synchronize | |
paths: | |
- '**.rs' | |
# Run if Rust code has been changed. Readme and other changes are not relevant. | |
push: | |
paths: | |
- '**.rs' | |
# Run upon manual request. | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Report rustfmt version | |
run: cargo fmt -- --version | |
- name: Check style | |
run: cargo fmt -- --check | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache Rust toolchain | |
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2 | |
- name: Build | |
run: cargo build --verbose | |
- name: Install latest nextest release | |
uses: taiki-e/install-action@nextest | |
- name: Test nextest all | |
run: cargo nextest run --verbose | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- name: Install sarif-rs | |
run: cargo install sarif-fmt clippy-sarif | |
- name: Cache Rust toolchain | |
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2 | |
- name: Test Libraries and pretty-print output | |
run: cargo clippy --all-targets --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt | |
continue-on-error: true | |
- name: Create an artifact from clippy results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ClippyResults | |
path: rust-clippy-results.sarif | |
- name: Upload clippy analysis results to GitHub | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: rust-clippy-results.sarif | |
wait-for-processing: true | |
tarpaulin: | |
name: Determine test coverage with Tarpaulin | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install tarpaulin | |
run: cargo install cargo-tarpaulin | |
- name: Cache Rust toolchain | |
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2 | |
- name: Generate code coverage | |
run: | | |
cargo-tarpaulin --tests --bins --follow-exec --timeout 120 --out Xml | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: TarpaulinCodeCoverage.xml | |
path: cobertura.xml | |
#- name: Upload coverage reports to Codecov | |
# uses: codecov/codecov-action@v4.0.1 | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |