-
Notifications
You must be signed in to change notification settings - Fork 2
157 lines (144 loc) · 4.45 KB
/
build_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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Build Wheels
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
skip_tests:
description: "Skip cibuildwheel tests"
required: true
type: boolean
os_type:
description: "OS"
default: "all"
type: choice
options:
- macos-latest
- ubuntu-latest
- windows-latest
- all
allow_deploy:
description: "Deploy to PyPI"
required: true
type: boolean
jobs:
test_inplace:
name: Test on ${{ matrix.os }}_${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install -U pip setuptools
pip install pytest pytest-xdist psutil
- name: Install Project
run: pip install -e .
env:
CYNDILIB_BUILD_PARALLEL: auto
- name: Compile tests
run: |
pip install cython>=0.29.32
python build_tests.py
- name: Run tests
run: py.test
build_wheels:
name: Build wheels on ${{ matrix.os }}_${{ matrix.python-version }}-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-13
arch: x86_64
python-version: "cp3{8,9,10,11,12}"
- os: macos-14
arch: arm64
python-version: "cp3{8,9,10,11,12}"
- os: ubuntu-latest
arch: x86_64
python-version: "cp3{8,9,10,11,12}"
- os: windows-latest
arch: AMD64
python-version: "cp3{8,9,10,11,12}"
- os: ubuntu-latest
arch: aarch64
python-version: "cp38"
- os: ubuntu-latest
arch: aarch64
python-version: "cp39"
- os: ubuntu-latest
arch: aarch64
python-version: "cp310"
- os: ubuntu-latest
arch: aarch64
python-version: "cp311"
- os: ubuntu-latest
arch: aarch64
python-version: "cp312"
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
if: matrix.os == 'ubuntu-latest'
uses: docker/setup-qemu-action@v2
- uses: actions/setup-python@v5
with:
python-version: 3.8
if: runner.os == 'macOS' && runner.arch == 'ARM64'
- name: Set cibuildwheel env
id: cibuildwheel_env
run: |
CIBW_TEST_SKIP="cp38-macosx*"
if [ "${{ inputs.skip_tests }}" == "true" ]; then
echo "skip_tests is true"
CIBW_TEST_SKIP="*"
fi
echo "test_skip=$CIBW_TEST_SKIP" >> $GITHUB_OUTPUT
shell: bash
- name: Debug env step
run: |
echo "test_skip = ${{ steps.cibuildwheel_env.outputs.test_skip }}"
echo "skip_build = ${{ steps.cibuildwheel_env.outputs.skip_build }}"
shell: bash
- name: Build wheels
id: build_wheel
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.python-version }}-*
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_TEST_SKIP: ${{ steps.cibuildwheel_env.outputs.test_skip }}
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "delocate-listdeps {wheel} --all --depending && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"
if: ${{ inputs.os_type }} != "" && (${{ inputs.os_type }} == matrix.os || ${{ inputs.os_type }} == "all")
# ...
# with:
# package-dir: .
# output-dir: wheelhouse
# config-file: "{package}/pyproject.toml"
- uses: actions/upload-artifact@v3
if: ${{ steps.build_wheel.outcome }} == "success"
with:
path: ./wheelhouse/*.whl
deploy:
name: 'Deploy to PyPI'
needs: [test_inplace, build_wheels]
runs-on: ubuntu-latest
if: ${{ inputs.allow_deploy }}
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1