Skip to content

Commit 31875a6

Browse files
committed
Ensure CI buildPython has different micro versions to the runtime
1 parent 8b07806 commit 31875a6

File tree

4 files changed

+26
-39
lines changed

4 files changed

+26
-39
lines changed

.github/actions/setup-python/action.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
name: Setup Python
22
description:
33

4-
inputs:
5-
extra-versions:
6-
description: |
7-
Additional versions to install, on top of the supported runtime versions. One
8-
version per line, in the same syntax as the standard setup-python action.
9-
104
runs:
115
using: composite
126
steps:
13-
- name: List runtime versions
14-
id: runtime-versions
15-
shell: bash
16-
run: |
17-
(
18-
echo "versions<<EOF"
19-
target/list-versions.py --minor
20-
echo EOF
21-
) >> $GITHUB_OUTPUT
22-
237
- uses: actions/setup-python@v4.6.1
248
with:
9+
# This should include all major.minor versions supported by the runtime, plus
10+
# OLD_BUILD_PYTHON_VERSION, MIN_BUILD_PYTHON_VERSION and
11+
# MAX_BUILD_PYTHON_VERSION from test_gradle_plugin.
12+
#
13+
# For the default Python version, the micro version should be different to the
14+
# one used by the runtime, because that's required by the integration tests
15+
# `requires_python` and `marker_python_version`. For all other versions, we let
16+
# the GitHub runner pick a micro version, which will be faster because it's
17+
# locally cached.
2518
python-version: |
26-
${{ steps.runtime-versions.outputs.versions }}
27-
${{ inputs.extra-versions }}
19+
3.6
20+
3.7
21+
3.8.10
22+
3.9
23+
3.10
24+
3.11
25+
3.12
2826
2927
- name: Set default Python command
3028
id: python-default

.github/workflows/ci.yml

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ defaults:
1414
jobs:
1515

1616
product:
17-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-20.04
1818
steps:
1919
- uses: smorimoto/tune-github-hosted-runner-network@v1
2020
- uses: actions/checkout@v3.5.3
@@ -72,7 +72,7 @@ jobs:
7272

7373

7474
docs:
75-
runs-on: ubuntu-latest
75+
runs-on: ubuntu-20.04
7676
steps:
7777
- uses: smorimoto/tune-github-hosted-runner-network@v1
7878
- uses: actions/checkout@v3.5.3
@@ -103,15 +103,12 @@ jobs:
103103

104104

105105
gradlePython:
106-
runs-on: ubuntu-latest
106+
runs-on: ubuntu-20.04
107107
steps:
108108
- uses: smorimoto/tune-github-hosted-runner-network@v1
109109
- uses: actions/checkout@v3.5.3
110110

111-
- uses: actions/setup-python@v4.6.1
112-
with:
113-
# MIN_BUILD_PYTHON_VERSION from test_gradle_plugin
114-
python-version: 3.7
111+
- uses: ./.github/actions/setup-python
115112

116113
- uses: ./.github/actions/create-local-properties
117114

@@ -123,7 +120,7 @@ jobs:
123120
124121
demo:
125122
needs: [product]
126-
runs-on: ubuntu-latest
123+
runs-on: ubuntu-20.04
127124
steps:
128125
- uses: smorimoto/tune-github-hosted-runner-network@v1
129126
- uses: actions/checkout@v3.5.3
@@ -163,9 +160,8 @@ jobs:
163160
agp-version: ${{ fromJSON(needs.product.outputs.agp-versions) }}
164161
os: [linux, macos, windows]
165162
include:
166-
# We pin specific OS versions to ensure that the Python `extra-versions`
167-
# listed below are all available. To avoid clutter in the GitHub UI, OS
168-
# versions are not added to the `os` dimension directly.
163+
# To avoid clutter in the GitHub UI, OS versions are not added to the `os`
164+
# dimension directly.
169165
- os: linux
170166
runs-on: ubuntu-20.04
171167
- os: macos
@@ -180,13 +176,6 @@ jobs:
180176

181177
- uses: ./.github/actions/setup-python
182178
id: setup-python
183-
with:
184-
# This should include OLD_BUILD_PYTHON_VERSION, MIN_BUILD_PYTHON_VERSION and
185-
# MAX_BUILD_PYTHON_VERSION from test_gradle_plugin, if they're not already
186-
# returned by `list-versions.py --minor`.
187-
extra-versions: |
188-
3.6
189-
3.7
190179

191180
- name: Download Maven repository
192181
uses: actions/download-artifact@v3.0.2

product/gradle-plugin/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ After stable release:
9595

9696
* Update `MAX_BUILD_PYTHON_VERSION` in test_gradle_plugin.py, and run the tests which
9797
use it.
98+
* Update the list of Python versions in .github/actions/setup-python/action.yml.
9899
* Build the demo app with the new version, and check for any warnings other than the
99100
expected ones about .pyc compilation.
100101

@@ -105,8 +106,7 @@ After stable release:
105106
* Update `testPython` in gradle-plugin/build.gradle, and run the tests.
106107
* In test_gradle_plugin, update `OLD_BUILD_PYTHON_VERSION` and
107108
`MIN_BUILD_PYTHON_VERSION`, and run the tests which use them.
108-
* Check references to `OLD_BUILD_PYTHON_VERSION` and `MIN_BUILD_PYTHON_VERSION` in
109-
ci.yml.
109+
* Update the list of Python versions in .github/actions/setup-python/action.yml.
110110
* Update android.rst.
111111

112112

product/gradle-plugin/src/test/integration/test_gradle_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def list_versions(mode):
6565
.split()[1])
6666
BUILD_PYTHON_VERSION = BUILD_PYTHON_VERSION_FULL.rpartition(".")[0]
6767

68-
# When updating these, consider also updating extra-versions in ci.yml.
68+
# When updating these, consider also updating .github/actions/setup-python/action.yml.
6969
OLD_BUILD_PYTHON_VERSION = "3.6"
7070
MIN_BUILD_PYTHON_VERSION = "3.7"
7171
MAX_BUILD_PYTHON_VERSION = "3.12"

0 commit comments

Comments
 (0)