Use matrix instead of separate jobs in generated CI workflow
djc opened this issue · 2 comments
djc commented
Currently the generated CI workflow has something like this:
jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
macos:
runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
The only difference between the different jobs seems to be the use of manylinux: auto
? Assuming that that would do the right thing on non-Linux platform, it would be nice to use a matrix
instead to use one job that runs over a matrix of platforms and targets. Especially since we can then also set a python
variable in the matrix
to produce wheels for multiple Python versions.
Here's my adapted version:
build:
strategy:
matrix:
target: [x86_64]
python: [3.9, "3.10", "3.11"]
include:
- os: ubuntu-latest
target: x86_64
- os: windows-latest
target: x64
- os: macos-latest
target: aarch64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
(Personally I think it makes sense to avoid generating binaries for pretty obscure platforms by default.)
djc commented
(So far I'm not actually getting my proposed matrix to work, seems like there's a bug with the matrix setup.)
davidhewitt commented
Closely related to #166