Skip to content

Commit

Permalink
Ensure CI buildPython has different micro versions to the runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsmith committed Nov 27, 2023
1 parent 8b07806 commit 31875a6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 39 deletions.
34 changes: 16 additions & 18 deletions .github/actions/setup-python/action.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
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<<EOF"
target/list-versions.py --minor
echo EOF
) >> $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.
#
# For the default Python version, the micro version should be different to the
# one used by the runtime, because that's required by the integration tests
# `requires_python` and `marker_python_version`. For all other versions, we let
# the GitHub runner pick a micro version, which will be faster because it's
# locally cached.
python-version: |
${{ steps.runtime-versions.outputs.versions }}
${{ inputs.extra-versions }}
3.6
3.7
3.8.10
3.9
3.10
3.11
3.12
- name: Set default Python command
id: python-default
Expand Down
25 changes: 7 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions product/gradle-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 31875a6

Please sign in to comment.