-
Notifications
You must be signed in to change notification settings - Fork 6
125 lines (117 loc) · 3.77 KB
/
package.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
name: Build wheels
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
outputs:
SDIST_NAME: ${{ steps.sdist.outputs.SDIST_NAME }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with :
python-version: 3.12
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install test dependencies
run: |
python -m pip install build twine flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install -e .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 SuchTree --count --ignore=E201,E202,E203 \
--select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 SuchTree --count --ignore=E201,E202,E203 \
--exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: pytest
- name: Build source distribution
id: sdist
run: |
python -m build --sdist
python .github/export_sdist_name.py
- name: Upload sdist result
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
if-no-files-found: error
build_wheels:
name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }}
needs: build_sdist
runs-on: ${{ matrix.os }}
env:
CIBW_BEFORE_BUILD: >-
rm -rf {package}/build
CIBW_BEFORE_BUILD_WINDOWS: >-
pip install delvewheel &&
rm -rf {package}/build
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >-
delvewheel repair -w {dest_dir} {wheel}
CIBW_AFTER_BUILD: >-
twine check {wheel}
strategy:
matrix:
include:
- os: ubuntu-latest
cibw_archs: "x86_64"
- os: ubuntu-latest
cibw_archs: "aarch64"
- os: windows-latest
cibw_archs: "auto64"
- os: macos-latest
cibw_archs: "x86_64"
- os: macos-latest
cibw_archs: "arm64"
steps:
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: cibw-sdist
path: dist/
- name: Set up QEMU
if: matrix.cibw_archs == 'aarch64'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Build wheels for CPython 3.12
uses: pypa/[email protected]
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp312-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
- name: Build wheels for CPython 3.11
uses: pypa/[email protected]
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp311-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
- name: Build wheels for CPython 3.10
uses: pypa/[email protected]
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp310-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ runner.os }}-${{ matrix.cibw_archs }}
path: ./wheelhouse/*.whl
merge:
runs-on: ubuntu-latest
needs: build_wheels
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: wheelhouse
pattern: cibw-wheels-*