ci/github: add lint workflow
This commit is contained in:
parent
a4df48e85e
commit
d30ba45b03
|
@ -0,0 +1,152 @@
|
|||
|
||||
name: "Linting"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
# Need to run it on master redundantly, or caches don't work
|
||||
push:
|
||||
branches: ["master"]
|
||||
|
||||
env:
|
||||
RUST_BACKTRACE: full
|
||||
CARGO_INCREMENTAL: 0
|
||||
YARY_COLOR: 0
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: "[${{ matrix.os }}/${{ matrix.rust }}] ${{ matrix.just.name }}"
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
rust:
|
||||
- stable
|
||||
- 1.53
|
||||
just:
|
||||
- name: "Lint"
|
||||
recipe: lint
|
||||
vars: ""
|
||||
steps:
|
||||
# Checkout code
|
||||
- name: "Git checkout"
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Install Rust toolchain
|
||||
- name: "Install Rust ${{ matrix.rust }}"
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
profile: minimal
|
||||
default: true
|
||||
components: rustfmt,clippy
|
||||
|
||||
- name: "Install Rust rustfmt (nightly)"
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
profile: minimal
|
||||
default: false
|
||||
components: rustfmt
|
||||
|
||||
- name: "Install Just"
|
||||
uses: extractions/setup-just@v1
|
||||
with:
|
||||
just-version: 1
|
||||
|
||||
- name: "Save Cargo cache"
|
||||
uses: Swatinem/rust-cache@v1
|
||||
|
||||
- name: "Task ${{ matrix.just.name }}"
|
||||
run: just ${{ matrix.just.vars }} ${{ matrix.just.recipe }}
|
||||
|
||||
doclint:
|
||||
name: "[${{ matrix.os }}/${{ matrix.rust }}] ${{ matrix.just.name }}"
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
rust:
|
||||
- nightly
|
||||
just:
|
||||
- name: "Doc Lint"
|
||||
recipe: lint-docs
|
||||
vars: ""
|
||||
steps:
|
||||
# Checkout code
|
||||
- name: "Git checkout"
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Install Rust toolchain
|
||||
- name: "Install Rust ${{ matrix.rust }}"
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
profile: minimal
|
||||
default: true
|
||||
components: rustfmt
|
||||
|
||||
# Install recipe runner
|
||||
- name: "Install Just"
|
||||
uses: extractions/setup-just@v1
|
||||
with:
|
||||
just-version: 1
|
||||
|
||||
# Save cache
|
||||
- name: "Save Cargo cache"
|
||||
uses: Swatinem/rust-cache@v1
|
||||
with:
|
||||
sharedKey: docs
|
||||
|
||||
# Run tasks
|
||||
- name: "Task ${{ matrix.just.name }}"
|
||||
run: just ${{ matrix.just.vars }} ${{ matrix.just.recipe }}
|
||||
|
||||
audit:
|
||||
name: "[${{ matrix.os }}/${{ matrix.rust }}] ${{ matrix.just.name }}"
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
rust:
|
||||
- nightly
|
||||
just:
|
||||
- name: "Unused Deps"
|
||||
recipe: udeps
|
||||
vars: ""
|
||||
- name: "Audit Deps"
|
||||
recipe: audit
|
||||
vars: ""
|
||||
steps:
|
||||
# Checkout code
|
||||
- name: "Git checkout"
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Install Rust toolchain
|
||||
- name: "Install Rust ${{ matrix.rust }}"
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
profile: minimal
|
||||
default: true
|
||||
components: rustfmt
|
||||
|
||||
# Install recipe runner
|
||||
- name: "Install Just"
|
||||
uses: extractions/setup-just@v1
|
||||
with:
|
||||
just-version: 1
|
||||
|
||||
# Save cache
|
||||
- name: "Save Cargo cache"
|
||||
uses: Swatinem/rust-cache@v1
|
||||
|
||||
# Run tasks
|
||||
- name: "Task ${{ matrix.just.name }}"
|
||||
run: just ${{ matrix.just.vars }} ${{ matrix.just.recipe }}
|
Loading…
Reference in New Issue