-
Notifications
You must be signed in to change notification settings - Fork 0
364 lines (326 loc) · 13.1 KB
/
release.yml
File metadata and controls
364 lines (326 loc) · 13.1 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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
workflow_dispatch:
permissions:
contents: write
env:
CONAN_VERSION: 2.24.0
BINARY_NAME: fqc
PROJECT_NAME: fq-compressor
jobs:
# ── Validate version consistency ──────────────────────────────────
validate:
name: Validate Tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Check CMakeLists.txt version matches tag
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
CMAKE_VERSION=$(grep -E '^\s+VERSION [0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt | head -1 | sed 's/.*VERSION \([0-9][0-9.]*\).*/\1/')
if [ "$TAG_VERSION" != "$CMAKE_VERSION" ]; then
echo "::error::Tag version ($TAG_VERSION) does not match CMakeLists.txt version ($CMAKE_VERSION)"
exit 1
fi
echo "Version: $TAG_VERSION ✓"
# ── Linux glibc builds (Docker GCC 15 × x86_64 + aarch64) ───────
build-linux-glibc:
name: Build Linux glibc (${{ matrix.arch }})
needs: validate
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-latest
- arch: aarch64
runner: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build via Docker (GCC 15 + glibc)
run: |
docker build \
-f docker/Dockerfile.glibc-release \
--output type=local,dest=out \
.
- name: Verify binary
run: |
file out/${{ env.BINARY_NAME }}
chmod +x out/${{ env.BINARY_NAME }}
- name: Prepare archive
run: |
STAGING="${{ env.PROJECT_NAME }}-${{ github.ref_name }}-linux-${{ matrix.arch }}-glibc"
mkdir -p "$STAGING"
cp out/${{ env.BINARY_NAME }} "$STAGING/"
chmod +x "$STAGING/${{ env.BINARY_NAME }}"
cp README.md LICENSE* CHANGELOG.md "$STAGING/" 2>/dev/null || true
tar czf "$STAGING.tar.gz" "$STAGING"
echo "ASSET=$STAGING.tar.gz" >> "$GITHUB_ENV"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.arch }}-glibc
path: ${{ env.ASSET }}
# ── Linux musl static builds (Docker GCC 15 + musl-tools) ───────
build-linux-musl:
name: Build Linux musl (${{ matrix.arch }})
needs: validate
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-latest
- arch: aarch64
runner: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build static binary via Docker (GCC 15 + musl)
run: |
docker build \
-f docker/Dockerfile.musl-release \
--output type=local,dest=out \
.
- name: Verify static binary
run: |
file out/${{ env.BINARY_NAME }}
chmod +x out/${{ env.BINARY_NAME }}
- name: Prepare archive
run: |
STAGING="${{ env.PROJECT_NAME }}-${{ github.ref_name }}-linux-${{ matrix.arch }}-musl"
mkdir -p "$STAGING"
cp out/${{ env.BINARY_NAME }} "$STAGING/"
chmod +x "$STAGING/${{ env.BINARY_NAME }}"
cp README.md LICENSE* CHANGELOG.md "$STAGING/" 2>/dev/null || true
tar czf "$STAGING.tar.gz" "$STAGING"
echo "ASSET=$STAGING.tar.gz" >> "$GITHUB_ENV"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.arch }}-musl
path: ${{ env.ASSET }}
# ── Linux Clang builds (Docker Clang 21 + libc++ × x86_64 + aarch64)
build-linux-clang:
name: Build Linux Clang (${{ matrix.arch }})
needs: validate
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-latest
- arch: aarch64
runner: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build via Docker (Clang 21 + libc++)
run: |
docker build \
-f docker/Dockerfile.clang-release \
--output type=local,dest=out \
.
- name: Verify binary
run: |
file out/${{ env.BINARY_NAME }}
chmod +x out/${{ env.BINARY_NAME }}
- name: Prepare archive
run: |
STAGING="${{ env.PROJECT_NAME }}-${{ github.ref_name }}-linux-${{ matrix.arch }}-clang"
mkdir -p "$STAGING"
cp out/${{ env.BINARY_NAME }} "$STAGING/"
chmod +x "$STAGING/${{ env.BINARY_NAME }}"
cp README.md LICENSE* CHANGELOG.md "$STAGING/" 2>/dev/null || true
tar czf "$STAGING.tar.gz" "$STAGING"
echo "ASSET=$STAGING.tar.gz" >> "$GITHUB_ENV"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.arch }}-clang
path: ${{ env.ASSET }}
# ── macOS builds (Homebrew GCC 15 × x86_64 + arm64) ─────────────
build-macos:
name: Build macOS (${{ matrix.arch }})
needs: validate
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: macos-13
- arch: arm64
runner: macos-14
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/cache@v4
with:
path: ~/.conan2
key: macos-${{ matrix.arch }}-conan-${{ hashFiles('conanfile.py') }}
restore-keys: macos-${{ matrix.arch }}-conan-
- name: Install build tools & GCC 15
run: |
brew install cmake ninja ccache gcc@15
echo "CC=$(brew --prefix gcc@15)/bin/gcc-15" >> "$GITHUB_ENV"
echo "CXX=$(brew --prefix gcc@15)/bin/g++-15" >> "$GITHUB_ENV"
- name: Install Conan
run: |
pip install conan==${{ env.CONAN_VERSION }}
conan profile detect --force
- name: Install Conan dependencies
run: |
conan install . \
--output-folder=build/release \
--build=missing \
-s build_type=Release \
-s compiler.cppstd=23
- name: CMake configure
run: |
cmake -B build/release -S . -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=build/release/build/Release/generators/conan_toolchain.cmake \
-DCMAKE_C_COMPILER=${{ env.CC }} \
-DCMAKE_CXX_COMPILER=${{ env.CXX }} \
-DCMAKE_CXX_FLAGS_RELEASE="-O3 -DNDEBUG" \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DFQC_PORTABLE=ON \
-DBUILD_TESTING=OFF \
-DENABLE_COVERAGE=OFF
- name: Build
run: cmake --build build/release -j "$(sysctl -n hw.ncpu)"
- name: Prepare archive
run: |
STAGING="${{ env.PROJECT_NAME }}-${{ github.ref_name }}-macos-${{ matrix.arch }}"
mkdir -p "$STAGING"
cp build/release/src/${{ env.BINARY_NAME }} "$STAGING/"
cp README.md LICENSE* CHANGELOG.md "$STAGING/" 2>/dev/null || true
tar czf "$STAGING.tar.gz" "$STAGING"
echo "ASSET=$STAGING.tar.gz" >> "$GITHUB_ENV"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: macos-${{ matrix.arch }}
path: ${{ env.ASSET }}
# ── Create GitHub Release ─────────────────────────────────────────
release:
name: Create Release
needs: [build-linux-glibc, build-linux-musl, build-linux-clang, build-macos]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Collect release assets
run: |
mkdir -p release-assets
find artifacts -type f \( -name '*.tar.gz' -o -name '*.zip' \) -exec cp {} release-assets/ \;
ls -la release-assets/
- name: Generate checksums
working-directory: release-assets
run: |
sha256sum * > checksums-sha256.txt
cat checksums-sha256.txt
- name: Generate release notes
id: notes
run: |
TAG="${{ github.ref_name }}"
PREV_TAG=$(git tag --sort=-v:refname | grep -A1 "^$TAG$" | tail -1)
{
echo "body<<EOF"
if [ -z "$PREV_TAG" ] || [ "$PREV_TAG" = "$TAG" ]; then
echo "## What's New / 更新内容"
echo ""
echo "Initial release of \`fq-compressor\` — High-Performance FASTQ Compressor (C++ implementation)."
echo ""
echo "\`fq-compressor\` 首次发布 — 高性能 FASTQ 压缩工具(C++ 实现)。"
else
echo "## Changes since $PREV_TAG / 自 $PREV_TAG 以来的变更"
echo ""
git log --pretty=format:"- %s (%h)" "$PREV_TAG".."$TAG"
echo ""
echo ""
echo "**Full Changelog / 完整变更记录**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${TAG}"
fi
echo ""
echo "---"
echo ""
echo "### Build Environment / 构建环境"
echo ""
echo "- **GCC 15.2** builds: glibc (dynamic) and musl (static)"
echo "- **Clang 21** builds: glibc + libc++ (dynamic)"
echo ""
echo "- **GCC 15.2** 构建:glibc(动态)和 musl(静态)"
echo "- **Clang 21** 构建:glibc + libc++(动态)"
echo ""
echo "### Installation / 安装说明"
echo ""
echo "Download the binary for your platform from the assets below."
echo ""
echo "请从下方资源中下载适合您平台的二进制文件。"
echo ""
echo "- **musl (static)** builds have **zero runtime dependencies** and run on any Linux distribution."
echo "- **glibc** builds require a compatible glibc version (typically any recent Linux distro)."
echo ""
echo "- **musl(静态)** 版本**无任何运行时依赖**,可在任意 Linux 发行版上直接运行。"
echo "- **glibc** 版本需要兼容的 glibc 版本(通常任何近期 Linux 发行版均可)。"
echo ""
echo "| Platform / 平台 | File / 文件 | Note / 说明 |"
echo "|---|---|---|"
echo "| Linux x64 (GCC glibc) | \`fq-compressor-${TAG}-linux-x86_64-glibc.tar.gz\` | GCC 15, dynamic / 动态链接 |"
echo "| Linux x64 (GCC musl) | \`fq-compressor-${TAG}-linux-x86_64-musl.tar.gz\` | GCC 15, **static / 静态链接** |"
echo "| Linux x64 (Clang) | \`fq-compressor-${TAG}-linux-x86_64-clang.tar.gz\` | Clang 21 + libc++ |"
echo "| Linux arm64 (GCC glibc) | \`fq-compressor-${TAG}-linux-aarch64-glibc.tar.gz\` | GCC 15, dynamic / 动态链接 |"
echo "| Linux arm64 (GCC musl) | \`fq-compressor-${TAG}-linux-aarch64-musl.tar.gz\` | GCC 15, **static / 静态链接** |"
echo "| Linux arm64 (Clang) | \`fq-compressor-${TAG}-linux-aarch64-clang.tar.gz\` | Clang 21 + libc++ |"
echo "| macOS x64 | \`fq-compressor-${TAG}-macos-x86_64.tar.gz\` | GCC 15, Intel Mac |"
echo "| macOS arm64 | \`fq-compressor-${TAG}-macos-arm64.tar.gz\` | GCC 15, Apple Silicon |"
echo ""
echo "### Quick Start / 快速开始"
echo ""
echo "\`\`\`bash"
echo "# Linux / macOS"
echo "tar xzf fq-compressor-${TAG}-<platform>.tar.gz"
echo "chmod +x fqc"
echo "./fqc --help"
echo ""
echo "# Compress / 压缩"
echo "./fqc compress input.fastq -o output.fqc"
echo ""
echo "# Decompress / 解压"
echo "./fqc decompress output.fqc -o restored.fastq"
echo "\`\`\`"
echo ""
echo "### Verify Checksums / 校验文件完整性"
echo ""
echo "\`\`\`bash"
echo "sha256sum -c checksums-sha256.txt"
echo "\`\`\`"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: "fq-compressor ${{ github.ref_name }}"
body: ${{ steps.notes.outputs.body }}
draft: false
prerelease: ${{ contains(github.ref_name, '-rc') || contains(github.ref_name, '-alpha') || contains(github.ref_name, '-beta') }}
files: release-assets/*
generate_release_notes: false