-
Notifications
You must be signed in to change notification settings - Fork 9
156 lines (130 loc) · 4.24 KB
/
release-python.yml
File metadata and controls
156 lines (130 loc) · 4.24 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
152
153
154
155
156
name: Build & Release to PyPI
run-name: "Release Python SDK ${{ github.ref_name }}"
on:
push:
tags:
- 'python/v*'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
linux:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Copy root LICENSE for maturin
run: cp LICENSE python/LICENSE
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install maturin
run: pip install maturin
- name: Build wheels (x86_64)
if: matrix.target == 'x86_64'
run: maturin build --release --manifest-path python/rust/Cargo.toml --out dist
- name: Install Zig (for aarch64)
if: matrix.target == 'aarch64'
run: |
wget -q https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz
tar -xf zig-linux-x86_64-0.13.0.tar.xz
echo "$(pwd)/zig-linux-x86_64-0.13.0" >> $GITHUB_PATH
- name: Build wheels (aarch64)
if: matrix.target == 'aarch64'
run: |
source "$HOME/.cargo/env"
rustup target add aarch64-unknown-linux-gnu
cargo install cargo-zigbuild
maturin build --release --target aarch64-unknown-linux-gnu --zig --manifest-path python/rust/Cargo.toml --out dist
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.target }}
path: dist
if-no-files-found: error
windows:
runs-on:
group: databricks-protected-runner-group
labels: windows-server-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Copy root LICENSE for maturin
run: cp LICENSE python/LICENSE
shell: bash
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: pwsh
- name: Install maturin
run: pip install maturin
- name: Build wheels
run: maturin build --release --manifest-path python/rust/Cargo.toml --out dist
shell: bash
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows
path: dist
if-no-files-found: error
sdist:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Copy root LICENSE for maturin
run: cp LICENSE python/LICENSE
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install maturin
run: pip install maturin
- name: Build source distribution
run: maturin sdist --manifest-path python/rust/Cargo.toml --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist
if-no-files-found: error
release:
name: Release to PyPI
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
if: startsWith(github.ref, 'refs/tags/python/')
needs: [linux, windows, sdist]
permissions:
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- name: List artifacts for verification
run: ls -lh dist/
- name: Publish to PyPI (Trusted Publishing)
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true