-
Notifications
You must be signed in to change notification settings - Fork 31
90 lines (81 loc) · 2.97 KB
/
wheels.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
## IMPORTANT: the configuration for cibuildwheel is kept in pyproject.toml
name: wheels
on:
push:
branches:
# on push, only build on wip chore/cicd branches so we can test in those
# contexts without triggering pull-requests.
- chore/cicd/*
pull_request:
jobs:
generate-wheels-matrix:
name: Generate wheels matrix
runs-on: ubuntu-latest
outputs:
include: ${{ steps.set-matrix.outputs.include }}
steps:
- uses: actions/checkout@v4
- name: Install cibuildwheel
run: pipx install cibuildwheel==2.22.0
- id: set-matrix
run: |
# Some notes on this:
# - macos-13 is a amd64 builder.
# - maxos-14 is the default builder which is arm64, probably because
# it's more effecient.
# - We don't yet specifiy arm64 versions on linux, even though AWS
# provides cheaper ec2 instaces running on arm64 cores. /FIXME
MATRIX=$(
{
cibuildwheel --print-build-identifiers --platform linux \
| jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \
&& cibuildwheel --print-build-identifiers --platform macos --arch x86_64 \
| jq -nRc '{"only": inputs, "os": "macos-13"}' \
&& cibuildwheel --print-build-identifiers --platform macos --arch arm64 \
| jq -nRc '{"only": inputs, "os": "macos-14"}' \
&& cibuildwheel --print-build-identifiers --platform windows \
| jq -nRc '{"only": inputs, "os": "windows-latest"}'
} | jq -sc
)
echo "include=$MATRIX" >> $GITHUB_OUTPUT
build_wheels:
name: Build ${{ matrix.only }}
needs: generate-wheels-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix:
include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }}
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
with:
only: ${{ matrix.only }}
- uses: actions/upload-artifact@v4
with:
# We need the subdir to workaround updload-artifact@v4 erroring on
# duplicate path creations, which is very annoying. There is probably
# a better way of doing this, or one will be added soon.
name: tmap-wheels-for-${{ matrix.only }}
path: ./wheelhouse/*.whl
collate-wheels:
name: Collate all wheels
needs: build_wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all wheel artifacts
uses: actions/download-artifact@v4
with:
path: wheelhouse
- name: Compress wheels
run: |
mkdir -p wheelhouse_flat
mv $(find wheelhouse -type f) wheelhouse_flat
zip -r wheels-archive.zip wheelhouse_flat
- uses: actions/upload-artifact@v4
with:
name: wheels-archive
path: |
wheels-archive.tar.gz
wheels-archive.zip