-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (133 loc) · 4.43 KB
/
python-publish.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Build and Publish Python Wheels
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [published]
workflow_dispatch:
jobs:
build_wheels_macos:
name: Build wheels on macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install HDF5
run: |
brew install hdf5
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
args: --release --out dist --find-interpreter
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos
path: dist/*.whl
- name: Install package from wheel (macos-latest)
run: |
python -m pip install --upgrade pip
python -m pip install pytest
# List directory contents to debug
echo "Contents of dist directory:"
find dist -type f -name "*.whl" | sort
python --version
pip install dist/hdf5_nuclear_data_reader-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
- name: Verify import
run: |
python -c "import hdf5_nuclear_data_reader; print('Import successful')"
- name: Run tests
run: |
pytest -v
build_wheels_windows:
name: Build wheels on Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install h5py for HDF5 support
run: |
pip install h5py
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
args: --release --out dist --find-interpreter
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows
path: dist/*.whl
- name: Install package from wheel (windows-latest)
run: |
python -m pip install --upgrade pip
python -m pip install pytest
# List directory contents to debug
echo "Contents of dist directory:"
dir dist -Filter *.whl | Sort-Object Name
python --version
pip install dist/hdf5_nuclear_data_reader-0.1.0-cp39-cp39-win_amd64.whl
- name: Verify import
run: |
python -c "import hdf5_nuclear_data_reader; print('Import successful')"
- name: Run tests
run: |
pytest -v
build_wheels_manylinux:
name: Build manylinux wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build manylinux wheels
uses: PyO3/maturin-action@v1
with:
target: x86_64-unknown-linux-gnu
manylinux: 2014
args: --release --out dist --find-interpreter
before-script-linux: |
# Install HDF5 development files
yum install -y hdf5-devel
# Set environment variables for HDF5
export HDF5_DIR=/usr
# Ensure the built-in tryrun results are used (from your build.rs)
export HDF5_DISABLE_VERSION_CHECK=1
- name: Upload manylinux wheels
uses: actions/upload-artifact@v4
with:
name: wheels-manylinux
path: dist/*.whl
- name: Install package from wheel (ubuntu-latest)
run: |
python -m pip install --upgrade pip
python -m pip install pytest
# List directory contents to debug
echo "Contents of dist directory:"
find dist -type f -name "*.whl" | sort
python --version
pip install dist/hdf5_nuclear_data_reader-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- name: Verify import
run: |
python -c "import hdf5_nuclear_data_reader; print('Import successful')"
- name: Run tests
run: |
pytest -v
publish:
name: Publish package
needs: [build_wheels_manylinux, build_wheels_windows, build_wheels_macos]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
path: dist
- name: Prepare distribution files
run: |
mkdir -p dist_combined
find dist -name "*.whl" -exec cp {} dist_combined \;
ls -la dist_combined/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: dist_combined/
skip-existing: true