mirror of https://github.com/astral-sh/ruff
Only run jobs if relevant files changed (#5908)
This commit is contained in:
parent
76e9ce6dc0
commit
6fd8574a0b
|
|
@ -2,6 +2,14 @@ name: Benchmark
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'Cargo.toml'
|
||||||
|
- 'Cargo.lock'
|
||||||
|
- 'rust-toolchain'
|
||||||
|
- 'crates/**'
|
||||||
|
- '!crates/ruff_dev'
|
||||||
|
- '!crates/ruff_shrinking'
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,41 @@ env:
|
||||||
PYTHON_VERSION: "3.11" # to build abi3 wheels
|
PYTHON_VERSION: "3.11" # to build abi3 wheels
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
determine_changes:
|
||||||
|
name: "Determine changes"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
linter: ${{ steps.linter.outputs.any_changed }}
|
||||||
|
formatter: ${{ steps.formatter.outputs.any_changed }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: tj-actions/changed-files@v37
|
||||||
|
id: linter
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
Cargo.toml
|
||||||
|
Cargo.lock
|
||||||
|
crates/**
|
||||||
|
!crates/ruff_python_formatter/**
|
||||||
|
!crates/ruff_formatter/**
|
||||||
|
!crates/ruff_dev/**
|
||||||
|
!crates/ruff_shrinking/**
|
||||||
|
|
||||||
|
- uses: tj-actions/changed-files@v37
|
||||||
|
id: formatter
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
Cargo.toml
|
||||||
|
Cargo.lock
|
||||||
|
crates/ruff_python_formatter/**
|
||||||
|
crates/ruff_formatter/**
|
||||||
|
crates/ruff_python_trivia/**
|
||||||
|
crates/ruff_python_ast/**
|
||||||
|
|
||||||
|
|
||||||
cargo-fmt:
|
cargo-fmt:
|
||||||
name: "cargo fmt"
|
name: "cargo fmt"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -137,9 +172,11 @@ jobs:
|
||||||
ecosystem:
|
ecosystem:
|
||||||
name: "ecosystem"
|
name: "ecosystem"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: cargo-test
|
needs:
|
||||||
|
- cargo-test
|
||||||
|
- determine_changes
|
||||||
# Only runs on pull requests, since that is the only we way we can find the base version for comparison.
|
# Only runs on pull requests, since that is the only we way we can find the base version for comparison.
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request' && needs.determine_changes.outputs.linter == 'true'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
|
|
@ -287,6 +324,8 @@ jobs:
|
||||||
check-formatter-stability:
|
check-formatter-stability:
|
||||||
name: "Check formatter stability"
|
name: "Check formatter stability"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: determine_changes
|
||||||
|
if: needs.determine_changes.outputs.formatter == 'true'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: "Install Rust toolchain"
|
- name: "Install Rust toolchain"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue