-
Notifications
You must be signed in to change notification settings - Fork 30
135 lines (127 loc) · 5.03 KB
/
build.yml
File metadata and controls
135 lines (127 loc) · 5.03 KB
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
name: Build
on: [push, pull_request]
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.10'
- run: |
python -m pip install -e .[pylint]
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
with:
extra_args: pylint --all-files
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.10'
- name: Build sdist
run: |
python -m pip install --user build
python -m build --sdist
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: source
path: dist/*.tar.gz
build_wheels:
needs: build_sdist
name: Build wheel ${{ matrix.py }}-${{ matrix.platform.wheel_tag }} on ${{ matrix.platform.os }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
py: [cp310, cp311, cp312]
platform:
- { arch: x86_64, os: windows-latest, wheel_tag: win_amd64 }
- { arch: x86_64, os: macos-13, wheel_tag: macosx_x86_64 }
- { arch: arm64, os: macos-latest, wheel_tag: macosx_arm64 }
- { arch: x86_64, os: ubuntu-latest, wheel_tag: manylinux_x86_64 }
- { arch: aarch64, os: ubuntu-24.04-arm, wheel_tag: manylinux_aarch64 }
steps:
- name: Download source distribution
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: source
- name: Unpack source distribution
shell: bash
run: tar --strip-components 1 -xvf *.tar.gz
- name: Build wheel
uses: pypa/cibuildwheel@c923d83ad9c1bc00211c5041d0c3f73294ff88f6 # v3.1.4
with:
output-dir: wheelhouse
env:
CIBW_ARCHS_MACOS: ${{ matrix.platform.arch }}
CIBW_BUILD: ${{ matrix.py }}-${{ matrix.platform.wheel_tag }}
CIBW_TEST_COMMAND: python -m unittest discover -v -s {package}/tests
CIBW_BUILD_VERBOSITY: 1
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.platform.arch == 'arm64' && '11' || '10.14' }}
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ matrix.py }}-${{ matrix.platform.wheel_tag }}
path: ./wheelhouse/*.whl
test_abi3_wheels:
needs: build_wheels
name: Test with Python ${{ matrix.py }} on ${{ matrix.platform.os }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
py: [ "3.13" ]
platform:
- { arch: x86_64, os: windows-latest, wheel_tag: win_amd64 }
- { arch: x86_64, os: macos-13, wheel_tag: macosx_x86_64 }
- { arch: arm64, os: macos-latest, wheel_tag: macosx_arm64 }
- { arch: x86_64, os: ubuntu-latest, wheel_tag: manylinux_x86_64 }
- { arch: aarch64, os: ubuntu-24.04-arm, wheel_tag: manylinux_aarch64 }
steps:
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
path: artifacts
merge-multiple: true
- name: Unpack source distribution
shell: bash
run: tar --strip-components 1 -xvf artifacts/*.tar.gz
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.py }}
- name: Install wheel and run tests
run: |
python -m pip install --no-index --find-links=artifacts pypcode
cd tests; python -m unittest discover -v .
build_docs:
name: Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
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, test_abi3_wheels]
environment:
name: pypi
url: https://pypi.org/p/pypcode
permissions:
id-token: write
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@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
path: artifacts
- run: |
mkdir dist
find artifacts -type f -exec mv {} dist \;
- uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4