refactor(lint): check specific files for each job (#4311)

* refactor(lint): check specific files for each job

* refactor(lint): use an approach which requires less code

* fix(lint): validate against true string not boolean
This commit is contained in:
Gustavo Valverde 2022-05-05 07:09:21 -04:00 committed by GitHub
parent a23420be88
commit 9856e2ad17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 61 deletions

View File

@ -1,32 +0,0 @@
name: Lint
on:
pull_request:
branches:
- 'main'
paths-ignore:
- '**/*.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- 'clippy.toml'
- '.cargo/config.toml'
- '.github/workflows/*.yml'
jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'
actionlint:
name: Actionlint
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

View File

@ -6,44 +6,47 @@ on:
push:
branches:
- main
paths:
# production code and test code
- '**/*.rs'
# hard-coded checkpoints
# TODO: skip proptest regressions
- '**/*.txt'
# dependencies
- '**/Cargo.toml'
- '**/Cargo.lock'
# workflow definitions that change the clippy cache
- '.cargo/config.toml'
- '.github/workflows/ci.yml'
pull_request:
branches:
- 'main'
paths:
# code and tests
- '**/*.rs'
# dependencies
- '**/Cargo.toml'
- '**/Cargo.lock'
# workflow definitions
- 'clippy.toml'
- '.cargo/config.toml'
# TODO: we might want to run this in a separate workflow in the future for the `actionlint` job
- '.github/workflows/*.yml'
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
RUST_LIB_BACKTRACE: full
COLORBT_SHOW_HIDDEN: '1'
jobs:
changed-files:
runs-on: ubuntu-latest
name: Checks changed-files
outputs:
rust: ${{ steps.changed-files-rust.outputs.any_changed == 'true' }}
workflows: ${{ steps.changed-files-workflows.outputs.any_changed == 'true' }}
steps:
- uses: actions/checkout@v3.0.2
with:
persist-credentials: false
fetch-depth: 0
- name: Rust files
id: changed-files-rust
uses: tj-actions/changed-files@v19
with:
files: |
**/*.rs
**/Cargo.toml
**/Cargo.lock
clippy.toml
.cargo/config.toml
- name: Workflow files
id: changed-files-workflows
uses: tj-actions/changed-files@v19
with:
files: |
.github/workflows/*.yml
clippy:
name: Clippy
timeout-minutes: 30
runs-on: ubuntu-latest
needs: changed-files
if: ${{ needs.changed-files.outputs.rust == 'true' }}
steps:
- uses: actions/checkout@v3.0.2
@ -83,6 +86,8 @@ jobs:
name: Rustfmt
timeout-minutes: 30
runs-on: ubuntu-latest
needs: changed-files
if: ${{ needs.changed-files.outputs.rust == 'true' }}
steps:
- uses: actions/checkout@v3.0.2
@ -104,6 +109,9 @@ jobs:
actionlint:
runs-on: ubuntu-latest
continue-on-error: true
needs: changed-files
if: ${{ needs.changed-files.outputs.workflows == 'true' }}
steps:
- uses: actions/checkout@v3.0.2
- uses: reviewdog/action-actionlint@v1.24.0