chore: Prepare for release #16
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: wot-td | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'src/**' | |
- 'crates/**' | |
- 'fuzz/**' | |
- '.github/**' | |
- 'Cargo.toml' | |
- 'Cargo.lock' | |
pull_request: | |
branches: | |
- master | |
paths: | |
- 'src/**' | |
- 'crates/**' | |
- 'fuzz/**' | |
- '.github/**' | |
- 'Cargo.toml' | |
- 'Cargo.lock' | |
jobs: | |
################################## LEGAL AND FORMAT LAYER ###################### | |
reuse: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: REUSE Compliance Check | |
uses: fsfe/reuse-action@v1 | |
clippy-rustfmt: | |
strategy: | |
matrix: | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: clippy, rustfmt | |
- name: Run rustfmt | |
run: | |
cargo fmt --all -- --check --verbose | |
- name: Run cargo clippy | |
uses: giraffate/clippy-action@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
clippy_flags: --all-targets -- -D warnings | |
reporter: github-pr-review | |
################################## BUILD AND DOCS LAYER ######################## | |
build: | |
needs: [reuse, clippy-rustfmt] | |
strategy: | |
matrix: | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Build | |
run: cargo build --verbose | |
docs: | |
needs: [reuse, clippy-rustfmt] | |
strategy: | |
matrix: | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Generate docs | |
run: cargo doc --verbose --no-deps | |
################################## CODE COVERAGE LAYER ################################## | |
code-coverage-ubuntu: | |
needs: [build, docs] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Install grcov | |
env: | |
GRCOV_LINK: https://github.com/mozilla/grcov/releases/download | |
GRCOV_VERSION: v0.8.19 | |
run: | | |
curl -L "$GRCOV_LINK/$GRCOV_VERSION/grcov-x86_64-unknown-linux-musl.tar.bz2" | | |
tar xj -C $HOME/.cargo/bin | |
- name: Install llvm-tools | |
run: | | |
rustup component add llvm-tools | |
# Not necessary on a newly created image, but strictly advised | |
- name: Run cargo clean | |
run: | | |
cargo clean | |
- name: Run tests | |
env: | |
RUSTFLAGS: "-Cinstrument-coverage" | |
LLVM_PROFILE_FILE: "wot-td-%p-%m.profraw" | |
run: | | |
cargo test --verbose | |
- name: Get coverage data for codecov | |
run: | | |
grcov . --binary-path ./target/debug/ -s . -t lcov --branch \ | |
--ignore-not-existing --ignore "/*" --ignore "../*" -o lcov.info | |
- name: Codecov upload | |
uses: codecov/codecov-action@v3 | |
with: | |
files: lcov.info | |
################################## DEPENDENCY LAYER ########################### | |
cargo-audit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check dependencies changes | |
uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
cargo: | |
- 'Cargo.toml' | |
- 'Cargo.lock' | |
- name: Run cargo-audit | |
if: steps.changes.outputs.cargo == 'true' | |
uses: actions-rs/audit-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
cargo-deny: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: EmbarkStudios/cargo-deny-action@v1 | |
cargo-udeps: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check dependencies changes | |
uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
cargo: | |
- 'Cargo.toml' | |
- 'Cargo.lock' | |
- name: Install Rust nightly | |
if: steps.changes.outputs.cargo == 'true' | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: nightly | |
- name: Install cargo-udeps | |
if: steps.changes.outputs.cargo == 'true' | |
env: | |
UDEPS_LINK: https://github.com/est31/cargo-udeps/releases/download | |
UDEPS_VERSION: v0.1.47 | |
run: | | |
curl -L "$UDEPS_LINK/$UDEPS_VERSION/cargo-udeps-$UDEPS_VERSION-x86_64-unknown-linux-gnu.tar.gz" | | |
tar xz -C $HOME/.cargo/bin --strip-components 2 | |
- name: Run cargo-udeps | |
if: steps.changes.outputs.cargo == 'true' | |
run: | | |
cargo +nightly udeps --all-targets | |
################################## CACHE LEVEL ################################# | |
cache-level-ubuntu: | |
needs: [cargo-audit, cargo-deny, cargo-udeps] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust nightly | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: nightly | |
components: rust-src | |
- name: Cache produced data | |
id: cache-data | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.toml') }} | |
- name: Install cargo-careful | |
if: steps.cache-data.outputs.cache-hit != 'true' | |
run: | | |
cargo install cargo-careful | |
################################## UNSAFE CHECKS LEVEL ######################### | |
careful-ubuntu: | |
needs: cache-level-ubuntu | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust nightly | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: nightly | |
components: rust-src | |
- name: Cache produced data | |
id: cache-data | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.toml') }} | |
- name: Run cargo-careful | |
run: | | |
cargo +nightly careful test | |
# cargo +nightly careful run |