-
Notifications
You must be signed in to change notification settings - Fork 30
130 lines (123 loc) · 3.69 KB
/
pypi_deploy.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
name: Deploy Python Distribution
on:
push:
branches: [master]
pull_request:
branches: [master]
release:
types: [published]
workflow_dispatch:
jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install boost
run: |
sudo apt-get update
sudo apt-get install libboost-dev
- name: Install pypa/build
run: |
python -m pip install build --user
- name: Build source tarball
run: |
python -m build --sdist --outdir dist/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sdist
path: ./dist/**
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-13 # intel
- macos-14 # apple silicon
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_SKIP: pp* *musllinux* cp36-* cp37-*
CIBW_BEFORE_BUILD_LINUX: yum -y install boost-devel
CIBW_ARCHS_LINUX: "x86_64"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_BEFORE_BUILD_MACOS: brew install boost # should be ok as we only use headers
MACOSX_DEPLOYMENT_TARGET: 10.15
with:
output-dir: dist
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./dist/*.whl
test_wheels:
name: Test wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: [build_wheels]
strategy:
matrix:
os:
- ubuntu-latest
- macos-13 # intel
- macos-14 # apple silicon
steps:
- name: Download wheel
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Test wheel
run: |
python -m venv .venv
. .venv/bin/activate
python -m pip install --find-links ./dist serialbox4py
python -c "from serialbox import *"
# publish-pypi:
# name: Publish Python distribution to pypi.org
# runs-on: ubuntu-latest
# needs: [build_wheels, build_sdist]
# if: ${{ github.event_name == 'workflow-dispatch' }}
# environment:
# name: pypi
# url: https://pypi.org/project/serialbox4py/
# permissions:
# id-token: write
# steps:
# - name: Download wheel
# uses: actions/download-artifact@v4
# with:
# path: dist
# merge-multiple: true
# - name: Publish distribution to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://pypi.org/legacy/
publish-test-pypi:
name: Publish Python distribution to test.pypi.org
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
if: ${{ github.event_name == 'workflow_dispatch' }} # TODO: once working, enable line below
# if: ${{ github.event_name == 'release' }} # triggered by releasing on github, test first before manually triggering the deployment to PyPI (see release documentation)
environment:
name: testpypi
url: https://test.pypi.org/project/serialbox4py/
permissions:
id-token: write
steps:
- name: Download wheel
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/