Skip to content

Commit 5abbec0

Browse files
committed
build: Update macOS 13 images for Python releases
Signed-off-by: Dmitry Dygalo <dmitry@dygalo.dev>
1 parent c61a526 commit 5abbec0

File tree

1 file changed

+40
-28
lines changed

1 file changed

+40
-28
lines changed

.github/workflows/python-release.yml

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
push:
55
tags:
66
- python-v*
7+
pull_request:
8+
branches:
9+
- master
710
workflow_dispatch:
811

912
defaults:
@@ -51,46 +54,48 @@ jobs:
5154
path: crates/jsonschema-py/dist
5255

5356
macos-x86_64:
54-
runs-on: macos-13
57+
runs-on: macos-15
5558
steps:
5659
- uses: actions/checkout@v5
5760
- uses: astral-sh/setup-uv@v7
58-
- uses: actions/setup-python@v6
59-
with:
60-
python-version: ${{ env.PYTHON_ABI_VERSION }}
61-
architecture: x64
61+
- name: Install Python
62+
run: uv python install ${{ env.PYTHON_ABI_VERSION }}
6263
- uses: dtolnay/rust-toolchain@stable
64+
with:
65+
targets: x86_64-apple-darwin
6366
- name: Build wheels - x86_64
6467
uses: messense/maturin-action@v1
6568
with:
6669
target: x86_64
6770
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter ${{ env.PYTHON_ABI_VERSION }}
6871
- name: Install built wheel - x86_64
6972
run: |
70-
uv pip install --python ${{ env.PYTHON_ABI_VERSION }} dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
73+
uv venv --python ${{ env.PYTHON_ABI_VERSION }}
74+
uv pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
7175
- name: Upload wheels
7276
uses: actions/upload-artifact@v5
7377
with:
7478
name: wheel-macos-x86_64
7579
path: dist
7680

7781
macos-universal:
78-
runs-on: macos-13
82+
runs-on: macos-15
7983
steps:
8084
- uses: actions/checkout@v5
8185
- uses: astral-sh/setup-uv@v7
82-
- uses: actions/setup-python@v6
83-
with:
84-
python-version: ${{ env.PYTHON_ABI_VERSION }}
85-
architecture: x64
86+
- name: Install Python
87+
run: uv python install ${{ env.PYTHON_ABI_VERSION }}
8688
- uses: dtolnay/rust-toolchain@stable
89+
with:
90+
targets: aarch64-apple-darwin,x86_64-apple-darwin
8791
- name: Build wheels - universal2
8892
uses: messense/maturin-action@v1
8993
with:
9094
args: --release -m crates/jsonschema-py/Cargo.toml --target universal2-apple-darwin --out dist --interpreter ${{ env.PYTHON_ABI_VERSION }}
9195
- name: Install built wheel - universal2
9296
run: |
93-
uv pip install --python ${{ env.PYTHON_ABI_VERSION }} dist/${{ env.PACKAGE_NAME }}-*universal2.whl --force-reinstall
97+
uv venv --python ${{ env.PYTHON_ABI_VERSION }}
98+
uv pip install dist/${{ env.PACKAGE_NAME }}-*universal2.whl --force-reinstall
9499
- name: Upload wheels
95100
uses: actions/upload-artifact@v5
96101
with:
@@ -118,7 +123,8 @@ jobs:
118123
- name: Install built wheel
119124
shell: bash
120125
run: |
121-
uv pip install --python ${{ env.PYTHON_ABI_VERSION }} dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
126+
uv venv --python ${{ env.PYTHON_ABI_VERSION }}
127+
uv pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
122128
- name: Upload wheels
123129
uses: actions/upload-artifact@v5
124130
with:
@@ -145,7 +151,8 @@ jobs:
145151
- name: Install built wheel on native architecture
146152
if: matrix.target == 'x86_64'
147153
run: |
148-
uv pip install --python ${{ env.PYTHON_ABI_VERSION }} dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
154+
uv venv --python ${{ env.PYTHON_ABI_VERSION }}
155+
uv pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
149156
- uses: uraimo/run-on-arch-action@v3
150157
if: matrix.target == 'aarch64'
151158
name: Install built wheel on ARM architecture
@@ -175,7 +182,7 @@ jobs:
175182
strategy:
176183
matrix:
177184
include:
178-
- os: macos-13
185+
- os: macos-15
179186
target: x86_64
180187
artifact: wheel-macos-pypy
181188
manylinux: ''
@@ -194,37 +201,42 @@ jobs:
194201

195202
steps:
196203
- uses: actions/checkout@v5
197-
- name: Install uv and cache PyPy
198-
uses: astral-sh/setup-uv@v7
204+
- uses: astral-sh/setup-uv@v7
205+
- uses: actions/setup-python@v6
199206
with:
200207
python-version: ${{ env.PYPY_VERSION }}
201-
enable-cache: true
202-
cache-python: true
203-
cache-suffix: pypy-${{ matrix.os }}-${{ matrix.target }}
204-
- name: Ensure PyPy interpreter
208+
- name: Get Python path
209+
shell: bash
205210
run: |
206-
uv python install ${{ env.PYPY_VERSION }}
207-
interp=$(uv python find ${{ env.PYPY_VERSION }})
208-
echo "PYPY_INTERPRETER=$interp" >> "$GITHUB_ENV"
209-
"$interp" --version
211+
if [[ "$RUNNER_OS" == "Windows" ]]; then
212+
python_path=$(python -c "import sys; print(sys.executable)")
213+
else
214+
python_path=$(which python || which python3)
215+
fi
216+
echo "PYTHON_PATH=$python_path" >> "$GITHUB_ENV"
217+
"$python_path" --version
210218
- uses: dtolnay/rust-toolchain@stable
219+
- name: Add macOS x86_64 target
220+
if: runner.os == 'macOS'
221+
run: rustup target add x86_64-apple-darwin
211222
- name: Build wheels - PyPy (manylinux)
212223
if: ${{ matrix.manylinux != '' }}
213224
uses: messense/maturin-action@v1
214225
with:
215226
target: ${{ matrix.target }}
216227
manylinux: ${{ matrix.manylinux }}
217-
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter ${{ env.PYPY_INTERPRETER }}
228+
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter ${{ env.PYPY_VERSION }}
218229
- name: Build wheels - PyPy
219230
if: ${{ matrix.manylinux == '' }}
220231
uses: messense/maturin-action@v1
221232
with:
222233
target: ${{ matrix.target }}
223-
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter ${{ env.PYPY_INTERPRETER }}
234+
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter ${{ env.PYTHON_PATH }}
224235
- name: Install built wheel - PyPy
225236
if: ${{ matrix.target != 'aarch64' }}
226237
run: |
227-
uv pip install --python "${{ env.PYPY_INTERPRETER }}" dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
238+
uv venv --python ${{ env.PYPY_VERSION }}
239+
uv pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
228240
- name: Upload wheels
229241
uses: actions/upload-artifact@v5
230242
with:

0 commit comments

Comments
 (0)