135 lines (130 loc) · 4.63 KB
/
pypi_release.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
name: PyPI Release
on:
release:
types:
- published
push:
branches:
- master
jobs:
# from:
# https://github.com/bitcoindevkit/bdk-python/blob/master/.github/workflows/build.yml
# MIT
build-manylinux2014-x86_64-wheel:
name: 'Build Manylinux 2014 x86_64 wheel'
runs-on: ubuntu-latest
container:
image: quay.io/pypa/manylinux2014_x86_64
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
PLAT: manylinux2014_x86_64
PYBIN: '/opt/python/${{ matrix.python }}/bin'
strategy:
fail-fast: false
matrix:
python: # Update this list whenever the docker image is updated (check /opt/python/)
- cp37-cp37m
- cp38-cp38
- cp39-cp39
- cp310-cp310
- cp311-cp311
steps:
- uses: actions/checkout@v2
- name: Install python3-devel
run: yum install -y python3-devel wget
- name: Install SWIG
run: |
git clone https://github.com/swig/swig.git --branch v4.0.2
cd swig
./autogen.sh
./configure
make
make install
cd ..
rm -rf swig/
- name: Configure
run: |
cmake -S . -Bbuild -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON \
-DBUILD_PYTHON=ON -DBUILD_SHARED_LIBS=ON \
-DPython3_ROOT_DIR="/usr/" -DPython3_FIND_STRATEGY="LOCATION"
- name: Build
run: cmake --build build --config Release --target all -v
- name: install requirements
run: ${PYBIN}/pip install -r python/requirements.dev.txt
- name: build wheel
run: ${PYBIN}/pip wheel build/python/ --no-deps -w build/python/wheelhouse
- name: repair wheel
run: auditwheel repair build/python/wheelhouse/* --plat "$PLAT" -w build/python/wheelhouse-repaired
- name: test
run: |
"${PYBIN}/pip" install cspy --no-index -f build/python/wheelhouse-repaired/
"${PYBIN}/python3" -m unittest discover -s test/python/
- name: upload wheel
run: |
${PYBIN}/pip install twine
${PYBIN}/python3 -m twine upload build/python/wheelhouse-repaired/*
continue-on-error: true
macos-build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-10.15, macos-11, macos-13]
python-version: [3.9, "3.10", "3.11"]
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Configure
run: |
echo $pythonLocation
echo $pythonVersion
cmake -S . -Bbuild -DBUILD_TESTING=ON -DBUILD_PYTHON=ON -DBUILD_SHARED_LIBS=ON -DPython3_ROOT_DIR=${pythonLocation} -DPython_ROOT_DIR=${pythonLocation} -DPython3_FIND_STRATEGY=LOCATION
- name: Build
run: cmake --build build --config Release --target all -v
- name: Fix wheel and run python tests
run: |
python3 -m pip install delocate wheel
delocate-listdeps --all build/python/dist/*.whl
delocate-wheel -w wheelhouse -v build/python/dist/*.whl
cd build
ctest --verbose -R python_unittest
- name: upload wheel
run: |
python3 -m pip install twine
twine upload wheelhouse/*
continue-on-error: true
windows-build:
runs-on: windows-2019
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Configure
run: cmake -S. -Bbuild -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON=ON -DBUILD_TESTING=ON -DPython3_ROOT_DIR=$env:pythonLocation -DPython_ROOT_DIR=$env:pythonLocation -DPython3_FIND_STRATEGY=LOCATION -DPython3_FIND_REGISTRY=LAST
- name: Build
run: cmake --build build --config Release --target ALL_BUILD -- /verbosity:normal /maxcpucount
- name: Run python tests
run: |
cd build
ctest -C Release --verbose
- name: upload wheel
run: |
pip install twine
twine upload .\build\python\dist\*
continue-on-error: true