@@ -14,55 +14,63 @@ 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+ name : generate matrix
26+ run : |
27+ import itertools
28+ import json
29+ import os
30+ import pprint
31+
32+ matrix = [
33+ d
34+ for d in map(dict, itertools.product(
35+ (('python-version', v) for v in ["3.x", "pypy-3.10", "pypyp-3.11", "graalpy-24"]),
36+ (('arch', a) for a in ["x64_64", "aarch64"]),
37+ (('platform', p) for p in ["linux", "musllinux", "windows", "macos"])
38+ ))
39+ if not (d['platform'] == 'windows' and d['python-version'] == 'graalpy-24')
40+ ]
41+ for job in matrix:
42+ match job['platform']:
43+ case 'linux':
44+ job['manylinux'] = 'auto'
45+ job['args'] = '--release --out dist -m ua-parser-py/Cargo.toml -i python --zig'
46+ case 'mussllinux':
47+ job['manylinux'] = 'musllinux_1_2'
48+ job['args'] = '--release --out dist -m ua-parser-py/Cargo.toml'
49+ case _:
50+ job['args'] = '--release --out dist -m ua-parser-py/Cargo.toml -i python'
51+
52+ match job['platform']:
53+ case 'windows':
54+ job['runs-on'] = 'windows-latest'
55+ case 'macos':
56+ job['runs-on'] = 'macos-latest'
57+ case _:
58+ job['runs-on'] = 'ubuntu-latest'
59+
60+ if job['platform'] == 'windows' and job['arch'] == 'aarch64':
61+ job['arch'] = 'arm64'
62+
63+ print(pprint.pprint(matrix))
64+ with open(os.environ['GITHUB_OUTPUT'], 'w') as f:
65+ print("matrix=" + json.dumps('matrix'), file=f)
66+
1767 py-release-wheels :
68+ needs : [py-wheels-matrix]
1869 strategy :
1970 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 }}
71+ matrix : ${{fromJson(needs.py-wheels-matrix.outputs.matrix)}}
72+
73+ runs-on : ${{ matrix.runs }}
6674
6775 steps :
6876 - uses : actions/checkout@v4
0 commit comments