Simplify GitHub Actions #1
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: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- master | |
paths: | |
- 'Cargo.toml' | |
- 'src/**' | |
- '.codespellrc' | |
- '.github/workflows/rust.yml' | |
pull_request: | |
branches: | |
- main | |
- master | |
paths: | |
- 'Cargo.toml' | |
- 'src/**' | |
- '.codespellrc' | |
- '.github/workflows/rust.yml' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
codespell: | |
name: Check for spelling mistakes | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Codespell | |
uses: codespell-project/actions-codespell@v2 | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check format | |
run: cargo fmt --check | |
- name: Clippy | |
run: cargo clippy --all-features | |
docs: | |
name: Build documentation | |
needs: | |
- codespell | |
- lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build documentation | |
run: cargo doc --all-features --document-private-items | |
build-linux: | |
name: Build on Linux | |
needs: | |
- lint | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
features: [ [ "--all-features" ] ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Clippy | |
run: cargo clippy ${{ join(matrix.features, ' ') }} | |
- name: Install dependencies | |
run: cargo fetch | |
- name: Check | |
run: cargo check --verbose ${{ join(matrix.features, ' ') }} | |
- name: Build | |
run: cargo build --verbose ${{ join(matrix.features, ' ') }} | |
- name: Run regular tests | |
run: cargo test --tests --verbose ${{ join(matrix.features, ' ') }} | |
# codecov: | |
# name: Code Coverage | |
# needs: | |
# - lint | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - uses: dtolnay/rust-toolchain@stable | |
# with: | |
# components: llvm-tools-preview | |
# - name: Install cargo-llvm-cov | |
# uses: taiki-e/install-action@cargo-llvm-cov | |
# uses: taiki-e/install-action@nextest | |
# - name: Generate code coverage | |
# run: cargo llvm-cov nextest --all-features --lcov --output-path lcov.info | |
# - name: Upload coverage to Codecov | |
# uses: codecov/codecov-action@v4.0.1 | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# files: lcov.info | |
# fail_ci_if_error: true |