-
Notifications
You must be signed in to change notification settings - Fork 32
166 lines (153 loc) · 5.63 KB
/
release-plz.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
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
name: Release-plz
permissions:
pull-requests: write
contents: write
on:
push:
branches:
- develop
jobs:
# Release unpublished packages.
release-plz-release:
name: Release-plz release
runs-on: ubuntu-latest
if: "startsWith(github.event.head_commit.message, 'chore: release')"
outputs:
releases_created: ${{ steps.run-release-plz.outputs.releases_created }} # Expose this step output as a job output
steps:
- uses: actions/checkout@v4
with:
# Needed to pull full commit history for release version number inference
fetch-depth: 0
- uses: ./.github/actions/cleanup
- uses: ./.github/actions/setup-rust
- uses: spiraldb/actions/.github/actions/[email protected]
- name: Run release-plz
id: run-release-plz
uses: MarcoIeni/[email protected]
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
# Create a PR with the new versions and changelog, preparing the next release.
release-plz-pr:
name: Release-plz PR
runs-on: ubuntu-latest
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
with:
# Needed to pull full commit history for release version number inference
fetch-depth: 0
- uses: ./.github/actions/cleanup
- uses: ./.github/actions/setup-rust
- uses: spiraldb/actions/.github/actions/[email protected]
- name: Run release-plz
uses: MarcoIeni/[email protected]
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
macos:
needs: release-plz-release
if: ${{ needs.release-plz-release.outputs.releases_created == 'true' }}
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cleanup
- uses: ./.github/actions/setup-rust
- uses: spiraldb/actions/.github/actions/[email protected]
- name: rust-toolchain
shell: bash
run: echo "version=$(cat rust-toolchain.toml | grep channel | awk -F'\"' '{print $2}')" >> $GITHUB_OUTPUT
- name: Build wheels - x86_64
uses: PyO3/maturin-action@v1
with:
rust-toolchain: ${{ steps.rust-toolchain.version }}
working-directory: pyvortex
target: x86_64
args: --release --interpreter python3.10 --sdist
- name: Build wheels - aarch64
uses: PyO3/maturin-action@v1
with:
rust-toolchain: ${{ steps.rust-toolchain.version }}
working-directory: pyvortex
target: aarch64 # NB: aarch64 becomes arm64 in the wheel's platform tag.
args: --release --interpreter python3.10
- name: test wheel
run: |
set -ex
ls -al target/wheels
echo removing linux_x86_64 if it exists because PyPI will reject the package if it is present
rm -f target/wheels/*linux_x86_64.whl
uv run pip install --no-deps --force-reinstall vortex-array --no-index --find-links target/wheels
cd pyvortex/test
uv run pytest
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: osx-wheels
path: target/wheels
linux:
needs: release-plz-release
if: ${{ needs.release-plz-release.outputs.releases_created == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# maturin-action builds in an isolated container; setting RUSTC_WRAPPER=sccache triggers failure
# because sccache is not installed in the container.
#
# - uses: ./.github/actions/setup-rust
- uses: spiraldb/actions/.github/actions/[email protected]
- name: rust-toolchain
shell: bash
run: echo "version=$(cat rust-toolchain.toml | grep channel | awk -F'\"' '{print $2}')" >> $GITHUB_OUTPUT
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
rust-toolchain: ${{ steps.rust-toolchain.version }}
working-directory: pyvortex
target: x86_64
manylinux: auto
args: --release --interpreter python3.10
- name: test wheel
run: |
set -ex
ls -al target/wheels
echo removing linux_x86_64 if it exists because PyPI will reject the package if it is present
rm -f target/wheels/*linux_x86_64.whl
uv run pip install --no-deps --force-reinstall vortex-array --no-index --find-links target/wheels
cd pyvortex/test
uv run pytest
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: linux-wheels
path: target/wheels
release:
needs: [ release-plz-release, macos, linux ]
if: ${{ needs.release-plz-release.outputs.releases_created == 'true' }}
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
environment:
name: push-to-pypi
url: https://pypi.org/p/vortex-array
steps:
- uses: actions/download-artifact@v4
with:
# https://github.com/actions/download-artifact?tab=readme-ov-file#download-all-artifacts
# "To download them to the same directory:"
path: dist/
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
verbose: true