-
Notifications
You must be signed in to change notification settings - Fork 62
145 lines (127 loc) · 4.52 KB
/
wheels.yml
File metadata and controls
145 lines (127 loc) · 4.52 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
# inspired by
# - https://learn.scientific-python.org/development/guides/gha-wheels/
# - https://cibuildwheel.pypa.io/en/stable/setup/#github-actions
# - https://github.com/yt-project/yt/blob/main/.github/workflows/wheels.yaml
#
# the numpy action that does the exact same thing
# https://github.com/numpy/numpy/blob/main/.github/workflows/wheels.yml
# illustrates a nifty trick for configuring the action to run whenever a commit
# is pushed where the commit-message is prefixed with [wheel build]
name: Wheel
on:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
- cron: "17 0 * * MON"
push:
branches:
- main
tags:
- 'grackle-*'
pull_request:
paths:
- '.github/workflows/wheels.yaml'
workflow_dispatch:
jobs:
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
# fetch the full git history to let us run all our tests
fetch-depth: 0
# fetch the submodules to let us run the tests
submodules: true
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Build SDist
run: pipx run build --sdist
- name: Check README rendering for PyPI
run: |
python -mpip install twine
twine check dist/*
- name: Test sdist
run: |
sudo apt-get install libhdf5-dev
# it may not be necessary to setup a venv
python -m venv my-venv
source my-venv/bin/activate
pip install --upgrade pip
python -m pip install --group test "$(echo dist/*.tar.gz)"
python -m pip list
pytest
- uses: actions/upload-artifact@v7
with:
name: cibw-sdist
path: dist/*.tar.gz
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # don't exit abruptly if another wheel can't be built
matrix:
os: [
ubuntu-latest,
# we should revisit arm-based builds in the future
# -> the tests run REALLY slowly because wheels aren't shipped by yt/matplotlib
#ubuntu-24.04-arm,
macos-13, # (runs on intel-CPUs)
macos-14 #(runs on arm cpus)
]
steps:
- uses: actions/checkout@v6
with:
# fetch the full git history to let us run all our tests
fetch-depth: 0
# fetch the submodules to let us run the tests
submodules: true
- name: Set MACOSX_DEPLOYMENT_TARGET
if: startsWith( matrix.os, 'macos-' )
run: |
# we may be able to reduce the following version numbers (or pick
# something consistent b/t Intel & Arm) once all fortran code is
# removed
RUNNER=${{ matrix.OS }}
if [ "$RUNNER" = "macos-14" ]; then # ARM-builds
echo "CIBW_ENVIRONMENT=MACOSX_DEPLOYMENT_TARGET=12.3" >> "$GITHUB_ENV"
elif [ "$RUNNER" = "macos-13" ]; then # Intel-builds
echo "CIBW_ENVIRONMENT=MACOSX_DEPLOYMENT_TARGET=10.14" >> "$GITHUB_ENV"
fi
- name: Build wheels
uses: pypa/cibuildwheel@v3.4.1
with:
output-dir: dist
- uses: actions/upload-artifact@v7
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./dist/*.whl
upload_all:
name: Publish to PyPI
needs: [build_wheels, make_sdist]
environment: pypi
permissions:
id-token: write
attestations: write
contents: read
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'grackle-'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/grackle-')
steps:
- uses: actions/download-artifact@v8
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Generate artifact attestations
uses: actions/attest-build-provenance@v4
with:
subject-path: "dist/*"
- name: Publish to pypi
uses: pypa/gh-action-pypi-publish@release/v1