mirror of
https://github.com/danbulant/robotparser-rs
synced 2026-05-19 04:18:42 +00:00
* workflows: add support coverage Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com> * workflows: use HOME instead of '~' for fix macos cache build Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
148 lines
3.7 KiB
YAML
148 lines
3.7 KiB
YAML
---
|
|
name: CI
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- "**.md"
|
|
|
|
pull_request:
|
|
paths-ignore:
|
|
- "**.md"
|
|
|
|
jobs:
|
|
# Run the `rustfmt` code formatter
|
|
rustfmt:
|
|
name: Rustfmt [Formatter]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
components: rustfmt
|
|
override: true
|
|
- run: rustup component add rustfmt
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: fmt
|
|
args: --all -- --check
|
|
|
|
# Run the `clippy` linting tool
|
|
clippy:
|
|
name: Clippy [Linter]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
components: clippy
|
|
override: true
|
|
- uses: actions-rs/clippy-check@v1
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
args: --all-targets --all-features -- -D clippy::all
|
|
|
|
coverage:
|
|
name: Tarpaulin [Coverage]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
- name: Run cargo-tarpaulin
|
|
uses: actions-rs/tarpaulin@v0.1
|
|
- name: Upload to codecov.io
|
|
uses: codecov/codecov-action@v1
|
|
with:
|
|
token: ${{secrets.CODECOV_TOKEN}}
|
|
- name: Archive code coverage results
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: code-coverage-report
|
|
path: cobertura.xml
|
|
|
|
# Run a security audit on dependencies
|
|
cargo_audit:
|
|
name: Cargo Audit [Security]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
- run: cargo install --force cargo-audit
|
|
- run: cargo generate-lockfile
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: audit
|
|
|
|
# Ensure that the project could be successfully compiled
|
|
cargo_check:
|
|
name: Compile
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --all
|
|
|
|
# Run tests on Linux, macOS, and Windows
|
|
# On both Rust stable and Rust nightly
|
|
test:
|
|
name: Test Suite
|
|
needs: [cargo_check]
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, macOS-latest, windows-latest]
|
|
rust: [stable, nightly]
|
|
|
|
steps:
|
|
# Checkout the branch being tested
|
|
- uses: actions/checkout@v2
|
|
|
|
# Cache files between builds
|
|
- name: Cache cargo registry
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: $HOME/.cargo/registry
|
|
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Cache cargo index
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: $HOME/.cargo/git
|
|
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Cache cargo build
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: target
|
|
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
# Install all the required dependencies for testing
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- name: Run all tests
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|