Clean up CI #23
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 | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
rust-toolchain: | |
- stable | |
- beta | |
- nightly | |
feature: | |
- default | |
- memchr | |
- serde | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup | Rust | |
run: | | |
rustup toolchain install ${{ matrix.rust-toolchain }} --profile minimal | |
rustup default ${{ matrix.rust-toolchain }} | |
- name: Setup cache for cargo | |
uses: actions/cache@v4 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-${{ matrix.rust-toolchain }}-${{ matrix.feature }} | |
- name: Install cargo-binstall | |
run: | | |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash | |
- name: Install cargo-tarpaulin | |
run: | | |
cargo binstall -y cargo-tarpaulin | |
- name: Measure code coverage with ${{ matrix.feature }} feature | |
run: | | |
cargo tarpaulin -v --out Xml --ciserver github-actions --no-default-features --features=${{ matrix.feature }} | |
- name: Upload coverage statistics | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | |
flags: rust-${{ matrix.rust-toolchain }},${{ matrix.feature }} | |
all-tests: | |
runs-on: ubuntu-22.04 | |
needs: | |
- test | |
if: always() | |
steps: | |
- name: Success | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: Failure | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 | |
lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Rust stable | |
run: | | |
rustup toolchain install stable --profile minimal --component rustfmt | |
rustup default stable | |
- name: Check code format | |
run: | | |
cargo fmt --all -- --check |