Skip to content

CI

CI #38

Workflow file for this run

name: CI
# Controls when the action will run.
on:
# Triggers the workflow on any pushes to any branch
push:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install nightly with rustfmt
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Install stable with clippy
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Format Check
#run cargo fmt to fix if in violation
run: cargo +nightly fmt -- --check
- name: Clippy Linting
# --all-targets means apply to test code too. Without it just applies to application code
run: cargo clippy --all-targets -p purl -- -D warnings
- name: Regenerate test suite
run: cargo xtask codegen
- name: Ensure no changes to test suite
run: |
git diff --exit-code -- purl_test
- name: Check docs
run: RUSTDOCFLAGS="-D warnings" cargo xtask doc -p purl --no-deps
test:
strategy:
matrix:
include:
- name: Minimal
runner: test
features: --no-default-features
- name: Default
runner: test
features: ""
- name: Full
runner: tarpaulin
features: --all-features
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install stable with clippy
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install tarpaulin
if: ${{ matrix.runner == 'tarpaulin' }}
run: |
curl --proto '=https' --tlsv1.2 -sSfL https://github.com/xd009642/tarpaulin/releases/download/0.25.1/cargo-tarpaulin-x86_64-unknown-linux-gnu.tar.gz > tarpaulin.tar.gz
printf 'd3f687ffc0c30ee1e7e5ea63f58b4fb770ce38f6d97d1afca340846ed783de85 tarpaulin.tar.gz' | sha256sum -c || exit 1
mkdir -p ~/.cargo/bin
tar -xzf tarpaulin.tar.gz -C ~/.cargo/bin
rm tarpaulin.tar.gz
- name: Run tests
run: cargo ${{ matrix.runner }} ${{ matrix.features }}