Skip to content

Commit cdd033c

Browse files
authored
ci: Separarate py/lint workflows (#2814)
Signed-off-by: Ryan Northey <[email protected]>
1 parent ead162c commit cdd033c

File tree

4 files changed

+45
-32
lines changed

4 files changed

+45
-32
lines changed

.github/workflows/lint.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
branches:
9+
- "main"
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
lint:
16+
runs-on: ubuntu-24.04
17+
steps:
18+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
20+
with:
21+
python-version: "3.13"
22+
- run: pip install --require-hashes -r .github/workflows/requirements.txt
23+
- run: |
24+
envoy.code.check . -c glint shellcheck yamllint -x ".*/dist/.*" -x "rust/glint/tests/fixtures/.*.txt"

.github/workflows/ci.yml renamed to .github/workflows/py.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Python
22

33
on:
44
push:
@@ -10,7 +10,7 @@ on:
1010
- "**/BUILD"
1111
- "**/BUILD.pyi"
1212
- "**/BUILD.tools"
13-
- ".github/workflows/ci.yml"
13+
- ".github/workflows/py.yml"
1414
- "pants.toml"
1515
- "pants.ci.toml"
1616
- ".coveragerc"
@@ -39,7 +39,7 @@ on:
3939
- "**/BUILD"
4040
- "**/BUILD.pyi"
4141
- "**/BUILD.tools"
42-
- ".github/workflows/ci.yml"
42+
- ".github/workflows/py.yml"
4343
- "pants.toml"
4444
- "pants.ci.toml"
4545
- ".coveragerc"
@@ -103,17 +103,6 @@ jobs:
103103
- name: Run pants lint
104104
run: "pants --colors lint ::"
105105

106-
lint-envoy:
107-
runs-on: ubuntu-24.04
108-
steps:
109-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
110-
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
111-
with:
112-
python-version: "3.11"
113-
- run: pip install --require-hashes -r .github/workflows/requirements.txt
114-
- run: |
115-
envoy.code.check . -c glint shellcheck yamllint -x ".*/dist/.*"
116-
117106
typecheck:
118107
runs-on: ubuntu-24.04
119108
steps:

rust/glint/tests/fixtures/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This directory contains test files and their expected outputs.
44

55
## Test Files:
66
- `bad.txt` - 50 lines with all types of issues (trailing whitespace, mixed indentation, no final newline)
7-
- `bad2.txt` - 7 lines with all types of issues
7+
- `bad2.txt` - 7 lines with all types of issues
88
- `bad3.txt` - 7 lines with only trailing whitespace issues
99
- `good.txt` - Clean file with no issues
1010

rust/glint/tests/integration_test.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,46 @@ fn run_glint_test(fixture_name: &str, expect_success: bool) {
88
cmd.arg("run");
99
cmd.arg("--quiet");
1010
cmd.arg("--");
11-
11+
1212
// Get the path to the test fixture
1313
let fixture_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
1414
.join("tests")
1515
.join("fixtures")
1616
.join(fixture_name);
17-
17+
1818
cmd.arg(&fixture_path);
19-
19+
2020
let output = cmd.output().expect("Failed to execute glint");
21-
21+
2222
// Check exit code
2323
if expect_success {
24-
assert!(output.status.success(),
25-
"Expected glint to exit with zero status for {}, got {:?}",
24+
assert!(output.status.success(),
25+
"Expected glint to exit with zero status for {}, got {:?}",
2626
fixture_name, output.status.code());
2727
} else {
28-
assert!(!output.status.success(),
28+
assert!(!output.status.success(),
2929
"Expected glint to exit with non-zero status for {}", fixture_name);
30-
assert_eq!(output.status.code(), Some(1),
30+
assert_eq!(output.status.code(), Some(1),
3131
"Expected exit code 1 for {}", fixture_name);
3232
}
33-
33+
3434
// Parse the actual JSON output
3535
let stdout = String::from_utf8_lossy(&output.stdout);
3636
let actual_json: Value = serde_json::from_str(&stdout)
3737
.expect(&format!("Failed to parse JSON output for {}: {}", fixture_name, stdout));
38-
38+
3939
// Load expected JSON
4040
let expected_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
4141
.join("tests")
4242
.join("fixtures")
4343
.join(format!("{}.expected.json", fixture_name));
44-
44+
4545
let expected_content = fs::read_to_string(&expected_path)
4646
.expect(&format!("Failed to read expected file: {:?}", expected_path));
47-
47+
4848
let mut expected_json: Value = serde_json::from_str(&expected_content)
4949
.expect(&format!("Failed to parse expected JSON for {}", fixture_name));
50-
50+
5151
// Normalize file paths in expected JSON to match actual output
5252
if let Some(files) = expected_json.get_mut("files").and_then(|f| f.as_object_mut()) {
5353
let mut normalized_files = serde_json::Map::new();
@@ -61,11 +61,11 @@ fn run_glint_test(fixture_name: &str, expect_success: bool) {
6161
}
6262
*files = normalized_files;
6363
}
64-
64+
6565
// Compare JSON
66-
assert_eq!(actual_json, expected_json,
67-
"JSON output mismatch for {}.\nActual:\n{}\nExpected:\n{}",
68-
fixture_name,
66+
assert_eq!(actual_json, expected_json,
67+
"JSON output mismatch for {}.\nActual:\n{}\nExpected:\n{}",
68+
fixture_name,
6969
serde_json::to_string_pretty(&actual_json).unwrap(),
7070
serde_json::to_string_pretty(&expected_json).unwrap());
7171
}

0 commit comments

Comments
 (0)