diff options
| author | Michael Williamson <mike@zwobble.org> | 2022-09-19 14:49:23 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2022-09-19 15:24:57 +0100 |
| commit | a6b7cd6c208843b66fdce37044bc8a4081ad9eb8 (patch) | |
| tree | f30154d2586cb320c7aeac5b218b9113a938ec49 | |
| parent | 39f7717dd446cd756109a1054e44e94ae9dd9b5b (diff) | |
Use cibuildwheel --print-build-identifiers to generate matrix
| -rw-r--r-- | .github/workflows/build.yml | 14 | ||||
| -rw-r--r-- | build-wheels-matrix.py | 55 |
2 files changed, 13 insertions, 56 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e832d2..e5d405f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,7 +71,19 @@ jobs: run: python -m pip install cibuildwheel==2.10.1 - id: set-matrix - run: python build-wheels-matrix.py + env: + CIBW_ARCHS_LINUX: "auto64 aarch64" + CIBW_ARCHS_MACOS: "auto64" + run: | + MATRIX=$( + { + cibuildwheel --print-build-identifiers --platform linux \ + | sed 's/.*/{"cibw-only": "&", "os": "ubuntu-20.04"}/' \ + && cibuildwheel --print-build-identifiers --platform macos \ + | sed 's/.*/{"cibw-only": "&", "os": "macos-10.15" }/' + } | jq --slurp --compact-output '{"include": .}' + ) + echo ::set-output name=matrix::"$MATRIX" build_wheels: name: Build ${{ matrix.cibw-only }} wheel diff --git a/build-wheels-matrix.py b/build-wheels-matrix.py deleted file mode 100644 index 36c56ba..0000000 --- a/build-wheels-matrix.py +++ /dev/null @@ -1,55 +0,0 @@ -import json - -import cibuildwheel.linux -import cibuildwheel.macos -from cibuildwheel.architecture import Architecture -from cibuildwheel.util import BuildSelector - - -def _main(): - build_selector = BuildSelector( - build_config="*", - skip_config="", - requires_python=None, - prerelease_pythons=None - ) - - linux_python_configurations = cibuildwheel.linux.get_python_configurations( - build_selector, - {Architecture.x86_64, Architecture.aarch64}, - ) - - macos_python_configurations = cibuildwheel.macos.get_python_configurations( - build_selector, - {Architecture.x86_64} - ) - - matrix = { - "include": [ - { - "os": "ubuntu-20.04", - "cibw-only": configuration.identifier, - } - for configuration in linux_python_configurations - ] + [ - { - "os": "macos-10.15", - "cibw-only": configuration.identifier, - } - for configuration in macos_python_configurations - ] - } - - print("::set-output name=matrix::" + json.dumps(matrix)) - - -def _configuration_to_architecture(configuration): - for architecture in Architecture: - if configuration.identifier.endswith(f"_{architecture.value}"): - return architecture - - raise ValueError("could not find architecture for configuration") - - -if __name__ == "__main__": - _main() |
