From 602590671983baaa16fd881ebfdd10a826561675 Mon Sep 17 00:00:00 2001 From: Bazaah Date: Fri, 1 Apr 2022 20:49:29 +0000 Subject: [PATCH] ci/github: add lint workflow --- .github/workflows/lint.yaml | 152 ++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..dcdbec7 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -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 }}