From ccd803e6df83d2fde02fb89c428221dba8b90867 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 9 Apr 2026 12:58:51 +0200 Subject: [PATCH 1/6] Only run `cargo check` when rust code is changed --- .github/workflows/ci.yaml | 45 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 87c59734af4..098253d5f99 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,6 +36,43 @@ env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true # TODO: Remove on 2026/06/02 jobs: + determine_changes: + name: Determine changes + runs-on: ubuntu-latest + outputs: + # Flag that is raised when any rust code is changed. + rust_code: ${{ steps.check_rust_code.outputs.changed }} + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Determine merge base + id: merge_base + run: | + sha=$(git merge-base HEAD "origin/${BASE_REF}") + echo "sha=${sha}" >> "$GITHUB_OUTPUT" + env: + BASE_REF: ${{ github.event.pull_request.base.ref || 'main' }} + + - name: Check if there was any code related change + id: check_rust_code + run: | + if git diff --quiet "${MERGE_BASE}...HEAD" -- \ + ':Cargo.toml' \ + ':Cargo.lock' \ + ':crates/**' \ + ':src/**' \ + ':.github/workflows/ci.yaml' \ + ; then + echo "changed=false" >> "$GITHUB_OUTPUT" + else + echo "changed=true" >> "$GITHUB_OUTPUT" + fi + env: + MERGE_BASE: ${{ steps.merge_base.outputs.sha }} + rust_tests: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} env: @@ -120,9 +157,15 @@ jobs: if: runner.os == 'Linux' cargo_check: - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} name: cargo check runs-on: ${{ matrix.os }} + needs: + - determine_changes + if: | + ( + !contains(github.event.pull_request.labels.*.name, 'skip:ci') && + needs.determine_changes.outputs.rust_code == 'true' + ) || github.ref == 'refs/heads/main' strategy: matrix: include: From 1f23cc33f594d1d7da8c4ca0971d0d50780a5e5b Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Sat, 2 May 2026 13:04:09 +0300 Subject: [PATCH 2/6] Test --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 098253d5f99..5989e3c0d07 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -64,7 +64,6 @@ jobs: ':Cargo.lock' \ ':crates/**' \ ':src/**' \ - ':.github/workflows/ci.yaml' \ ; then echo "changed=false" >> "$GITHUB_OUTPUT" else From 50a51d5e56c25b652749726e6d2b3c8815aeb64f Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Sat, 2 May 2026 13:06:05 +0300 Subject: [PATCH 3/6] Another test --- src/interpreter.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/interpreter.rs b/src/interpreter.rs index b9ee2dbbc44..5d1feb3460e 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -13,6 +13,7 @@ impl InterpreterBuilderExt for InterpreterBuilder { #[cfg(feature = "stdlib")] fn init_stdlib(self) -> Self { let defs = rustpython_stdlib::stdlib_module_defs(&self.ctx); + let builder = self.add_native_modules(&defs); #[cfg(feature = "freeze-stdlib")] From 906435b25ccd71fb6b622ee37e622d5de55ee421 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Sat, 2 May 2026 13:08:28 +0300 Subject: [PATCH 4/6] Revert "Test" This reverts commit 1f23cc33f594d1d7da8c4ca0971d0d50780a5e5b. --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5989e3c0d07..098253d5f99 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -64,6 +64,7 @@ jobs: ':Cargo.lock' \ ':crates/**' \ ':src/**' \ + ':.github/workflows/ci.yaml' \ ; then echo "changed=false" >> "$GITHUB_OUTPUT" else From fbc65821ec7858cd7661b2c1f9cd8da5545cea01 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Sat, 2 May 2026 13:08:32 +0300 Subject: [PATCH 5/6] Revert "Another test" This reverts commit 50a51d5e56c25b652749726e6d2b3c8815aeb64f. --- src/interpreter.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/interpreter.rs b/src/interpreter.rs index 5d1feb3460e..b9ee2dbbc44 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -13,7 +13,6 @@ impl InterpreterBuilderExt for InterpreterBuilder { #[cfg(feature = "stdlib")] fn init_stdlib(self) -> Self { let defs = rustpython_stdlib::stdlib_module_defs(&self.ctx); - let builder = self.add_native_modules(&defs); #[cfg(feature = "freeze-stdlib")] From 1c7f1bc3983f95e299b85431c4134f513ac16d0e Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Sat, 2 May 2026 13:29:49 +0300 Subject: [PATCH 6/6] Add extra rust related files --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 098253d5f99..f9d7fc3bce5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -62,6 +62,8 @@ jobs: if git diff --quiet "${MERGE_BASE}...HEAD" -- \ ':Cargo.toml' \ ':Cargo.lock' \ + ':rust-toolchain.toml' \ + ':.cargo/config.toml' \ ':crates/**' \ ':src/**' \ ':.github/workflows/ci.yaml' \