fix publish workflow (#31) #174
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: Rust | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_call: | |
secrets: | |
CODECOV_TOKEN: | |
required: true | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-targets: false | |
cache-all-crates: true | |
- name: Build | |
run: cargo build --all-features --verbose | |
- name: Format | |
run: cargo fmt --all --check --verbose | |
- name: Clippy | |
run: cargo clippy | |
- name: Install tools | |
run: cargo install-tools | |
- name: Run tests | |
id: tests | |
run: cargo llvm-cov nextest --all-features --all-targets --no-fail-fast | |
- name: Prepare coverage report | |
id: coverage | |
if: success() || steps.tests.outcome == 'failure' | |
run: cargo llvm-cov report --lcov --output-path coverage.lcov | |
- name: Upload coverage reports to Codecov | |
if: success() || steps.coverage.outcome == 'success' | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
files: coverage/*.lcov | |
- name: Machete | |
run: cargo machete | |
- name: Deny | |
run: cargo deny check all | |
- name: Dry run publish | |
run: | | |
cargo license --all-features --avoid-dev-deps --json > dependencies-license.json | |
cargo publish --all-features --allow-dirty --dry-run | |
cargo package --all-features --list --allow-dirty |