name: PR
on: pull_request
env:
CARGO_TERM_VERBOSE: true
RUST_BACKTRACE: 1
RUSTFLAGS: "-D warnings"
jobs:
checks:
name: Clippy & fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
name: Install Rust and required components
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Generate Cargo.lock
run: cargo generate-lockfile
- name: Cargo cache registry, index and build
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }}
- name: Check formatting
run: cargo fmt --all -- --check
- shell: bash
name: Run clippy checks
run: ./scripts/clippy
coverage:
name: Code coverage check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Generate Cargo.lock
run: cargo generate-lockfile
- name: Cargo cache registry, index and build
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }}
- name: rust-tarpaulin code coverage check
uses: actions-rs/tarpaulin@master
with:
args: '-v --release --out Lcov'
- name: Push code coverage results to coveralls.io
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
path-to-lcov: ./lcov.info
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Generate lockfile
run: cargo generate-lockfile
- name: Cargo cache registry, index and build
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }}
- shell: bash
name: Run tests
run: ./scripts/tests
test-publish:
name: Test Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Cargo Publish Dry Run
run: cargo publish --dry-run