---
name: Rust
"on": [push]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Determine if files changed
uses: fkirc/skip-duplicate-actions@v3.4.0
id: skip_check
with:
paths: '["**.rs", "**Cargo.{toml,lock}"]'
- name: Checkout code
uses: actions/checkout@v2
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
- name: Cache build artifacts
uses: actions/cache@v2.1.6
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- name: Run Clippy
uses: actions-rs/cargo@v1
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
with:
command: clippy
args: --all-targets --all-features -- -D warnings
style:
name: Style
runs-on: ubuntu-latest
steps:
- name: Determine if files changed
uses: fkirc/skip-duplicate-actions@v3.4.0
id: skip_check
with:
paths: '["**.rs", "**Cargo.{toml,lock}"]'
- name: Checkout code
uses: actions/checkout@v2
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: Run Rustfmt
uses: actions-rs/cargo@v1
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
with:
command: fmt
args: --all -- --check
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Determine if files changed
uses: fkirc/skip-duplicate-actions@v3.4.0
id: skip_check
with:
paths: '["**.rs", "**Cargo.{toml,lock}"]'
- name: Checkout code
uses: actions/checkout@v2
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
- name: Cache build artifacts
uses: actions/cache@v2.1.6
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
with:
toolchain: stable
override: true
- name: Run cargo-tarpaulin
uses: actions-rs/tarpaulin@master
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
with:
version: 0.16.0
- name: Upload to codecov.io
uses: codecov/codecov-action@v1.5.2
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Archive code coverage results
uses: actions/upload-artifact@v2.2.4
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
with:
name: code-coverage-report
path: cobertura.xml