diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bdf452b8bcc..04983981966 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,14 +26,48 @@ env: # - rustpython-compiler-source: deprecated # - rustpython-venvlauncher: Windows-only WORKSPACE_EXCLUDES: --exclude rustpython_wasm --exclude rustpython-compiler-source --exclude rustpython-venvlauncher - # Python version targeted by the CI. - PYTHON_VERSION: "3.14.3" X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR: C:\Program Files\OpenSSL\lib\VC\x64\MD X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR: C:\Program Files\OpenSSL\include CARGO_INCREMENTAL: 0 CARGO_TERM_COLOR: always 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" -- \ + ':!Lib/**' \ + ':!scripts/**' \ + ':!extra_tests/**' \ + ':.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: @@ -111,9 +145,13 @@ 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' strategy: matrix: include: @@ -259,8 +297,6 @@ jobs: save-if: ${{ github.ref == 'refs/heads/main' }} - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - name: Install macOS dependencies uses: ./.github/actions/install-macos-deps @@ -362,8 +398,6 @@ jobs: persist-credentials: false - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - uses: dtolnay/rust-toolchain@stable with: @@ -469,8 +503,6 @@ jobs: tar -xzf geckodriver-v0.36.0-linux64.tar.gz -C geckodriver - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - run: python -m pip install -r requirements.txt working-directory: ./wasm/tests diff --git a/.github/workflows/cron-ci.yaml b/.github/workflows/cron-ci.yaml index a481e71de06..2e648e12cb7 100644 --- a/.github/workflows/cron-ci.yaml +++ b/.github/workflows/cron-ci.yaml @@ -13,7 +13,6 @@ name: Periodic checks/tasks env: CARGO_ARGS: --no-default-features --features stdlib,importlib,stdio,encodings,ssl-rustls,jit,host_env - PYTHON_VERSION: "3.14.3" jobs: # codecov collects code coverage data from the rust tests, python snippets and python test suite. @@ -30,9 +29,9 @@ jobs: - uses: dtolnay/rust-toolchain@stable - uses: taiki-e/install-action@cargo-llvm-cov - - uses: actions/setup-python@v6.2.0 - with: - python-version: ${{ env.PYTHON_VERSION }} + + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + - run: sudo apt-get update && sudo apt-get -y install lcov - name: Run cargo-llvm-cov with Rust tests. run: cargo llvm-cov --no-report --workspace --exclude rustpython_wasm --exclude rustpython-compiler-source --exclude rustpython-venvlauncher --verbose --no-default-features --features stdlib,importlib,stdio,encodings,ssl-rustls,jit,host_env @@ -96,9 +95,9 @@ jobs: persist-credentials: true - uses: dtolnay/rust-toolchain@stable - - uses: actions/setup-python@v6.2.0 - with: - python-version: ${{ env.PYTHON_VERSION }} + + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + - name: build rustpython run: cargo build --release --verbose - name: Collect what is left data @@ -157,9 +156,9 @@ jobs: persist-credentials: true - uses: dtolnay/rust-toolchain@stable - - uses: actions/setup-python@v6.2.0 - with: - python-version: ${{ env.PYTHON_VERSION }} + + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + - run: cargo install cargo-criterion - name: build benchmarks run: cargo build --release --benches diff --git a/.github/workflows/lib-deps-check.yaml b/.github/workflows/lib-deps-check.yaml index 1b0caea6759..b009c427df7 100644 --- a/.github/workflows/lib-deps-check.yaml +++ b/.github/workflows/lib-deps-check.yaml @@ -10,9 +10,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number }} cancel-in-progress: true -env: - PYTHON_VERSION: "3.14.3" - jobs: check_deps: permissions: @@ -37,9 +34,20 @@ jobs: # Checkout only Lib/ directory from PR head for accurate comparison git checkout ${{ github.event.pull_request.head.sha }} -- Lib/ - - name: Checkout CPython + - name: Get target CPython version + id: cpython-version run: | - git clone --depth 1 --branch "v${{ env.PYTHON_VERSION }}" https://github.com/python/cpython.git cpython + version=$(cat .python-version) + echo "version=${version}" >> "$GITHUB_OUTPUT" + + - name: Checkout CPython + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + repository: python/cpython + path: cpython + ref: "v${{ steps.cpython-version.outputs.version }}" + fetch-depth: 1 + persist-credentials: false - name: Get changed Lib files id: changed-files @@ -75,8 +83,6 @@ jobs: - name: Setup Python if: steps.changed-files.outputs.modules != '' uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - with: - python-version: "${{ env.PYTHON_VERSION }}" - name: Run deps check if: steps.changed-files.outputs.modules != '' diff --git a/.github/workflows/update-libs-status.yaml b/.github/workflows/update-libs-status.yaml index 53685f88474..db32c7a3e94 100644 --- a/.github/workflows/update-libs-status.yaml +++ b/.github/workflows/update-libs-status.yaml @@ -13,7 +13,6 @@ permissions: issues: write env: - PYTHON_VERSION: "v3.14.3" ISSUE_ID: "6839" jobs: @@ -29,13 +28,20 @@ jobs: sparse-checkout: |- Lib scripts/update_lib + .python-version - - name: Clone CPython ${{ env.PYTHON_VERSION }} + - name: Get target CPython version + id: cpython-version + run: | + version=$(cat rustpython/.python-version) + echo "version=${version}" >> "$GITHUB_OUTPUT" + + - name: Clone CPython uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: repository: python/cpython path: cpython - ref: ${{ env.PYTHON_VERSION }} + ref: "v${{ steps.cpython-version.outputs.version }}" persist-credentials: false sparse-checkout: | Lib @@ -56,14 +62,14 @@ jobs: ## Summary - Check \`scripts/update_lib\` for tools. As a note, the current latest Python version is \`${{ env.PYTHON_VERSION }}\`. + Check \`scripts/update_lib\` for tools. As a note, the current latest Python version is \`${{ steps.cpython-version.outputs.version }}\`. Previous versions' issues as reference - 3.13: #5529