Skip to content

Commit 1d9a9fe

Browse files
author
Paolo Tranquilli
committed
CI: fix rust formatting
`cargo fmt --all` should be avoided in CI as that will include `rust/ast-generator` which has sources provided by bazel (`bazel run //rust/ast-generator:inject_sources` can provide those sources in-tree). Now the formatting checks are limited to the sources that trigger the jobs, and a check is added to `rust/ast-generator`.
1 parent b392391 commit 1d9a9fe

File tree

4 files changed

+32
-8
lines changed

4 files changed

+32
-8
lines changed

.github/workflows/ql-for-ql-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
ql/target
4141
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/rust-toolchain.toml', 'ql/**/Cargo.lock') }}
4242
- name: Check formatting
43-
run: cd ql; cargo fmt --all -- --check
43+
run: cd ql; cargo fmt -- --check
4444
- name: Build extractor
4545
run: |
4646
cd ql;

.github/workflows/ruby-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-rust-cargo-${{ hashFiles('ruby/extractor/rust-toolchain.toml', 'ruby/extractor/**/Cargo.lock') }}
8080
- name: Check formatting
8181
if: steps.cache-extractor.outputs.cache-hit != 'true'
82-
run: cd extractor && cargo fmt --all -- --check
82+
run: cd extractor && cargo fmt -- --check
8383
- name: Build
8484
if: steps.cache-extractor.outputs.cache-hit != 'true'
8585
run: cd extractor && cargo build --verbose

.github/workflows/rust.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,46 @@ permissions:
2323
contents: read
2424

2525
jobs:
26-
rust-code:
26+
rust-ast-generator:
2727
runs-on: ubuntu-latest
28+
defaults:
29+
run:
30+
working-directory: rust/ast-generator
2831
steps:
2932
- name: Checkout
3033
uses: actions/checkout@v4
34+
- name: Inject sources
35+
shell: bash
36+
run: |
37+
bazel run //rust/ast-generator:inject_sources
3138
- name: Format
32-
working-directory: rust/extractor
3339
shell: bash
3440
run: |
3541
cargo fmt --check
3642
- name: Compilation
37-
working-directory: rust/extractor
3843
shell: bash
3944
run: cargo check
4045
- name: Clippy
46+
shell: bash
47+
run: |
48+
cargo clippy --fix
49+
git diff --exit-code
50+
rust-code:
51+
runs-on: ubuntu-latest
52+
defaults:
53+
run:
4154
working-directory: rust/extractor
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@v4
58+
- name: Format
59+
shell: bash
60+
run: |
61+
cargo fmt --check
62+
- name: Compilation
63+
shell: bash
64+
run: cargo check
65+
- name: Clippy
4266
shell: bash
4367
run: |
4468
cargo clippy --fix

.github/workflows/tree-sitter-extractor-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ jobs:
3232
steps:
3333
- uses: actions/checkout@v4
3434
- name: Check formatting
35-
run: cargo fmt --all -- --check
35+
run: cargo fmt -- --check
3636
- name: Run tests
3737
run: cargo test --verbose
3838
fmt:
39-
runs-on: ubuntu-latest
39+
runs-on: ubuntu-latest
4040
steps:
4141
- uses: actions/checkout@v4
4242
- name: Check formatting
4343
run: cargo fmt --check
4444
clippy:
45-
runs-on: ubuntu-latest
45+
runs-on: ubuntu-latest
4646
steps:
4747
- uses: actions/checkout@v4
4848
- name: Run clippy

0 commit comments

Comments
 (0)