From 7fc5218e32fb6e4fcdb015d36fb428f58b8c3b7e Mon Sep 17 00:00:00 2001 From: Will Binns-Smith Date: Mon, 3 Jun 2024 09:40:38 -0700 Subject: [PATCH 1/7] Use ast-grep GitHub action and pin versions 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] https://github.com/vercel/turbo/pull/5637#issuecomment-1666751193 --- .github/workflows/turbopack-test.yml | 19 +++++++++++++++---- .github/workflows/turborepo-test.yml | 19 +++++++++++++++---- .vscode/extensions.json | 3 ++- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/.github/workflows/turbopack-test.yml b/.github/workflows/turbopack-test.yml index b5313e8d62acc..56007eb804997 100644 --- a/.github/workflows/turbopack-test.yml +++ b/.github/workflows/turbopack-test.yml @@ -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: wbinnssmith/action@wbinnssmith/paths-schema + with: + paths: ${{ env.GITHUB_TURBOPACK_PATHS }} + version: 0.23.0 + turbopack_rust_clippy: needs: [turbopack_rust_check] name: Turbopack rust clippy @@ -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' diff --git a/.github/workflows/turborepo-test.yml b/.github/workflows/turborepo-test.yml index c48db48e79eed..4b9687d1f555c 100644 --- a/.github/workflows/turborepo-test.yml +++ b/.github/workflows/turborepo-test.yml @@ -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: wbinnssmith/action@wbinnssmith/paths-schema + with: + paths: ${{ env.GITHUB_TURBOREPO_PATHS }} + version: 0.23.0 + rust_clippy: needs: [rust_check] name: Turborepo rust clippy @@ -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: diff --git a/.vscode/extensions.json b/.vscode/extensions.json index ad340c8680b83..4727b2583bd31 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -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" ] } From c0ded521f4fb74bfe94269d7f973d834374d821c Mon Sep 17 00:00:00 2001 From: Will Binns-Smith Date: Tue, 11 Jun 2024 15:45:36 -0700 Subject: [PATCH 2/7] fixup! Use ast-grep GitHub action and pin versions --- .github/workflows/turborepo-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/turborepo-test.yml b/.github/workflows/turborepo-test.yml index 4b9687d1f555c..d1af24e4d9b1e 100644 --- a/.github/workflows/turborepo-test.yml +++ b/.github/workflows/turborepo-test.yml @@ -323,6 +323,8 @@ jobs: run: echo "GITHUB_TURBOREPO_PATHS=$(cargo groups list turborepo | awk '{ print $2 }' | tr '\n' ' ')" >> $GITHUB_ENV - name: Checkout uses: actions/checkout@v4 + - name: TEST + run: echo "$GITHUB_TURBOREPO_PATHS" - name: ast-grep lint step uses: wbinnssmith/action@wbinnssmith/paths-schema with: From 9594177e96ce5b8d1d6655a5ed3c0ccda98fba1f Mon Sep 17 00:00:00 2001 From: Will Binns-Smith Date: Tue, 11 Jun 2024 15:53:52 -0700 Subject: [PATCH 3/7] fixup! Use ast-grep GitHub action and pin versions --- .github/workflows/turborepo-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/turborepo-test.yml b/.github/workflows/turborepo-test.yml index d1af24e4d9b1e..3e887f0b8be21 100644 --- a/.github/workflows/turborepo-test.yml +++ b/.github/workflows/turborepo-test.yml @@ -328,7 +328,7 @@ jobs: - name: ast-grep lint step uses: wbinnssmith/action@wbinnssmith/paths-schema with: - paths: ${{ env.GITHUB_TURBOREPO_PATHS }} + paths: crates version: 0.23.0 rust_clippy: From d7805847a9494937e0cd66e84f2587e54577f0fb Mon Sep 17 00:00:00 2001 From: Will Binns-Smith Date: Tue, 11 Jun 2024 16:01:27 -0700 Subject: [PATCH 4/7] fixup! Use ast-grep GitHub action and pin versions --- .github/workflows/turborepo-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/turborepo-test.yml b/.github/workflows/turborepo-test.yml index 3e887f0b8be21..0533ece37ef3c 100644 --- a/.github/workflows/turborepo-test.yml +++ b/.github/workflows/turborepo-test.yml @@ -329,6 +329,7 @@ jobs: uses: wbinnssmith/action@wbinnssmith/paths-schema with: paths: crates + config: sgconfig.yml version: 0.23.0 rust_clippy: From 1b7a1b038db86c7d4fcf38739107d5374acd1007 Mon Sep 17 00:00:00 2001 From: Will Binns-Smith Date: Tue, 11 Jun 2024 17:36:35 -0700 Subject: [PATCH 5/7] fixup! Use ast-grep GitHub action and pin versions --- .github/workflows/turbopack-test.yml | 3 ++- .github/workflows/turborepo-test.yml | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/turbopack-test.yml b/.github/workflows/turbopack-test.yml index 56007eb804997..7bd642d81cb7d 100644 --- a/.github/workflows/turbopack-test.yml +++ b/.github/workflows/turbopack-test.yml @@ -206,6 +206,7 @@ jobs: # From https://github.com/ast-grep/action/tree/v1.5/?tab=readme-ov-file#inputs ast_grep_lint: + needs: [turbopack_rust_check] runs-on: ubuntu-latest name: Turbopack ast-grep lint steps: @@ -214,7 +215,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: ast-grep lint step - uses: wbinnssmith/action@wbinnssmith/paths-schema + uses: wbinnssmith/action@wbinnssmith/npm-build with: paths: ${{ env.GITHUB_TURBOPACK_PATHS }} version: 0.23.0 diff --git a/.github/workflows/turborepo-test.yml b/.github/workflows/turborepo-test.yml index 0533ece37ef3c..ffebca5a2041d 100644 --- a/.github/workflows/turborepo-test.yml +++ b/.github/workflows/turborepo-test.yml @@ -316,6 +316,7 @@ jobs: # From https://github.com/ast-grep/action/tree/v1.5/?tab=readme-ov-file#inputs ast_grep_lint: + needs: [rust_check] runs-on: ubuntu-latest name: Turborepo ast-grep lint steps: @@ -323,12 +324,10 @@ jobs: run: echo "GITHUB_TURBOREPO_PATHS=$(cargo groups list turborepo | awk '{ print $2 }' | tr '\n' ' ')" >> $GITHUB_ENV - name: Checkout uses: actions/checkout@v4 - - name: TEST - run: echo "$GITHUB_TURBOREPO_PATHS" - name: ast-grep lint step - uses: wbinnssmith/action@wbinnssmith/paths-schema + uses: wbinnssmith/action@wbinnssmith/npm-build with: - paths: crates + paths: ${{ env.GITHUB_TURBOPACK_PATHS }} config: sgconfig.yml version: 0.23.0 From 37f7203ef17442845b00b51748c3a86affe8191a Mon Sep 17 00:00:00 2001 From: Will Binns-Smith Date: Tue, 11 Jun 2024 17:54:59 -0700 Subject: [PATCH 6/7] fixup! Use ast-grep GitHub action and pin versions --- .github/workflows/turbopack-test.yml | 7 +++++++ .github/workflows/turborepo-test.yml | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/.github/workflows/turbopack-test.yml b/.github/workflows/turbopack-test.yml index 7bd642d81cb7d..79f27b811fdef 100644 --- a/.github/workflows/turbopack-test.yml +++ b/.github/workflows/turbopack-test.yml @@ -210,6 +210,13 @@ jobs: runs-on: ubuntu-latest name: Turbopack ast-grep lint steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Rust + uses: ./.github/actions/setup-rust + with: + targets: wasm32-unknown-unknown + github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Set turbopack paths run: echo "GITHUB_TURBOPACK_PATHS=$(cargo groups list turbopack | awk '{ print $2 }' | tr '\n' ' ')" >> $GITHUB_ENV - name: Checkout diff --git a/.github/workflows/turborepo-test.yml b/.github/workflows/turborepo-test.yml index ffebca5a2041d..573d18cabb828 100644 --- a/.github/workflows/turborepo-test.yml +++ b/.github/workflows/turborepo-test.yml @@ -320,6 +320,12 @@ jobs: runs-on: ubuntu-latest name: Turborepo ast-grep lint steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Turborepo Environment + uses: ./.github/actions/setup-turborepo-environment + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Set turborepo paths run: echo "GITHUB_TURBOREPO_PATHS=$(cargo groups list turborepo | awk '{ print $2 }' | tr '\n' ' ')" >> $GITHUB_ENV - name: Checkout From 701bc008e12c838c379491d6f9416ffda6114cf7 Mon Sep 17 00:00:00 2001 From: Will Binns-Smith Date: Wed, 12 Jun 2024 10:59:53 -0700 Subject: [PATCH 7/7] fixup! Use ast-grep GitHub action and pin versions --- .github/workflows/turborepo-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/turborepo-test.yml b/.github/workflows/turborepo-test.yml index 573d18cabb828..6453addc02a5f 100644 --- a/.github/workflows/turborepo-test.yml +++ b/.github/workflows/turborepo-test.yml @@ -334,7 +334,6 @@ jobs: uses: wbinnssmith/action@wbinnssmith/npm-build with: paths: ${{ env.GITHUB_TURBOPACK_PATHS }} - config: sgconfig.yml version: 0.23.0 rust_clippy: