-
Notifications
You must be signed in to change notification settings - Fork 0
175 lines (151 loc) · 6.07 KB
/
Copy pathon-release-main.yml
File metadata and controls
175 lines (151 loc) · 6.07 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: release-main
on:
workflow_dispatch:
inputs:
debug_tmate:
description: "Open an interactive tmate debug session if a job fails"
type: boolean
default: false
release:
types: [published]
branches: [main]
jobs:
build:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, ubuntu-24.04-arm, macos-15]
glibc: [2_28, 2_34]
# glibc (manylinux) only applies to the Linux builds. Exclude the duplicate
# 2_34 combination for the non-Linux OSes so macOS/Windows build once each
# (otherwise they would build the identical wheel twice, once per glibc value).
exclude:
- os: windows-latest
glibc: 2_34
- os: macos-15
glibc: 2_34
fail-fast: false
runs-on: ${{ matrix.os }}
# Successful builds take ~35-60 min; cap well under the 6h default so a stuck
# job (e.g. a hung publish) fails fast instead of burning a runner for 6 hours.
timeout-minutes: 180
defaults:
run:
shell: bash
steps:
- name: Check out
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 2
- name: remove nativelibs and localsolvers
run: rm -rf vcell_submodule/nativelibs vcell_submodule/localsolvers
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: abatilo/actions-poetry@v3
- name: setup graalvm for static native build
uses: graalvm/setup-graalvm@v1
with:
java-version: "23"
distribution: "graalvm-community"
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: "true"
cache: "maven"
- name: Set MACOSX_DEPLOYMENT_TARGET used by cibuildwheel
if: ${{ startsWith(matrix.os, 'macos') }}
run: |
echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> $GITHUB_ENV
echo "NATIVE_IMAGE_OPTIONS=--native-compiler-options=-mmacosx-version-min=13.0 -H:NativeLinkerOption=-mmacosx-version-min=13.0" >> $GITHUB_ENV
- name: Set cibuildwheel archs
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
ARCH=$(uname -m)
echo "ARCH_DEF=$ARCH" >> $GITHUB_ENV
echo "MANYLINUX_IMAGE_TARGET=ghcr.io/virtualcell/manylinux_${{ matrix.glibc }}_$ARCH:latest" >> $GITHUB_ENV
# libvcell is pure Python + a ctypes-loaded GraalVM native library (no CPython
# extension), so the wheel is not tied to a Python version. Build a single
# interpreter per platform and retag it to py3-none below.
echo "CIBW_BUILD_TARGETS=cp311-*" >> $GITHUB_ENV
- name: Run cibuildwheel (Ubuntu, x86_64)
uses: pypa/cibuildwheel@v3.4.0
if: ${{ startsWith(matrix.os, 'ubuntu') && env.ARCH_DEF == 'x86_64' }}
env:
CIBW_BUILD: "${{ env.CIBW_BUILD_TARGETS }}"
CIBW_MANYLINUX_X86_64_IMAGE: "${{ env.MANYLINUX_IMAGE_TARGET }}"
# CIBW_BUILD_VERBOSITY_LINUX: 2
- name: Run cibuildwheel (Ubuntu, aarch64)
uses: pypa/cibuildwheel@v3.4.0
if: ${{ startsWith(matrix.os, 'ubuntu') && env.ARCH_DEF == 'aarch64' }}
env:
CIBW_BUILD: "${{ env.CIBW_BUILD_TARGETS }}"
CIBW_MANYLINUX_AARCH64_IMAGE: "${{ env.MANYLINUX_IMAGE_TARGET }}"
# CIBW_BUILD_VERBOSITY_LINUX: 2
- name: Run cibuildwheel
if: ${{ !startsWith(matrix.os, 'ubuntu') }}
run: |
pip install cibuildwheel
cibuildwheel --debug-traceback --output-dir wheelhouse
env:
CIBW_BUILD: "cp311-*"
- name: Retag wheels as py3-none (ABI-independent, one wheel per platform)
run: |
python -m pip install --upgrade wheel
for whl in wheelhouse/*.whl; do
echo "retagging $whl"
# Change cp311-cp311 -> py3-none, preserving the (manylinux/macosx/win) platform tag.
# The bundled native lib is loaded via ctypes, so it has no CPython ABI dependency
# and the resulting wheel installs on any supported Python 3.x. Requires-Python in
# the wheel metadata still enforces the >=3.10 floor.
python -m wheel tags --python-tag py3 --abi-tag none --remove "$whl"
done
ls -l wheelhouse
- name: Copy wheels to dist directory
run: |
mkdir -p dist
cp wheelhouse/*.whl dist/
- name: Publish to PyPI (dry run)
run: |
poetry config pypi-token.pypi "${{ secrets.PYPI_TOKEN }}"
poetry publish --dry-run
- name: Publish to PyPI (release-only - push to PyPI)
run: |
poetry config pypi-token.pypi "${{ secrets.PYPI_TOKEN }}"
poetry publish --skip-existing
if: github.event_name == 'release'
# Only open a tmate session when explicitly requested via workflow_dispatch.
# On a release event `inputs.debug_tmate` is false, so a failed job fails fast
# instead of holding the runner open until the 6h job timeout. The step is also
# bounded by timeout-minutes as a safety net.
- name: Setup tmate
if: ${{ failure() && inputs.debug_tmate }}
timeout-minutes: 30
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
deploy-docs:
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: abatilo/actions-poetry@v3
- name: setup graalvm for static native build
uses: graalvm/setup-graalvm@v1
with:
java-version: "23"
distribution: "graalvm-community"
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: "true"
cache: "maven"
- name: Install python dependencies
run: poetry install --no-interaction
- name: Deploy documentation
run: poetry run mkdocs gh-deploy --force