-
Notifications
You must be signed in to change notification settings - Fork 7
96 lines (84 loc) · 3 KB
/
Copy pathpython-publish.yml
File metadata and controls
96 lines (84 loc) · 3 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
name: Build and Publish to PyPI
on:
release:
types: [published]
# Allow manual trigger for testing
workflow_dispatch:
permissions:
contents: read
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build wheels
uses: pypa/cibuildwheel@v2.22
env:
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-* cp313-*
CIBW_SKIP: "*-musllinux_* pp* *-win32 *-manylinux_i686"
CIBW_TEST_SKIP: "cp38-macosx_*:arm64"
CIBW_TEST_REQUIRES: numpy pytest
CIBW_TEST_COMMAND: pytest {project}/tests/test_smoke.py -v
CIBW_BEFORE_ALL_LINUX: >
yum install -y cmake gcc gcc-c++ make &&
cd /tmp &&
curl -L https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.22.tar.gz | tar xz &&
cd libdeflate-1.22 &&
cmake -B build -DCMAKE_BUILD_TYPE=Release &&
cmake --build build --parallel &&
cmake --install build
CIBW_BEFORE_ALL_MACOS: >
cd /tmp &&
curl -L https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.22.tar.gz | tar xz &&
cd libdeflate-1.22 &&
MACOSX_DEPLOYMENT_TARGET=11.0 cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 &&
cmake --build build --parallel &&
sudo cmake --install build
CIBW_BEFORE_ALL_WINDOWS: >
cd /d %TEMP% &&
curl -L -o libdeflate.tar.gz https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.22.tar.gz &&
tar xzf libdeflate.tar.gz &&
cd libdeflate-1.22 &&
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=C:/libdeflate -DLIBDEFLATE_BUILD_GZIP=OFF &&
cmake --build build --config Release --parallel &&
cmake --install build --config Release
CIBW_ENVIRONMENT_WINDOWS: LIBDEFLATE_DIR=C:/libdeflate
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
publish:
name: Publish to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
# Only publish on release, not on workflow_dispatch
if: github.event_name == 'release'
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1