From 38330468e53437b49ba8dbf98ed1c709e5212da0 Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Mon, 27 Nov 2023 20:12:24 +0000 Subject: [PATCH] Ensure CI buildPython has different micro versions to the runtime --- .github/actions/setup-python/action.yml | 32 ++++++++----------- .github/workflows/ci.yml | 25 ++++----------- product/gradle-plugin/README.md | 4 +-- .../test/integration/test_gradle_plugin.py | 2 +- 4 files changed, 24 insertions(+), 39 deletions(-) diff --git a/.github/actions/setup-python/action.yml b/.github/actions/setup-python/action.yml index e34e40ae46..d9141373ad 100644 --- a/.github/actions/setup-python/action.yml +++ b/.github/actions/setup-python/action.yml @@ -1,30 +1,26 @@ name: Setup Python description: -inputs: - extra-versions: - description: | - Additional versions to install, on top of the supported runtime versions. One - version per line, in the same syntax as the standard setup-python action. - runs: using: composite steps: - - name: List runtime versions - id: runtime-versions - shell: bash - run: | - ( - echo "versions<> $GITHUB_OUTPUT - - uses: actions/setup-python@v4.6.1 with: + # This should include all major.minor versions supported by the runtime, plus + # OLD_BUILD_PYTHON_VERSION, MIN_BUILD_PYTHON_VERSION and + # MAX_BUILD_PYTHON_VERSION from test_gradle_plugin. + # + # However, the micro versions should be different to those used by the runtime, + # because that's required by the integration tests `requires_python` and + # `marker_python_version`. python-version: | - ${{ steps.runtime-versions.outputs.versions }} - ${{ inputs.extra-versions }} + 3.6.15 + 3.7.17 + 3.8.17 + 3.9.17 + 3.10.12 + 3.11.6 + 3.12.0 - name: Set default Python command id: python-default diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8db1d5fd35..69e5b2e43b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ defaults: jobs: product: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: smorimoto/tune-github-hosted-runner-network@v1 - uses: actions/checkout@v3.5.3 @@ -72,7 +72,7 @@ jobs: docs: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: smorimoto/tune-github-hosted-runner-network@v1 - uses: actions/checkout@v3.5.3 @@ -103,15 +103,12 @@ jobs: gradlePython: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: smorimoto/tune-github-hosted-runner-network@v1 - uses: actions/checkout@v3.5.3 - - uses: actions/setup-python@v4.6.1 - with: - # MIN_BUILD_PYTHON_VERSION from test_gradle_plugin - python-version: 3.7 + - uses: ./.github/actions/setup-python - uses: ./.github/actions/create-local-properties @@ -123,7 +120,7 @@ jobs: demo: needs: [product] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: smorimoto/tune-github-hosted-runner-network@v1 - uses: actions/checkout@v3.5.3 @@ -163,9 +160,8 @@ jobs: agp-version: ${{ fromJSON(needs.product.outputs.agp-versions) }} os: [linux, macos, windows] include: - # We pin specific OS versions to ensure that the Python `extra-versions` - # listed below are all available. To avoid clutter in the GitHub UI, OS - # versions are not added to the `os` dimension directly. + # To avoid clutter in the GitHub UI, OS versions are not added to the `os` + # dimension directly. - os: linux runs-on: ubuntu-20.04 - os: macos @@ -180,13 +176,6 @@ jobs: - uses: ./.github/actions/setup-python id: setup-python - with: - # This should include OLD_BUILD_PYTHON_VERSION, MIN_BUILD_PYTHON_VERSION and - # MAX_BUILD_PYTHON_VERSION from test_gradle_plugin, if they're not already - # returned by `list-versions.py --minor`. - extra-versions: | - 3.6 - 3.7 - name: Download Maven repository uses: actions/download-artifact@v3.0.2 diff --git a/product/gradle-plugin/README.md b/product/gradle-plugin/README.md index 3af390f02a..b9d7865b28 100644 --- a/product/gradle-plugin/README.md +++ b/product/gradle-plugin/README.md @@ -95,6 +95,7 @@ After stable release: * Update `MAX_BUILD_PYTHON_VERSION` in test_gradle_plugin.py, and run the tests which use it. +* Update the list of Python versions in .github/actions/setup-python/action.yml. * Build the demo app with the new version, and check for any warnings other than the expected ones about .pyc compilation. @@ -105,8 +106,7 @@ After stable release: * Update `testPython` in gradle-plugin/build.gradle, and run the tests. * In test_gradle_plugin, update `OLD_BUILD_PYTHON_VERSION` and `MIN_BUILD_PYTHON_VERSION`, and run the tests which use them. -* Check references to `OLD_BUILD_PYTHON_VERSION` and `MIN_BUILD_PYTHON_VERSION` in - ci.yml. +* Update the list of Python versions in .github/actions/setup-python/action.yml. * Update android.rst. diff --git a/product/gradle-plugin/src/test/integration/test_gradle_plugin.py b/product/gradle-plugin/src/test/integration/test_gradle_plugin.py index 1013f3577c..e490d223ea 100644 --- a/product/gradle-plugin/src/test/integration/test_gradle_plugin.py +++ b/product/gradle-plugin/src/test/integration/test_gradle_plugin.py @@ -65,7 +65,7 @@ def list_versions(mode): .split()[1]) BUILD_PYTHON_VERSION = BUILD_PYTHON_VERSION_FULL.rpartition(".")[0] -# When updating these, consider also updating extra-versions in ci.yml. +# When updating these, consider also updating .github/actions/setup-python/action.yml. OLD_BUILD_PYTHON_VERSION = "3.6" MIN_BUILD_PYTHON_VERSION = "3.7" MAX_BUILD_PYTHON_VERSION = "3.12"