forked from mongodb/kingfisher
-
Notifications
You must be signed in to change notification settings - Fork 0
295 lines (250 loc) · 8.75 KB
/
Copy pathrelease.yml
File metadata and controls
295 lines (250 loc) · 8.75 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
name: build-and-release
on:
push:
branches:
- main
env:
VCPKG_ROOT: C:\vcpkg
VCPKG_DOWNLOADS: C:\vcpkg\downloads
VCPKG_FEATURE_FLAGS: binarycaching
VCPKG_BINARY_SOURCES: clear;x-gha,readwrite
RUST_TOOLCHAIN: "1.90"
jobs:
# ──────────────── Linux (via Makefile) ────────────────
linux-x64:
name: Linux x64
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
profile: minimal
override: true
- uses: swatinem/rust-cache@v2
- name: Install packaging tools
run: cargo install cargo-deb cargo-generate-rpm
- name: Build (Makefile linux-x64)
run: make linux-x64
- name: Fix permissions
run: sudo chown -R $(id -u):$(id -g) target
- name: Build Debian package
run: |
cargo deb --no-build --target x86_64-unknown-linux-musl \
--output target/release/kingfisher-linux-x64.deb
- name: Build RPM package
run: |
cargo generate-rpm --target x86_64-unknown-linux-musl \
--output target/release/kingfisher-linux-x64.rpm
- name: Move artifact to dist
shell: bash
run: |
mkdir -p dist
cp target/release/kingfisher-linux-x64.tgz dist/
cp target/release/kingfisher-linux-x64.deb dist/
cp target/release/kingfisher-linux-x64.rpm dist/
- uses: actions/upload-artifact@v4
with:
name: kingfisher-linux-x64.tgz
path: dist/kingfisher-linux-x64.tgz
- uses: actions/upload-artifact@v4
with:
name: kingfisher-linux-x64.deb
path: dist/kingfisher-linux-x64.deb
- uses: actions/upload-artifact@v4
with:
name: kingfisher-linux-x64.rpm
path: dist/kingfisher-linux-x64.rpm
linux-arm64:
name: Linux arm64
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
profile: minimal
override: true
- uses: swatinem/rust-cache@v2
- name: Install packaging tools
run: cargo install cargo-deb cargo-generate-rpm
- name: Build (Makefile linux-arm64)
run: make linux-arm64
- name: Fix permissions
run: sudo chown -R $(id -u):$(id -g) target
- name: Build Debian package
run: |
cargo deb --no-build --target aarch64-unknown-linux-musl \
--output target/release/kingfisher-linux-arm64.deb
- name: Build RPM package
run: |
cargo generate-rpm --target aarch64-unknown-linux-musl \
--output target/release/kingfisher-linux-arm64.rpm
- name: Move artifact to dist
shell: bash
run: |
mkdir -p dist
cp target/release/kingfisher-linux-arm64.tgz dist/
cp target/release/kingfisher-linux-arm64.deb dist/
cp target/release/kingfisher-linux-arm64.rpm dist/
- uses: actions/upload-artifact@v4
with:
name: kingfisher-linux-arm64.tgz
path: dist/kingfisher-linux-arm64.tgz
- uses: actions/upload-artifact@v4
with:
name: kingfisher-linux-arm64.deb
path: dist/kingfisher-linux-arm64.deb
- uses: actions/upload-artifact@v4
with:
name: kingfisher-linux-arm64.rpm
path: dist/kingfisher-linux-arm64.rpm
macos-x64:
name: macOS x64
runs-on: macos-15-intel
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
profile: minimal
override: true
- uses: swatinem/rust-cache@v2
- name: Build Darwin x64
run: make darwin-x64
- name: Run tests
run: make tests
- name: Move artifacts to dist
shell: bash
run: |
mkdir -p dist
cp target/release/kingfisher-darwin-x64.tgz dist/
- uses: actions/upload-artifact@v4
with:
name: kingfisher-darwin-x64.tgz
path: dist/kingfisher-darwin-x64.tgz
macos-arm64:
name: macOS arm64
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
profile: minimal
override: true
- uses: swatinem/rust-cache@v2
- name: Build Darwin arm64
run: make darwin-arm64
- name: Run tests
run: make tests
- name: Move artifacts to dist
shell: bash
run: |
mkdir -p dist
cp target/release/kingfisher-darwin-arm64.tgz dist/
- uses: actions/upload-artifact@v4
with:
name: kingfisher-darwin-arm64.tgz
path: dist/kingfisher-darwin-arm64.tgz
# ──────────────── Windows ────────────────
windows:
name: Windows x64
runs-on: windows-latest
# Windows-only env to keep vcpkg consistent and enable caching
env:
VCPKG_ROOT: C:\vcpkg
VCPKG_DOWNLOADS: C:\vcpkg\downloads
VCPKG_FEATURE_FLAGS: binarycaching
VCPKG_BINARY_SOURCES: clear;x-gha,readwrite
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
profile: minimal
override: true
# Cache vcpkg artifacts & downloads (so we only fetch PCRE once)
- name: Cache vcpkg artifacts
uses: actions/cache@v4
with:
path: |
C:\vcpkg\buildtrees
C:\vcpkg\packages
C:\vcpkg\installed
C:\vcpkg\downloads
C:\vcpkg\archives
C:\Users\runneradmin\AppData\Local\vcpkg\archives
key: vcpkg-${{ runner.os }}-hs-542
restore-keys: |
vcpkg-${{ runner.os }}-
vcpkg-
# Ensure downloads dir exists and seed PCRE 8.45 zip from a working mirror
- name: Pre-seed PCRE 8.45 for vcpkg (bypass SourceForge redirect)
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "$env:VCPKG_DOWNLOADS" | Out-Null
$dst = Join-Path $env:VCPKG_DOWNLOADS "pcre-8.45.zip"
if (-not (Test-Path $dst)) {
Invoke-WebRequest `
-Uri "https://versaweb.dl.sourceforge.net/project/pcre/pcre/8.45/pcre-8.45.zip" `
-OutFile $dst -UseBasicParsing
}
Get-ChildItem $env:VCPKG_DOWNLOADS
- uses: swatinem/rust-cache@v2
- name: Build
run: .\buildwin.bat
shell: cmd
- name: Run tests
shell: pwsh
run: |
if (-not (Get-Command cargo-nextest -ErrorAction SilentlyContinue)) {
cargo install --locked cargo-nextest
}
Write-Host "▶ cargo nextest run --release --workspace --all-targets"
cargo nextest run --release --workspace --all-targets
- name: Move artifact to dist
shell: bash
run: |
mkdir -p dist
cp target/release/kingfisher-windows-x64.zip dist/
- uses: actions/upload-artifact@v4
with:
name: kingfisher-windows-x64
path: dist/kingfisher-*windows-x64*.*
release:
name: Public GitHub Release
needs: [linux-x64, linux-arm64, windows, macos-x64, macos-arm64]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Read version from Cargo.toml
id: version
run: |
VERSION=$(grep -m1 '^version\s*=' Cargo.toml | cut -d '"' -f2)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v4
with:
path: target/release/kingfisher-*
merge-multiple: true
- name: Extract latest changelog section
run: |
awk '
BEGIN { grabbing = 0 }
/^## \[/ {
if (grabbing) exit; # already grabbed latest entry
grabbing = 1
}
grabbing { print }
' CHANGELOG.md > .latest_changelog.md
# ── create the release using just that snippet ─────────────────────
- name: Create release & upload assets
uses: ncipollo/release-action@v1
with:
tag: v${{ steps.version.outputs.version }}
name: "Kingfisher v${{ steps.version.outputs.version }}"
bodyFile: .latest_changelog.md # ← only the most-recent entry
generateReleaseNotes: false
artifacts: target/release/**