Skip to content

Commit 00faff5

Browse files
committed
Add the ability to build more python versions
1 parent efac807 commit 00faff5

File tree

8 files changed

+55
-12
lines changed

8 files changed

+55
-12
lines changed

.github/actions/build-onedir-salt/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ runs:
3535
platform: ${{ inputs.platform }}
3636
arch: ${{ inputs.arch }}
3737
python-version: "${{ inputs.python-version }}"
38-
cache-prefix: ${{ inputs.cache-prefix }}|relenv|${{ inputs.salt-version }}
38+
cache-prefix: ${{ inputs.cache-prefix }}|relenv|${{ inputs.python-version }}|${{ inputs.salt-version }}
3939

4040
- name: Download Source Tarball
4141
uses: actions/download-artifact@v4

.github/workflows/build-salt-onedir.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ jobs:
8989
arch: ${{ matrix.arch == 'arm64' && 'aarch64' || matrix.arch }}
9090
version: ${{ inputs.relenv-version }}
9191
cache-seed: ${{ inputs.cache-seed }}
92-
python-version: ${{ inputs.python-version }}
92+
python-version: ${{ matrix.python }}
9393

9494
- name: Install Salt into Relenv Onedir
9595
uses: ./.github/actions/build-onedir-salt
9696
with:
9797
platform: linux
9898
arch: ${{ matrix.arch }}
9999
salt-version: "${{ inputs.salt-version }}"
100-
python-version: "${{ inputs.python-version }}"
100+
python-version: "${{ matrix.python }}"
101101
cache-prefix: ${{ inputs.cache-seed }}|relenv|${{ steps.setup-relenv.outputs.version }}
102102

103103
build-salt-macos:
@@ -148,15 +148,15 @@ jobs:
148148
arch: ${{ matrix.arch }}
149149
version: ${{ inputs.relenv-version }}
150150
cache-seed: ${{ inputs.cache-seed }}
151-
python-version: ${{ inputs.python-version }}
151+
python-version: ${{ matrix.python }}
152152

153153
- name: Install Salt into Relenv Onedir
154154
uses: ./.github/actions/build-onedir-salt
155155
with:
156156
platform: macos
157157
arch: ${{ matrix.arch }}
158158
salt-version: "${{ inputs.salt-version }}"
159-
python-version: "${{ inputs.python-version }}"
159+
python-version: "${{ matrix.python }}"
160160
cache-prefix: ${{ inputs.cache-seed }}|relenv|${{ steps.setup-relenv.outputs.version }}
161161

162162
build-salt-windows:
@@ -204,13 +204,13 @@ jobs:
204204
arch: ${{ matrix.arch }}
205205
version: ${{ inputs.relenv-version }}
206206
cache-seed: ${{ inputs.cache-seed }}
207-
python-version: ${{ inputs.python-version }}
207+
python-version: ${{ matrix.python }}
208208

209209
- name: Install Salt into Relenv Onedir
210210
uses: ./.github/actions/build-onedir-salt
211211
with:
212212
platform: windows
213213
arch: ${{ matrix.arch }}
214214
salt-version: "${{ inputs.salt-version }}"
215-
python-version: "${{ inputs.python-version }}"
215+
python-version: "${{ matrix.python }}"
216216
cache-prefix: ${{ inputs.cache-seed }}|relenv|${{ steps.setup-relenv.outputs.version }}

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ jobs:
419419
relenv-version: "0.20.3"
420420
python-version: "3.10.18"
421421
ci-python-version: "3.11"
422-
matrix: ${{ toJSON(fromJSON(needs.prepare-workflow.outputs.config)['build-matrix']) }}
422+
matrix: ${{ toJSON(fromJSON(needs.prepare-workflow.outputs.config)['onedir-matrix']) }}
423423
linux_arm_runner: ${{ fromJSON(needs.prepare-workflow.outputs.config)['linux_arm_runner'] }}
424424

425425
build-pkgs-onedir:

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ jobs:
469469
relenv-version: "0.20.3"
470470
python-version: "3.10.18"
471471
ci-python-version: "3.11"
472-
matrix: ${{ toJSON(fromJSON(needs.prepare-workflow.outputs.config)['build-matrix']) }}
472+
matrix: ${{ toJSON(fromJSON(needs.prepare-workflow.outputs.config)['onedir-matrix']) }}
473473
linux_arm_runner: ${{ fromJSON(needs.prepare-workflow.outputs.config)['linux_arm_runner'] }}
474474

