Skip to content

Commit

Permalink
Use ast-grep GitHub action and pin versions
Browse files Browse the repository at this point in the history
This uses the official ast-grep GitHub Action [0] instead of installing it from npm in the clippy job.

Thanks for the suggestion from @HerringtonDarkholme!

[0] https://github.com/ast-grep/action
[1] #5637 (comment)
  • Loading branch information
wbinnssmith committed Jun 11, 2024
1 parent f0d4768 commit cbafe93
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/turbopack-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,21 @@ jobs:
run: |
CARGO_BUILD_TARGET="wasm32-wasip1-threads" RUSTFLAGS="-D warnings -A deprecated" cargo groups check turbopack-wasi --release
# From https://github.com/ast-grep/action/tree/v1.5/?tab=readme-ov-file#inputs
ast_grep_lint:
runs-on: ubuntu-latest
name: Turbopack ast-grep lint
steps:
- name: Set turbopack paths
run: echo "GITHUB_TURBOPACK_PATHS=$(cargo groups list turbopack | awk '{ print $2 }' | tr '\n' ' ')" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: ast-grep lint step
uses: ast-grep/action@v1.5
with:
paths: ${{ env.GITHUB_TURBOPACK_PATHS }}
version: 0.23.0

turbopack_rust_clippy:
needs: [turbopack_rust_check]
name: Turbopack rust clippy
Expand All @@ -226,10 +241,6 @@ jobs:
run: |
RUSTFLAGS="-D warnings -A deprecated" cargo groups clippy turbopack --features rustls-tls
- name: Run ast-grep lints
run: |
npx --package @ast-grep/cli -- ast-grep scan $(cargo groups list turbopack | awk '{ print $2 }' | tr '\n' ' ')
next_dev_check:
needs: [determine_jobs]
if: needs.determine_jobs.outputs.turbopack == 'true' || needs.determine_jobs.outputs.cargo_on_main == 'true'
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/turborepo-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,21 @@ jobs:
run: |
cargo groups check turborepo-libraries --features rustls-tls
# From https://github.com/ast-grep/action/tree/v1.5/?tab=readme-ov-file#inputs
ast_grep_lint:
runs-on: ubuntu-latest
name: Turborepo ast-grep lint
steps:
- name: Set turborepo paths
run: echo "GITHUB_TURBOREPO_PATHS=$(cargo groups list turborepo | awk '{ print $2 }' | tr '\n' ' ')" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: ast-grep lint step
uses: ast-grep/action@v1.5
with:
paths: ${{ env.GITHUB_TURBOREPO_PATHS }}
version: 0.23.0

rust_clippy:
needs: [rust_check]
name: Turborepo rust clippy
Expand All @@ -335,10 +350,6 @@ jobs:
run: |
cargo groups clippy turborepo-libraries --features rustls-tls -- --deny clippy::all
- name: Run ast-grep lints
run: |
npx --package @ast-grep/cli -- ast-grep scan $(cargo groups list turborepo-libraries | awk '{ print $2 }' | tr '\n' ' ')
rust_test:
needs: [rust_check]
strategy:
Expand Down
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"windmilleng.vscode-go-autotest",
"yzhang.markdown-all-in-one",
"zxh404.vscode-proto3",
"mihaipopescu.Cram"
"mihaipopescu.Cram",
"ast-grep.ast-grep-vscode"
]
}

0 comments on commit cbafe93

Please sign in to comment.