1
1
name : CI
2
2
3
- permissions : {}
3
+ permissions : { }
4
4
5
5
on :
6
6
push :
7
- branches : [main]
7
+ branches : [ main ]
8
8
pull_request :
9
9
workflow_dispatch :
10
10
@@ -26,74 +26,66 @@ jobs:
26
26
runs-on : ubuntu-latest
27
27
outputs :
28
28
# Flag that is raised when any code that affects parser is changed
29
- parser : " true "
29
+ parser : ${{ steps.check_parser.changed }}
30
30
# Flag that is raised when any code that affects linter is changed
31
- linter : " true "
31
+ linter : ${{ steps.check_linter.changed }}
32
32
# Flag that is raised when any code that affects formatter is changed
33
- formatter : " true "
33
+ formatter : ${{ steps.check_formatter.changed }}
34
34
# Flag that is raised when any code is changed
35
35
# This is superset of the linter and formatter
36
- code : " true "
36
+ code : ${{ steps.check_code.changed }}
37
37
# Flag that is raised when any code that affects the fuzzer is changed
38
- fuzz : " true "
38
+ fuzz : ${{ steps.check_fuzzer.changed }}
39
39
steps :
40
40
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
41
41
with :
42
42
fetch-depth : 0
43
43
persist-credentials : false
44
44
45
- # TODO: Replace with plain git command?
46
- # files_yaml: |
47
- # parser:
48
- # - Cargo.toml
49
- # - Cargo.lock
50
- # - crates/ruff_python_trivia/**
51
- # - crates/ruff_source_file/**
52
- # - crates/ruff_text_size/**
53
- # - crates/ruff_python_ast/**
54
- # - crates/ruff_python_parser/**
55
- # - python/py-fuzzer/**
56
- # - .github/workflows/ci.yaml
57
- #
58
- # linter:
59
- # - Cargo.toml
60
- # - Cargo.lock
61
- # - crates/**
62
- # - "!crates/red_knot*/**"
63
- # - "!crates/ruff_python_formatter/**"
64
- # - "!crates/ruff_formatter/**"
65
- # - "!crates/ruff_dev/**"
66
- # - scripts/*
67
- # - python/**
68
- # - .github/workflows/ci.yaml
69
- #
70
- # formatter:
71
- # - Cargo.toml
72
- # - Cargo.lock
73
- # - crates/ruff_python_formatter/**
74
- # - crates/ruff_formatter/**
75
- # - crates/ruff_python_trivia/**
76
- # - crates/ruff_python_ast/**
77
- # - crates/ruff_source_file/**
78
- # - crates/ruff_python_index/**
79
- # - crates/ruff_text_size/**
80
- # - crates/ruff_python_parser/**
81
- # - crates/ruff_dev/**
82
- # - scripts/*
83
- # - python/**
84
- # - .github/workflows/ci.yaml
85
- #
86
- # fuzz:
87
- # - fuzz/Cargo.toml
88
- # - fuzz/Cargo.lock
89
- # - fuzz/fuzz_targets/**
90
- #
91
- # code:
92
- # - "**/*"
93
- # - "!**/*.md"
94
- # - "crates/red_knot_python_semantic/resources/mdtest/**/*.md"
95
- # - "!docs/**"
96
- # - "!assets/**"
45
+ - name : Check if the parser code changed
46
+ id : check_parser
47
+ run : |
48
+ if git diff --quiet ${{ github.event.pull_request.base.sha || 'origin/main' }}...HEAD -- ':Cargo.toml' ':Cargo.lock' ':crates/ruff_python_trivia/**' ':crates/ruff_source_file/**' ':crates/ruff_text_size/**' ':crates/ruff_python_ast/**' ':crates/ruff_python_parser/**' ':python/py-fuzzer/**' '.github/workflows/ci.yaml'; then
49
+ echo "changed=false" >> "$GITHUB_OUTPUT"
50
+ else
51
+ echo "changed=true" >> "$GITHUB_OUTPUT"
52
+ fi
53
+
54
+ - name : Check if the linter code changed
55
+ id : check_linter
56
+ run : |
57
+ if git diff --quiet ${{ github.event.pull_request.base.sha || 'origin/main' }}...HEAD -- ':Cargo.toml' ':Cargo.lock' ':crates/**' ':!crates/red_knot*/**' ':!crates/ruff_python_formatter/**' ':!crates/ruff_formatter/**' ':!crates/ruff_dev/**' ':!crates/ruff_db/**' ':scripts/*' ':python/**' ':.github/workflows/ci.yaml'; then
58
+ echo "changed=false" >> "$GITHUB_OUTPUT"
59
+ else
60
+ echo "changed=true" >> "$GITHUB_OUTPUT"
61
+ fi
62
+
63
+ - name : Check if the formatter code changed
64
+ id : check_formatter
65
+ run : |
66
+ if git diff --quiet ${{ github.event.pull_request.base.sha || 'origin/main' }}...HEAD -- ':Cargo.toml' ':Cargo.lock' ':crates/ruff_python_formatter/**' ':crates/ruff_formatter/**' ':crates/ruff_python_trivia/**' ':crates/ruff_python_ast/**' ':crates/ruff_source_file/**' ':crates/ruff_python_index/**' ':crates/ruff_python_index/**' ':crates/ruff_text_size/**' ':crates/ruff_python_parser/**' ':scripts/*' ':python/**' ':.github/workflows/ci.yaml'; then
67
+ echo "changed=false" >> "$GITHUB_OUTPUT"
68
+ else
69
+ echo "changed=true" >> "$GITHUB_OUTPUT"
70
+ fi
71
+
72
+ - name : Check if the fuzzer code changed
73
+ id : check_fuzzer
74
+ run : |
75
+ if git diff --quiet ${{ github.event.pull_request.base.sha || 'origin/main' }}...HEAD -- ':Cargo.toml' ':Cargo.lock' ':fuzz/fuzz_targets/**'; then
76
+ echo "changed=false" >> "$GITHUB_OUTPUT"
77
+ else
78
+ echo "changed=true" >> "$GITHUB_OUTPUT"
79
+ fi
80
+
81
+ - name : Check if there was any code related change
82
+ id : check_code
83
+ run : |
84
+ if git diff --quiet ${{ github.event.pull_request.base.sha || 'origin/main' }}...HEAD -- ':**/*' ':!**/*.md' ':crates/red_knot_python_semantic/resources/mdtest/**/*.md' ':!docs/**' ':!assets/**; then
85
+ echo "changed=false" >> "$GITHUB_OUTPUT"
86
+ else
87
+ echo "changed=true" >> "$GITHUB_OUTPUT"
88
+ fi
97
89
98
90
cargo-fmt :
99
91
name : " cargo fmt"
0 commit comments