Skip to content

Commit 133a319

Browse files
committed
[ci] Add release workflow
1 parent 0ac9740 commit 133a319

1 file changed

Lines changed: 131 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# Copyright Agustin K-ballo Berge, Fusion Fenix 2026
2+
#
3+
# Distributed under the Boost Software License, Version 1.0. (See accompanying
4+
# file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5+
6+
name: release
7+
8+
on:
9+
push:
10+
tags: ['v*']
11+
12+
jobs:
13+
build:
14+
name: ${{ matrix.os }} / ${{ matrix.compiler }}
15+
runs-on: ${{ matrix.os }}
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
# ── Linux / GCC 16 ──
22+
- os: ubuntu-24.04
23+
compiler: gcc-16
24+
preset: dev-gcc
25+
package_suffix: Linux-gcc-16
26+
27+
# ── Linux / Clang 22 ──
28+
- os: ubuntu-24.04
29+
compiler: clang-22
30+
preset: dev-clang
31+
package_suffix: Linux-clang-22
32+
33+
# ── Linux / Clang 22 + libc++ ──
34+
- os: ubuntu-24.04
35+
compiler: clang-22+libc++
36+
preset: dev-clang-libcxx
37+
package_suffix: Linux-clang-22-libcxx
38+
39+
# ── Windows 2025 / MSVC 2026 ──
40+
- os: windows-2025-vs2026
41+
compiler: msvc-2026
42+
preset: dev-msvc
43+
package_suffix: win64-msvc
44+
45+
# ── Windows 2025 / Clang-CL 20 ──
46+
- os: windows-2025-vs2026
47+
compiler: clang-cl-20
48+
preset: dev-clang-cl
49+
package_suffix: win64-clang-cl-20
50+
51+
steps:
52+
- uses: actions/checkout@v5
53+
54+
- name: Set up MSVC environment
55+
if: startsWith(matrix.compiler, 'msvc') || startsWith(matrix.compiler, 'clang-cl')
56+
shell: pwsh
57+
run: |
58+
$vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
59+
-latest -property installationPath
60+
$vcvars = "$vsPath\VC\Auxiliary\Build\vcvars64.bat"
61+
cmd /c "`"$vcvars`" && set" | ForEach-Object {
62+
if ($_ -match '^([^=]+)=(.*)$') {
63+
"$($Matches[1])=$($Matches[2])" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
64+
}
65+
}
66+
67+
- name: Set up APT package cache
68+
if: runner.os == 'Linux'
69+
run: |
70+
mkdir -p ~/.cache/apt/archives/partial
71+
echo "Dir::Cache::archives \"$HOME/.cache/apt/archives\";" \
72+
| sudo tee /etc/apt/apt.conf.d/99user-cache
73+
74+
- name: Cache APT packages
75+
if: runner.os == 'Linux'
76+
uses: actions/cache@v5
77+
with:
78+
path: ~/.cache/apt/archives
79+
key: apt-${{ matrix.os }}-${{ matrix.compiler }}-${{ hashFiles('.github/workflows/release.yml') }}
80+
restore-keys: apt-${{ matrix.os }}-${{ matrix.compiler }}-
81+
82+
- name: Install GCC 16
83+
if: matrix.compiler == 'gcc-16'
84+
run: |
85+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
86+
sudo apt-get update -q
87+
sudo apt-get install -y gcc-16 g++-16
88+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-16 100 \
89+
--slave /usr/bin/g++ g++ /usr/bin/g++-16
90+
91+
- name: Install Clang 22
92+
if: startsWith(matrix.compiler, 'clang-22')
93+
run: |
94+
wget -q https://apt.llvm.org/llvm.sh
95+
sudo bash llvm.sh 22 all
96+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-22 200
97+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-22 200
98+
99+
- name: Install Ninja
100+
if: runner.os == 'Linux'
101+
run: sudo apt-get install -y ninja-build
102+
103+
- name: Fix APT cache permissions
104+
if: always() && runner.os == 'Linux'
105+
run: sudo rm -rf ~/.cache/apt/archives/lock ~/.cache/apt/archives/partial
106+
107+
- name: Configure
108+
run: cmake --preset ${{ matrix.preset }} -B build/${{ matrix.preset }}
109+
110+
- name: Build (Release)
111+
run: cmake --build build/${{ matrix.preset }} --config Release
112+
113+
- name: Package
114+
working-directory: build/${{ matrix.preset }}
115+
run: cpack -C Release -D "CPACK_SYSTEM_NAME=${{ matrix.package_suffix }}"
116+
117+
- name: Publish
118+
env:
119+
GH_TOKEN: ${{ github.token }}
120+
shell: bash
121+
run: |
122+
gh release create ${{ github.ref_name }} \
123+
--title "${{ github.ref_name }}" \
124+
--generate-notes \
125+
--draft \
126+
|| true
127+
shopt -s nullglob
128+
gh release upload ${{ github.ref_name }} \
129+
build/${{ matrix.preset }}/Eggs.Assert-*.tar.gz \
130+
build/${{ matrix.preset }}/Eggs.Assert-*.zip \
131+
--clobber

0 commit comments

Comments
 (0)