-
Notifications
You must be signed in to change notification settings - Fork 10
145 lines (135 loc) Β· 4.46 KB
/
pythonPublish.yml
File metadata and controls
145 lines (135 loc) Β· 4.46 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
136
137
138
139
140
141
142
143
144
name: Build & Upload G2S to PyPI
on:
workflow_dispatch:
jobs:
build-sdist:
name: π¦ Source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: |
pip install --upgrade pip build twine
cd build
make python-sdist
cd python-build
twine upload --repository pypi dist/*.tar.gz --skip-existing --verbose
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
build-linux:
name: π§ Linux wheels (manylinux)
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Build inside manylinux
run: |
PYVER=$(echo ${{ matrix.python }} | tr -d .)
PYTAG="cp${PYVER}-cp${PYVER}"
echo "π§± Building for $PYTAG using manylinux_2_28"
docker run --rm -v $PWD:/io quay.io/pypa/manylinux_2_28_x86_64 bash -c "
set -e
echo 'π Installing build dependencies...'
/opt/python/${PYTAG}/bin/python -m pip install --upgrade pip build wheel numpy pyzmq twine auditwheel
echo 'ποΈ Building wheel...'
cd /io/build
make PYTHON=/opt/python/${PYTAG}/bin/python python-wheel
echo 'π§© Running auditwheel repair...'
cd /io/build/python-build/dist
auditwheel repair *.whl -w .
rm -f *linux_x86_64.whl
echo 'β
Listing final wheels:'
ls -lh
"
- name: Test import
run: |
pip install build/python-build/dist/*.whl
python -c "import g2s; print('β
g2s import OK')"
- name: Upload to TestPyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
cd build/python-build
python -m pip install --upgrade twine
twine upload --repository pypi dist/*.whl --skip-existing --verbose
build-macos:
name: π macOS wheels
runs-on: macos-latest
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
pip install --upgrade pip build wheel numpy pyzmq twine
- name: Build wheel
run: |
cd build
make python-wheel
- name: Test import
run: |
pip install build/python-build/dist/*.whl
python -c "import g2s; print('β
g2s import OK')"
- name: Upload to TestPyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
cd build/python-build
twine upload --repository pypi dist/*.whl --skip-existing --verbose
build-windows:
name: πͺ Windows wheels
runs-on: windows-latest
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip build wheel numpy pyzmq twine
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Install Windows dependencies
run: |
cd build/python-build
cmd.exe /c setup_Win_compile_all.bat
- name: Build wheel
run: |
choco install make
refreshenv
cd build
make python-wheel
- name: Test import
shell: pwsh
run: |
$wheel = Get-ChildItem build/python-build/dist/*.whl | Select-Object -First 1
Write-Host "Installing wheel: $($wheel.FullName)"
pip install "$($wheel.FullName)"
python -c "import g2s; print('g2s import OK')"
- name: Upload to TestPyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
cd build/python-build
twine upload --repository pypi dist/*.whl --skip-existing --verbose