-
Notifications
You must be signed in to change notification settings - Fork 25
150 lines (139 loc) · 4.83 KB
/
build.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
name: Build
on: [push, pull_request]
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- run: |
python -m pip install pylint
python -m pip install -e .
- uses: pre-commit/action@v3.0.0
with:
extra_args: pylint --all-files
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Build sdist
run: |
python -m pip install --user build
python -m build --sdist
- uses: actions/upload-artifact@v3
with:
name: source
path: dist/*.tar.gz
build_wheels:
needs: build_sdist
name: Build wheel ${{ matrix.wheel }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# - { wheel: cp38-macosx_arm64, os: macos-latest }
# - { wheel: cp38-macosx_x86_64, os: macos-latest }
# - { wheel: cp38-manylinux_x86_64, os: ubuntu-latest }
# - { wheel: cp38-win_amd64, os: windows-latest }
# - { wheel: cp39-macosx_arm64, os: macos-latest }
# - { wheel: cp39-macosx_x86_64, os: macos-latest }
# - { wheel: cp39-manylinux_x86_64, os: ubuntu-latest }
# - { wheel: cp39-win_amd64, os: windows-latest }
# - { wheel: cp310-macosx_arm64, os: macos-latest }
# - { wheel: cp310-macosx_x86_64, os: macos-latest }
# - { wheel: cp310-manylinux_x86_64, os: ubuntu-latest }
# - { wheel: cp310-win_amd64, os: windows-latest }
# - { wheel: cp311-macosx_arm64, os: macos-latest }
# - { wheel: cp311-macosx_x86_64, os: macos-latest }
# - { wheel: cp311-manylinux_x86_64, os: ubuntu-latest }
# - { wheel: cp311-win_amd64, os: windows-latest }
- { wheel: cp312-macosx_arm64, os: macos-latest }
# - { wheel: cp312-macosx_x86_64, os: macos-latest }
# - { wheel: cp312-manylinux_x86_64, os: ubuntu-latest }
# - { wheel: cp312-win_amd64, os: windows-latest }
# - { wheel: pp39-manylinux_x86_64, os: ubuntu-latest }
# Currently broken with PyPy 7.3? See https://foss.heptapod.net/pypy/pypy/-/issues/4013.
# - { wheel: pp39-macosx_x86_64, os: macos-latest }
# - { wheel: pp39-win_amd64, os: windows-latest }
steps:
- name: Download source distribution
uses: actions/download-artifact@v3
with:
name: source
- name: Unpack source distribution
shell: bash
run: tar --strip-components 1 -xvf *.tar.gz
- name: Build wheel
uses: pypa/cibuildwheel@v2.16.2
with:
output-dir: wheelhouse
env:
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_BUILD: ${{ matrix.wheel }}
CIBW_TEST_COMMAND: python -m unittest discover -v -s {package}/tests
CIBW_TEST_SKIP: "*_arm64"
CIBW_BUILD_VERBOSITY: 1
- uses: actions/upload-artifact@v3
with:
name: wheels
path: ./wheelhouse/*.whl
test_macos_arm_wheels:
needs: build_wheels
name: Test macOS ARM64 wheels
runs-on: [macOS, ARM64]
steps:
- uses: actions/download-artifact@v3
with:
name: source
path: dist
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- run: |
pip install --force-reinstall ./dist/*cp312*macos*arm64.whl
tar xvf ./dist/pypcode-*.tar.gz
cd pypcode-*/tests
python -m unittest discover -v -s .
build_docs:
name: Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- run: |
pip install -e .[docs]
cd docs && make html coverage
upload_pypi:
name: Upload wheels to PyPI
needs: [lint, build_docs, build_sdist, build_wheels]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v3
with:
name: source
path: dist
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}