-
Notifications
You must be signed in to change notification settings - Fork 2
212 lines (203 loc) · 6.76 KB
/
Copy pathrelease.yml
File metadata and controls
212 lines (203 loc) · 6.76 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: release
on:
push:
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
permissions:
contents: write
jobs:
build-cli:
name: Build CLI (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: evolve
archive: tar.gz
- os: macos-latest
target: aarch64-apple-darwin
binary: evolve
archive: tar.gz
- os: macos-latest
target: x86_64-apple-darwin
binary: evolve
archive: tar.gz
- os: windows-latest
target: x86_64-pc-windows-msvc
binary: evolve.exe
archive: zip
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --release --bin evolve --target ${{ matrix.target }}
- name: Archive (tar.gz)
if: matrix.archive == 'tar.gz'
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../evolve-${{ matrix.target }}.tar.gz ${{ matrix.binary }}
- name: Archive (zip)
if: matrix.archive == 'zip'
shell: pwsh
run: |
Compress-Archive -Path target/${{ matrix.target }}/release/${{ matrix.binary }} `
-DestinationPath evolve-${{ matrix.target }}.zip
- uses: softprops/action-gh-release@v2
with:
files: |
evolve-${{ matrix.target }}.tar.gz
evolve-${{ matrix.target }}.zip
fail_on_unmatched_files: false
build-python:
name: Build Python wheel (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: dtolnay/rust-toolchain@stable
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: bindings/python
command: build
args: --release --strip
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: bindings/python/target/wheels/*
publish-pypi:
name: Publish to PyPI
needs: build-python
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: wheels/
pattern: wheels-*
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: wheels/
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
build-npm:
name: Build npm binary (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: aarch64-apple-darwin
- os: macos-latest
target: x86_64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Install napi-rs CLI
working-directory: bindings/typescript
run: npm install
- name: Build napi-rs binary
working-directory: bindings/typescript
run: npx napi build --platform --release --target ${{ matrix.target }}
- uses: actions/upload-artifact@v4
with:
name: napi-${{ matrix.target }}
path: bindings/typescript/*.node
publish-npm:
name: Publish to npm
needs: build-npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- uses: actions/download-artifact@v4
with:
path: bindings/typescript/artifacts
- name: Move artifacts into place
working-directory: bindings/typescript
run: |
mkdir -p npm
# Each napi-<target> artifact contains a .node for one platform.
# napi-rs CLI expects these next to the platform-specific package.
find artifacts -name '*.node' -exec cp {} . \;
ls -la *.node || true
- name: Install
working-directory: bindings/typescript
run: npm install
- name: Skip if NPM_TOKEN not set
id: token-check
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [ -z "$NPM_TOKEN" ]; then
echo "NPM_TOKEN not set — skipping npm publish."
echo "publish=false" >> $GITHUB_OUTPUT
else
echo "publish=true" >> $GITHUB_OUTPUT
fi
- name: Prepublish (napi)
if: steps.token-check.outputs.publish == 'true'
working-directory: bindings/typescript
run: npx napi prepublish -t npm --skip-gh-release
- name: Publish
if: steps.token-check.outputs.publish == 'true'
working-directory: bindings/typescript
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public
publish-crates:
name: Publish to crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Publish crates in dependency order
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
# NOTE: deliberately no `set -e` — we handle individual cargo publish
# failures by inspecting the log for "already exists" and skipping.
# The previous version had `set -e + pipefail` which aborted before
# the inspection branch could run.
run: |
set -o pipefail
for crate in evolve-core evolve-storage evolve-llm evolve-mutators evolve-adapters evolve-proxy evolve-dashboard evolve-cli; do
echo "=== publishing $crate ==="
if cargo publish -p $crate --no-verify 2>&1 | tee /tmp/publish.log; then
echo "--- $crate: published OK ---"
# crates.io allows 30 new versions per 10 min — 25s is comfortably under.
sleep 25
elif grep -q "already exists on crates.io" /tmp/publish.log; then
echo "--- $crate: already published, skipping ---"
else
echo "--- $crate: FAILED ---"
exit 1
fi
done