-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (76 loc) · 2.46 KB
/
Copy pathpython-release.yml
File metadata and controls
81 lines (76 loc) · 2.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
name: Python Release
on:
workflow_dispatch:
inputs:
release_tag:
description: Existing version tag to publish, for example v0.1.0
required: true
type: string
permissions:
contents: read
jobs:
build-wheel:
name: Build macOS arm64 wheel
runs-on: macos-14
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.release_tag }}
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.93.0
- uses: Swatinem/rust-cache@v2
- name: Match release tag to package version
env:
RELEASE_TAG: ${{ inputs.release_tag }}
run: |
python - <<'PY'
import os
import pathlib
import tomllib
workspace = tomllib.loads(pathlib.Path("Cargo.toml").read_text())
project = tomllib.loads(pathlib.Path("bindings/python/pyproject.toml").read_text())
rust_version = workspace["workspace"]["package"]["version"]
python_version = project["project"]["version"]
if python_version != rust_version:
raise SystemExit(
f"Python version {python_version!r} must match Rust {rust_version!r}"
)
expected = f"v{python_version}"
actual = os.environ["RELEASE_TAG"]
if actual != expected:
raise SystemExit(f"release tag {actual!r} must be {expected!r}")
PY
- uses: pypa/cibuildwheel@v4.1.1
env:
CIBW_TEST_COMMAND: python -I bindings/python/tests/installed_smoke.py
CIBW_TEST_SOURCES: bindings/python/tests/installed_smoke.py
with:
package-dir: bindings/python
output-dir: wheelhouse
- name: Verify installed wheel
run: python bindings/python/tests/verify_wheel.py wheelhouse/*.whl
- uses: actions/upload-artifact@v4
with:
name: zeppelin-embed-pypi
path: wheelhouse/*.whl
if-no-files-found: error
publish:
name: Publish wheel to PyPI
needs: build-wheel
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/zeppelin-embed
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: zeppelin-embed-pypi
path: dist
- name: Publish package distributions
uses: pypa/gh-action-pypi-publish@release/v1