-
Notifications
You must be signed in to change notification settings - Fork 1
151 lines (139 loc) · 4.61 KB
/
Copy pathrelease.yml
File metadata and controls
151 lines (139 loc) · 4.61 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
145
146
147
148
149
150
151
name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
rid: linux-x64
target: x86_64-unknown-linux-gnu
ext: .so
python-version: '3.9'
- os: ubuntu-latest
rid: linux-x64
target: x86_64-unknown-linux-gnu
ext: .so
python-version: '3.13t'
freethreaded: true
- os: ubuntu-latest
rid: linux-x64
target: x86_64-unknown-linux-gnu
ext: .so
python-version: '3.14t'
freethreaded: true
- os: macos-latest
rid: universal2
target: universal2-apple-darwin
ext: .dylib
python-version: '3.9'
- os: macos-latest
rid: universal2
target: universal2-apple-darwin
ext: .dylib
python-version: '3.13t'
freethreaded: true
- os: macos-latest
rid: universal2
target: universal2-apple-darwin
ext: .dylib
python-version: '3.14t'
freethreaded: true
- os: windows-latest
rid: win-x64
target: x86_64-pc-windows-msvc
ext: .dll
python-version: '3.9'
- os: windows-latest
rid: win-x64
target: x86_64-pc-windows-msvc
ext: .dll
python-version: '3.13t'
freethreaded: true
- os: windows-latest
rid: win-x64
target: x86_64-pc-windows-msvc
ext: .dll
python-version: '3.14t'
freethreaded: true
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Verify version matches tag
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
# Extract version from Cargo.toml
CARGO_VERSION=$(grep -m1 '^version =' native_fisher_py/Cargo.toml | cut -d '"' -f 2)
echo "Tag version: $TAG_VERSION"
echo "Cargo version: $CARGO_VERSION"
if [[ "$TAG_VERSION" != "$CARGO_VERSION" ]]; then
echo "Error: Tag version ($TAG_VERSION) does not match Cargo.toml version ($CARGO_VERSION)"
exit 1
fi
- name: Install NativeAOT Dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y clang zlib1g-dev libkrb5-dev
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Publish NativeAOT dylib
shell: bash
run: |
cd native/ThermoNativeReader
if [[ "${{ matrix.rid }}" == "universal2" ]]; then
dotnet publish -r osx-x64 -c Release -p:PublishAot=true
dotnet publish -r osx-arm64 -c Release -p:PublishAot=true
mkdir -p ../../native_fisher_py/python/native_fisher_py/
lipo -create \
bin/Release/net8.0/osx-x64/publish/ThermoNativeReader.dylib \
bin/Release/net8.0/osx-arm64/publish/ThermoNativeReader.dylib \
-output ../../native_fisher_py/python/native_fisher_py/ThermoNativeReader.dylib
else
dotnet publish -r ${{ matrix.rid }} -c Release -p:PublishAot=true
cp bin/Release/net8.0/${{ matrix.rid }}/publish/ThermoNativeReader${{ matrix.ext }} ../../native_fisher_py/python/native_fisher_py/
fi
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Copy README
run: cp README.md native_fisher_py/
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
command: build
args: --release --out dist --manifest-path native_fisher_py/Cargo.toml ${{ matrix.freethreaded && '--no-default-features' || '' }}
target: ${{ matrix.target }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.python-version }}
path: dist/*.whl
publish:
name: Publish to PyPI
needs: [build]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
id-token: write # Mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true