-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (99 loc) · 3.67 KB
/
Copy pathpython-wheels.yaml
File metadata and controls
103 lines (99 loc) · 3.67 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
name: Python API Wheels
on:
workflow_dispatch:
jobs:
build-wheels:
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ matrix.python-version }}
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install capnp (macOS)
if: runner.os == 'macOS'
run: brew install capnp
- name: Install capnp (Windows)
if: runner.os == 'Windows'
run: choco install capnproto
- name: Build wheels (Linux)
if: runner.os == 'Linux'
uses: PyO3/maturin-action@v1
with:
command: build
args: --release --manifest-path gen-python/Cargo.toml --features extension-module --interpreter python${{ matrix.python-version }} --out gen-python/target/wheels
sccache: true
manylinux: auto
container: quay.io/pypa/manylinux_2_28_x86_64:latest
before-script-linux: |
yum install -y epel-release
yum install -y clang llvm-devel sqlite-devel capnproto capnproto-devel pkgconfig mold
cargo install capnpc --version ^0.24 --locked
export PATH="/root/.cargo/bin:${PATH}"
export CAPNPC_RUST="/root/.cargo/bin/capnpc-rust"
mkdir -p gen-capnp-schemas/src/generated
(cd gen-capnp-schemas && capnp compile -I . -orust:src/generated gen-core.capnp gen-models.capnp gen-schema.capnp)
ls -la gen-capnp-schemas/src/generated
working-directory: .
env:
CAPNP: /usr/bin/capnp
CAPNPC_RUST: /root/.cargo/bin/capnpc-rust
LIBCLANG_PATH: /usr/lib64
- name: Build wheels (macOS, Windows)
if: runner.os != 'Linux'
uses: PyO3/maturin-action@v1
with:
command: build
args: --release --manifest-path gen-python/Cargo.toml --features extension-module --interpreter ${{ steps.setup-python.outputs.python-path }} --out gen-python/target/wheels
sccache: true
working-directory: .
- name: Upload wheels to releases
if: runner.os != 'Windows'
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
run: |
gh release upload "${TAG}" gen-python/target/wheels/*.whl
- name: Upload wheels to releases (Windows)
if: runner.os == 'Windows'
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
run: |
$ErrorActionPreference = 'Stop'
gh release upload "$env:TAG" "gen-python/target/wheels/*.whl"
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-py${{ matrix.python-version }}
path: gen-python/target/wheels/*.whl
if-no-files-found: error
trigger-pypi-publish:
needs: build-wheels
runs-on: ubuntu-latest
if: ${{ needs.build-wheels.result == 'success' }}
permissions:
actions: write
contents: read
env:
TAG: ${{ github.ref_name }}
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
steps:
- name: Ensure tag is available
run: |
if [ -z "$TAG" ]; then
echo "TAG is empty; cannot trigger publish-pypi-tag workflow." >&2
exit 1
fi
- name: Trigger publish-pypi-tag workflow
run: |
gh workflow run publish-pypi-tag.yaml --repo "$REPO" --ref "$TAG" -f tag="$TAG"