Skip to content

Commit 3b7417f

Browse files
committed
Update release workflow
1 parent 4b209dd commit 3b7417f

File tree

3 files changed

+114
-21
lines changed

3 files changed

+114
-21
lines changed

.github/workflows/build-wheels.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
# id-token: write
116116
runs-on: ubuntu-latest
117117
steps:
118-
- name: Download artefacts
118+
- name: Download artifacts
119119
uses: actions/download-artifact@v5
120120
with:
121121
pattern: cibw-*

.github/workflows/deploy.yaml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,15 @@ jobs:
2424
# this permission is mandatory for trusted publishing with PyPI
2525
id-token: write
2626
steps:
27-
- name: Check out repository
28-
uses: actions/checkout@v4
27+
# TODO: figure out how to download from release step
28+
- name: Download artifacts
29+
uses: actions/download-artifact@v5
2930
with:
30-
fetch-depth: 0
31-
- uses: ./.github/actions/setup
32-
with:
33-
python-version: ${{ matrix.python-version }}
34-
uv-dependency-install-flags: "--all-extras --group dev"
31+
pattern: cibw-*
32+
path: dist
33+
merge-multiple: true
3534
- name: Publish to PyPI
3635
run: |
37-
# TODO: move to using cibuildwheel so we have wheels for multiple platforms and python versions
38-
# starting docs: https://cibuildwheel.pypa.io/en/stable/
39-
uv build --sdist
40-
uv publish
41-
# Just in case, undo the changes to `pyproject.toml`
42-
git restore --staged . && git restore .
36+
# uv publish
37+
# # Just in case, undo the changes to `pyproject.toml`
38+
# git restore --staged . && git restore .

.github/workflows/release.yaml

Lines changed: 104 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,111 @@ name: Release
22

33
on:
44
push:
5-
tags: ['v*']
5+
# tags: ['v*']
66

77
defaults:
88
run:
99
shell: bash
1010

1111
jobs:
12+
build-wheels:
13+
name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }}
14+
runs-on: ${{ matrix.os }}
15+
env:
16+
# 3.9, 3.10 seem to not be happy on windows arm64
17+
# because you can't install numpy from a wheel for the build environment
18+
# (and we're not going to try recompiling from source)
19+
CIBW_SKIP: "cp39-win_arm64 cp310-win_arm64"
20+
# TODO: consider turning this on
21+
# CIBW_ENABLE: cpython-freethreading
22+
CIBW_BEFORE_BUILD_WINDOWS: >-
23+
pip install delvewheel
24+
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >-
25+
delvewheel repair -w {dest_dir} {wheel}
26+
CIBW_BEFORE_TEST: >-
27+
pip install -r {project}/requirements-only-tests-min-locked.txt
28+
CIBW_TEST_COMMAND: >-
29+
pytest {project}/tests
30+
MACOSX_DEPLOYMENT_TARGET: "13.0"
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
include:
35+
- os: ubuntu-latest
36+
cibw_archs: "x86_64"
37+
- os: ubuntu-24.04-arm
38+
cibw_archs: "aarch64"
39+
- os: windows-2025
40+
cibw_archs: "AMD64"
41+
- os: windows-11-arm
42+
cibw_archs: "ARM64"
43+
- os: macos-13
44+
cibw_archs: "x86_64"
45+
- os: macos-14
46+
cibw_archs: "arm64"
47+
48+
steps:
49+
- uses: actions/checkout@v5
50+
- name: Install Fortran compiler - MacOS
51+
# When building on Mac, we need to have a Fortran compiler
52+
if: ${{ startsWith(matrix.os, 'macos') }}
53+
uses: fortran-lang/setup-fortran@v1
54+
id: setup-fortran-macos
55+
with:
56+
# TODO: figure out whether we need/want to use other compilers too
57+
compiler: "gcc"
58+
version: "13"
59+
- name: Specify LLVM - windows-arm
60+
if: ${{ matrix.os == 'windows-11-arm' }}
61+
shell: pwsh
62+
run: |
63+
Invoke-WebRequest https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.8/LLVM-20.1.8-woa64.exe -OutFile LLVM-woa64.exe
64+
Start-Process -FilePath ".\LLVM-woa64.exe" -ArgumentList "/S" -Wait
65+
66+
$env:PATH = "C:\Program Files\LLVM\bin;" + $env:PATH
67+
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
68+
echo "CC=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
69+
echo "CXX=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
70+
echo "FC=flang-new" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
71+
echo "AR=llvm-lib.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
72+
- name: Build wheels
73+
uses: pypa/cibuildwheel@v3.1.4 # matplotlib had v3.1.3
74+
with:
75+
package-dir: .
76+
output-dir: wheelhouse
77+
config-file: "{package}/pyproject.toml"
78+
env:
79+
CIBW_ARCHS: ${{ matrix.cibw_archs }}
80+
- name: Upload wheels
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: cibw-wheels-${{ matrix.os }}-${{ matrix.cibw_archs }}
84+
path: ./wheelhouse/*.whl
85+
if-no-files-found: error
86+
87+
make-sdist:
88+
name: Make source distribution
89+
runs-on: "ubuntu-latest"
90+
steps:
91+
- name: Check out repository
92+
uses: actions/checkout@v4
93+
with:
94+
fetch-depth: 0
95+
- uses: ./.github/actions/setup
96+
with:
97+
python-version: ${{ matrix.python-version }}
98+
uv-dependency-install-flags: "--all-extras --group dev"
99+
- name: Create source distribution
100+
run: uv build --sdist
101+
- name: Upload the source distribution artefact
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: cibw-sdist
105+
path: dist/*.tar.gz
106+
12107
draft-release:
13108
name: Create draft release
109+
needs: [ build-wheels, make-sdist ]
14110
strategy:
15111
matrix:
16112
os: [ "ubuntu-latest" ]
@@ -29,11 +125,6 @@ jobs:
29125
run: |
30126
PROJECT_VERSION=`sed -ne 's/^version = "\([0-9\.]*\)"/\1/p' pyproject.toml`
31127
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
32-
- name: Build package for PyPI
33-
run: |
34-
uv build
35-
# Just in case, undo the changes to `pyproject.toml`
36-
git restore --staged . && git restore .
37128
- name: Generate Release Notes
38129
run: |
39130
echo "" >> ".github/release_template.md"
@@ -44,12 +135,18 @@ jobs:
44135
echo "## Changes" >> ".github/release_template.md"
45136
echo "" >> ".github/release_template.md"
46137
git log $(git describe --tags --abbrev=0 HEAD^)..HEAD --pretty='format:* %h %s' --no-merges >> ".github/release_template.md"
138+
- name: Download artifacts
139+
uses: actions/download-artifact@v5
140+
with:
141+
pattern: cibw-*
142+
path: dist
143+
merge-multiple: true
47144
- name: Create Release Draft
48145
uses: softprops/action-gh-release@v2
49146
with:
50147
body_path: ".github/release_template.md"
51148
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
52149
draft: true
53150
files: |
54-
dist/example_fgen_basic-${{ env.PROJECT_VERSION }}-py3-none-any.whl
151+
dist/example_fgen_basic-${{ env.PROJECT_VERSION }}-*.whl
55152
dist/example_fgen_basic-${{ env.PROJECT_VERSION }}.tar.gz

0 commit comments

Comments
 (0)