Skip to content

Commit de54149

Browse files
committed
ci: add dedicated lint job and buildifier config
- Add separate lint job that runs before tests - Check formatting and warn about common issues early - Add .buildifier.json config to make lint settings explicit - Remove duplicate formatting check from test job - Lint job will fail fast on formatting issues
1 parent 19b416d commit de54149

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

.buildifier.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": 4,
3+
"lint": {
4+
"mode": "warn",
5+
"warnings": [
6+
"+load",
7+
"+load-on-top",
8+
"+out-of-order-load",
9+
"+unused-variable",
10+
"+function-docstring",
11+
"+function-docstring-args",
12+
"+print"
13+
]
14+
}
15+
}

.github/workflows/ci.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,34 @@ env:
1010
BAZEL_VERSION: 8.3.1
1111

1212
jobs:
13+
lint:
14+
name: Lint and Format Check
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Install Bazelisk
21+
run: |
22+
curl -LO https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64
23+
chmod +x bazelisk-linux-amd64
24+
sudo mv bazelisk-linux-amd64 /usr/local/bin/bazel
25+
26+
- name: Check Buildifier Formatting
27+
run: |
28+
echo "Checking Bazel file formatting..."
29+
bazel run //:buildifier -- --lint=warn --mode=check -r .
30+
31+
- name: Check for Unused Dependencies
32+
run: |
33+
echo "Checking for unused dependencies in BUILD files..."
34+
# This will warn about unused deps but not fail the build
35+
bazel run //:buildifier -- --lint=warn --warnings=load -r . || true
36+
1337
test:
1438
name: Test on ${{ matrix.os }}
1539
runs-on: ${{ matrix.os }}
40+
needs: lint # Run tests only after lint passes
1641
strategy:
1742
matrix:
1843
os: [ubuntu-latest, macos-latest]
@@ -84,10 +109,6 @@ jobs:
84109
# Check that WASM files are valid
85110
bazel build //examples/basic:hello_component
86111
wasm-tools validate bazel-bin/examples/basic/hello_component.wasm || true
87-
88-
- name: Check Formatting
89-
run: |
90-
bazel run //:buildifier -- --lint=warn --mode=check -r .
91112
92113
integration:
93114
name: Integration Tests

0 commit comments

Comments
 (0)