475475
build-pkgs-onedir:

.github/workflows/scheduled.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ jobs:
454454
relenv-version: "0.20.3"
455455
python-version: "3.10.18"
456456
ci-python-version: "3.11"
457-
matrix: ${{ toJSON(fromJSON(needs.prepare-workflow.outputs.config)['build-matrix']) }}
457+
matrix: ${{ toJSON(fromJSON(needs.prepare-workflow.outputs.config)['onedir-matrix']) }}
458458
linux_arm_runner: ${{ fromJSON(needs.prepare-workflow.outputs.config)['linux_arm_runner'] }}
459459

460460
build-pkgs-onedir:

.github/workflows/staging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ jobs:
450450
relenv-version: "0.20.3"
451451
python-version: "3.10.18"
452452
ci-python-version: "3.11"
453-
matrix: ${{ toJSON(fromJSON(needs.prepare-workflow.outputs.config)['build-matrix']) }}
453+
matrix: ${{ toJSON(fromJSON(needs.prepare-workflow.outputs.config)['onedir-matrix']) }}
454454
linux_arm_runner: ${{ fromJSON(needs.prepare-workflow.outputs.config)['linux_arm_runner'] }}
455455

456456
build-pkgs-onedir:

.github/workflows/templates/ci.yml.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@
254254
relenv-version: "<{ relenv_version }>"
255255
python-version: "<{ python_version }>"
256256
ci-python-version: "<{ gh_actions_workflows_python_version }>"
257-
matrix: ${{ toJSON(fromJSON(needs.prepare-workflow.outputs.config)['build-matrix']) }}
257+
matrix: ${{ toJSON(fromJSON(needs.prepare-workflow.outputs.config)['onedir-matrix']) }}
258258
linux_arm_runner: ${{ fromJSON(needs.prepare-workflow.outputs.config)['linux_arm_runner'] }}
259259

260260
<%- endif %>

tools/ci.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,39 @@ def _build_matrix(os_kind, linux_arm_runner):
166166
return _matrix
167167

168168

169+
def _onedir_build_matrix(os_kind, linux_arm_runner, python_versions=None):
170+
"""
171+
Generate matrix onedir python builds.
172+
"""
173+
if python_versions is None:
174+
python_versions = [
175+
"3.10.18",
176+
"3.11.13",
177+
"3.12.11",
178+
"3.13.5",
179+
]
180+
_matrix = []
181+
if os_kind == "windows":
182+
for version in python_versions:
183+
_matrix.extend(
184+
[
185+
{"python": version, "arch": "amd64"},
186+
{"python": version, "arch": "x86"},
187+
]
188+
)
189+
else:
190+
for version in python_versions:
191+
_matrix.append({"python": version, "arch": "x86_64"})
192+
193+
if os_kind == "macos":
194+
for version in python_versions:
195+
_matrix.append({"python": version, "arch": "arm64"})
196+
elif os_kind == "linux" and linux_arm_runner:
197+
for version in python_versions:
198+
_matrix.append({"python": version, "arch": "arm64"})
199+
return _matrix
200+
201+
169202
@ci.command(
170203
name="get-releases",
171204
arguments={
@@ -808,13 +841,23 @@ def workflow_config(
808841
jobs["test-pkg-download"] = False
809842

810843
config["jobs"] = jobs
844+
811845
config["build-matrix"] = {
812846
platform: _build_matrix(platform, config["linux_arm_runner"])
813847
for platform in platforms
814848
}
815849
ctx.info(f"{'==== build matrix ====':^80s}")
816850
ctx.info(f"{pprint.pformat(config['build-matrix'])}")
817851
ctx.info(f"{'==== end build matrix ====':^80s}")
852+
853+
config["onedir-matrix"] = {
854+
platform: _onedir_build_matrix(platform, config["linux_arm_runner"])
855+
for platform in platforms
856+
}
857+
ctx.info(f"{'==== onedir build matrix ====':^80s}")
858+
ctx.info(f"{pprint.pformat(config['onedir-matrix'])}")
859+
ctx.info(f"{'==== end onedir build matrix ====':^80s}")
860+
818861
config["artifact-matrix"] = []
819862
for platform in platforms:
820863
config["artifact-matrix"] += [

0 commit comments

Comments
 (0)