@@ -14,55 +14,62 @@ permissions:
1414 contents : read
1515
1616jobs :
17+ py-wheels-matrix :
18+ name : " generate build matrix"
19+ runs-on : ubuntu-latest
20+ outputs :
21+ matrix : ${{ steps.make-matrix.outputs.matrix }}
22+ steps :
23+ - id : make-matrix
24+ shell : python
25+ run : |
26+ import itertools
27+ import json
28+ import os
29+ import pprint
30+
31+ matrix = [
32+ d
33+ for d in map(dict, itertools.product(
34+ (('python-version', v) for v in ["3.x", "pypy-3.10", "pypyp-3.11", "graalpy-24"]),
35+ (('arch', a) for a in ["x64_64", "aarch64"]),
36+ (('platform', p) for p in ["linux", "musllinux", "windows", "macos"])
37+ ))
38+ if not (d['platform'] == 'windows' and d['python-version'] == 'graalpy-24')
39+ ]
40+ for job in matrix:
41+ match job['platform']:
42+ case 'linux':
43+ job['manylinux'] == 'auto'
44+ job['args'] = '--release --out dist -m ua-parser-py/Cargo.toml -i python --zig'
45+ case 'mussllinux':
46+ job['manylinux'] = 'musllinux_1_2'
47+ job['args'] = '--release --out dist -m ua-parser-py/Cargo.toml'
48+ case _:
49+ job['args'] = '--release --out dist -m ua-parser-py/Cargo.toml -i python'
50+
51+ match job['platform']:
52+ case 'windows':
53+ job['runs-on'] = 'windows-latest'
54+ case 'macos':
55+ job['runs-on'] = 'macos-latest'
56+ case _:
57+ job['runs-on'] = 'ubuntu-latest'
58+
59+ if job['platform'] == 'windows' and job['arch'] == 'aarch64':
60+ job['arch'] = 'arm64'
61+
62+ print(pprint.pprint(matrix))
63+ with open(os.environ['GITHUB_OUTPUT']) as f:
64+ print("matrix=" + json.dumps('matrix'), file=f)
65+
1766 py-release-wheels :
67+ needs : [py-wheels-matrix]
1868 strategy :
1969 fail-fast : false
20- matrix :
21- python-version :
22- - " 3.x"
23- - " pypy-3.10"
24- - " pypy-3.11"
25- - " graalpy-24"
26- aarch :
27- - x86_64
28- - aarch64
29- platform :
30- - linux
31- - musllinux
32- - windows
33- - macos
34-
35- exclude :
36- - platform : windows
37- python-version : graalpy-24
38-
39- include :
40- - platform : linux
41- manylinux : auto
42- - platform : musllinux
43- manylinux : musllinux_1_2
44-
45- - args : --release --out dist -m ua-parser-py/Cargo.toml -i python
46- - platform : linux
47- args : --release --out dist -m ua-parser-py/Cargo.toml -i python --zig
48- - platform : musllinux
49- args : --release --out dist -m ua-parser-py/Cargo.toml
50-
51- - runs : ubuntu-latest
52- - platform : windows
53- runs : windows-latest
54- - platform : macos
55- runs : macos-latest
56-
57- - aarch : x64_64
58- arch : x86_64
59- - aarch : aarch64
60- arch : aarch64
61- - platform : windows
62- aarch : aarch64
63- arch : arm64
64-
65- runs-on : ${{ matrix.runs || matrix }}
70+ matrix : ${{fromJson(needs.py-wheels-matrix.outputs.matrix)}}
71+
72+ runs-on : ${{ matrix.runs }}
6673
6774 steps :
6875 - uses : actions/checkout@v4
0 commit comments