-
Notifications
You must be signed in to change notification settings - Fork 3
133 lines (116 loc) · 4.49 KB
/
deploypypi.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
---
name: Build and deploy to PyPI/testPyPI
on:
push:
merge_group:
release:
types: [published, edited]
repository_dispatch:
types: [trigger_checks]
workflow_dispatch:
jobs:
build_wheels:
name: Build wheels for ${{ matrix.target.os_arch }}
strategy:
matrix:
target:
[
{os_arch: "manylinux_x86_64", runs-on: "ubuntu-24.04"},
{os_arch: "manylinux_aarch64", runs-on: "ubuntu-24.04-arm"},
# uncomment when pyarrow supplies wheels for musllinux
# {os_arch: "musllinux_x86_64", runs-on: "ubuntu-24.04"},
# {os_arch: "musllinux_aarch64", runs-on: "ubuntu-24.04-arm"},
{os_arch: "macosx_arm64", runs-on: "macos-15"},
]
fail-fast: false
runs-on: ${{ matrix.target.runs-on }}
env:
CIBW_ENVIRONMENT_PASS_LINUX: SETUPTOOLS_SCM_PRETEND_VERSION_FOR_ARTISTOOLS
CIBW_BUILD: 'cp3*-${{ matrix.target.os_arch }}'
MACOSX_DEPLOYMENT_TARGET: 15.0
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- name: Cache cargo and rust build
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
rust/target/
key: cibuildwheel-rust-target-${{ matrix.target.os_arch }}-${{ hashFiles('**/Cargo.lock') }}-${{ github.run_id }}
restore-keys: |
cibuildwheel-rust-target-${{ matrix.target.os_arch }}-${{ hashFiles('**/Cargo.lock') }}-
cibuildwheel-rust-target-${{ matrix.target.os_arch }}-
- name: Strip dev tag from version
run: |
python3 -m pip install --upgrade uv setuptools_scm[toml]
echo "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_ARTISTOOLS=$(python3 -m setuptools_scm --strip-dev)" >> $GITHUB_ENV
- name: Build wheels
uses: pypa/[email protected]
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.target.os_arch }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
python3 -m pip install --upgrade uv setuptools_scm[toml]
echo "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_ARTISTOOLS=$(python3 -m setuptools_scm --strip-dev)" >> $GITHUB_ENV
- name: Build sdist
run: |
uv build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
testdeploy:
name: Test upload to TestPyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-24.04
environment: test
permissions:
id-token: write
if: startsWith(github.ref , 'refs/tags/v') != true
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: false
repository-url: https://test.pypi.org/legacy/
deploy:
name: Upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-24.04
environment: release
permissions:
id-token: write
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: false