Skip to content

Commit 9ccb657

Browse files
committed
Update ci.yml
1 parent ca478d4 commit 9ccb657

1 file changed

Lines changed: 19 additions & 81 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
- os: macos-latest
2121
name: macos-x64
2222

23-
# Windows: MSVC (cl.exe) via VS generator
2423
- os: windows-latest
2524
name: windows-x64
2625
vcpkg_triplet: x64-windows
@@ -34,19 +33,14 @@ jobs:
3433
vcpkg_triplet: x86-windows
3534
vs_arch: Win32
3635

37-
# Linux
3836
- os: ubuntu-24.04
3937
name: linux-x86
40-
linux_arch: x86
4138
- os: ubuntu-24.04
4239
name: linux-x64
4340
- os: ubuntu-24.04-arm
4441
name: linux-arm64
45-
46-
# Linux ARMv7 (armhf) via cross-compile (brew LLVM)
4742
- os: ubuntu-24.04
4843
name: linux-armv7
49-
linux_arch: armv7
5044

5145
permissions:
5246
contents: write
@@ -59,15 +53,11 @@ jobs:
5953
- name: Checkout
6054
uses: actions/checkout@v4
6155

62-
# ---------------------------
63-
# CMake (Pinned)
64-
# ---------------------------
65-
- name: Install CMake ${{ env.CMAKE_VERSION }} (macOS/Linux)
56+
- name: Install CMake (macOS/Linux)
6657
if: runner.os != 'Windows'
6758
shell: bash
6859
run: |
6960
set -euo pipefail
70-
7161
ver="${CMAKE_VERSION}"
7262
os="$(uname -s)"
7363
arch="$(uname -m)"
@@ -84,8 +74,6 @@ jobs:
8474
fi
8575
8676
url="https://github.com/Kitware/CMake/releases/download/v${ver}/${pkg}"
87-
echo "Downloading: $url"
88-
8977
dst="${RUNNER_TEMP}/cmake"
9078
rm -rf "$dst"
9179
mkdir -p "$dst"
@@ -96,17 +84,14 @@ jobs:
9684
echo "${dst}/bin" >> "$GITHUB_PATH"
9785
cmake --version
9886
99-
- name: Install CMake ${{ env.CMAKE_VERSION }} (Windows)
87+
- name: Install CMake (Windows)
10088
if: runner.os == 'Windows'
10189
shell: pwsh
10290
run: |
10391
choco install -y cmake --version=$env:CMAKE_VERSION --allow-downgrade
10492
refreshenv
10593
cmake --version
10694
107-
# ---------------------------
108-
# Dependencies
109-
# ---------------------------
11095
- name: Install dependencies (macOS)
11196
if: runner.os == 'macOS'
11297
shell: bash
@@ -119,9 +104,17 @@ jobs:
119104
run: |
120105
set -euo pipefail
121106
122-
if [ "${{ matrix.name }}" = "linux-armv7" ]; then
123-
# Keep host sources amd64-only and add ports sources for armhf
124-
# (avoids security.ubuntu.com armhf 404 on Noble)
107+
# Host deps
108+
sudo apt-get update
109+
sudo apt-get install -y --no-install-recommends zip pkg-config
110+
111+
if [ "${{ matrix.name }}" = "linux-x86" ]; then
112+
sudo apt-get install -y --no-install-recommends gcc-multilib g++-multilib libc6-dev-i386
113+
sudo dpkg --add-architecture i386
114+
sudo apt-get update
115+
sudo apt-get install -y --no-install-recommends libsodium-dev:i386
116+
elif [ "${{ matrix.name }}" = "linux-armv7" ]; then
117+
# Add armhf packages from Ubuntu Ports (avoid security.ubuntu.com armhf 404)
125118
sudo dpkg --add-architecture armhf
126119
127120
sudo tee /etc/apt/sources.list >/dev/null <<'EOF'
@@ -139,22 +132,12 @@ deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports noble-security main univer
139132
EOF
140133

141134
sudo apt-get update
142-
sudo apt-get install -y --no-install-recommends zip pkg-config \
135+
sudo apt-get install -y --no-install-recommends \
143136
libc6-dev:armhf linux-libc-dev:armhf \
144137
libstdc++-13-dev:armhf libgcc-13-dev:armhf \
145138
libsodium-dev:armhf
146-
147139
else
148-
sudo apt-get update
149-
150-
if [ "${{ matrix.name }}" = "linux-x86" ]; then
151-
sudo apt-get install -y zip gcc-multilib g++-multilib libc6-dev-i386 pkg-config
152-
sudo dpkg --add-architecture i386
153-
sudo apt-get update
154-
sudo apt-get install -y libsodium-dev:i386
155-
else
156-
sudo apt-get install -y zip libsodium-dev
157-
fi
140+
sudo apt-get install -y --no-install-recommends libsodium-dev
158141
fi
159142

160143
/home/linuxbrew/.linuxbrew/bin/brew install ninja llvm
@@ -172,15 +155,11 @@ EOF
172155
with:
173156
arch: ${{ matrix.name == 'windows-arm64' && 'amd64_arm64' || (matrix.name == 'windows-x86' && 'amd64_x86' || 'amd64') }}
174157

175-
# ---------------------------
176-
# Toolchain: brew LLVM (macOS + Linux)
177-
# ---------------------------
178-
- name: Configure LLVM toolchain (macOS and Linux)
158+
- name: Configure LLVM toolchain (macOS/Linux)
179159
if: runner.os != 'Windows'
180160
shell: bash
181161
run: |
182162
set -euo pipefail
183-
184163
BREW_CMD="brew"
185164
if [ "${{ runner.os }}" = "Linux" ]; then
186165
BREW_CMD="/home/linuxbrew/.linuxbrew/bin/brew"
@@ -193,50 +172,26 @@ EOF
193172
echo "${LLVM_PREFIX}/bin" >> "$GITHUB_PATH"
194173
195174
if [ "${{ runner.os }}" = "macOS" ]; then
196-
LIBCXX_DIR="${LLVM_PREFIX}/lib/c++"
197175
SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"
198176
echo "SDKROOT=${SDKROOT}" >> "$GITHUB_ENV"
199-
echo "CFLAGS=-isysroot ${SDKROOT}" >> "$GITHUB_ENV"
200-
echo "CXXFLAGS=-isysroot ${SDKROOT} -stdlib=libc++ -fexperimental-library" >> "$GITHUB_ENV"
201-
echo "LDFLAGS=-isysroot ${SDKROOT} -L${LIBCXX_DIR} -Wl,-rpath,${LIBCXX_DIR}" >> "$GITHUB_ENV"
202177
fi
203178
204-
# ---------------------------
205-
# Versions
206-
# ---------------------------
207179
- name: Tool versions (macOS/Linux)
208180
if: runner.os != 'Windows'
209181
shell: bash
210182
run: |
211183
echo "cmake: $(cmake --version | head -n 1)"
212184
echo "clang: $(clang++ --version | head -n 1)"
213185
echo "ninja: $(ninja --version || true)"
214-
if [ "${{ runner.os }}" = "Linux" ]; then
215-
dpkg -l | grep -E 'libsodium-dev|zip|armhf|i386' || true
216-
fi
217186
218187
- name: Tool versions (Windows)
219188
if: runner.os == 'Windows'
220189
shell: pwsh
221190
run: |
222191
cmake --version
223-
$vsver = (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
224-
-latest -products * -property installationVersion) 2>$null
225-
if ($vsver) { Write-Host "Visual Studio: $vsver" }
226-
227192
$cl = Get-Command cl.exe -ErrorAction SilentlyContinue
228-
if ($cl) {
229-
Write-Host "cl.exe: $($cl.Source)"
230-
cmd /c "cl /Bv" | Out-Host
231-
$global:LASTEXITCODE = 0
232-
}
233-
234-
$z = Get-Command 7z.exe -ErrorAction SilentlyContinue
235-
if ($z) { cmd /c "7z" | Select-String "7-Zip" | Select-Object -First 1 | Out-Host }
236-
237-
# ---------------------------
238-
# Configure
239-
# ---------------------------
193+
if ($cl) { cmd /c "cl /Bv" | Out-Host; $global:LASTEXITCODE = 0 }
194+
240195
- name: Configure project (macOS)
241196
if: runner.os == 'macOS'
242197
shell: bash
@@ -259,7 +214,6 @@ EOF
259214
SYSROOT="/usr/arm-linux-gnueabihf"
260215
TARGET="arm-linux-gnueabihf"
261216
SCAN_DEPS="${LLVM_PREFIX}/bin/clang-scan-deps"
262-
263217
test -x "${SCAN_DEPS}" || { echo "Missing: ${SCAN_DEPS}"; exit 1; }
264218
265219
cmake -S . -B build -G Ninja \
@@ -276,11 +230,7 @@ EOF
276230
-DCMAKE_CXX_FLAGS="--target=${TARGET} --sysroot=${SYSROOT}" \
277231
-DCMAKE_EXE_LINKER_FLAGS="--target=${TARGET} --sysroot=${SYSROOT} -fuse-ld=lld" \
278232
-DCMAKE_CXX_COMPILER_CLANG_SCAN_DEPS="${SCAN_DEPS}" \
279-
-DCMAKE_CXX_SCAN_FOR_MODULES=ON \
280-
-DCMAKE_FIND_ROOT_PATH="${SYSROOT};/usr/lib/${TARGET};/usr/include" \
281-
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
282-
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
283-
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
233+
-DCMAKE_CXX_SCAN_FOR_MODULES=ON
284234
exit 0
285235
fi
286236
@@ -313,9 +263,6 @@ EOF
313263
-DVCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }} `
314264
-DCMAKE_CXX_SCAN_FOR_MODULES=ON
315265
316-
# ---------------------------
317-
# Build
318-
# ---------------------------
319266
- name: Build (Windows)
320267
if: runner.os == 'Windows'
321268
shell: pwsh
@@ -326,17 +273,11 @@ EOF
326273
shell: bash
327274
run: cmake --build build --parallel --config Release
328275

329-
# ---------------------------
330-
# Test
331-
# ---------------------------
332276
- name: Test
333277
if: runner.os == 'macOS' || (runner.os == 'Windows' && matrix.name == 'windows-x64')
334278
shell: bash
335279
run: ctest --test-dir build --output-on-failure -C Release
336280

337-
# ---------------------------
338-
# Package
339-
# ---------------------------
340281
- name: Package artifacts (macOS)
341282
if: runner.os == 'macOS'
342283
shell: bash
@@ -357,9 +298,6 @@ EOF
357298
run: |
358299
zip -j ${{ matrix.name }}.zip build/vaultguard build/recover_key
359300
360-
# ---------------------------
361-
# Upload + Release
362-
# ---------------------------
363301
- name: Upload artifacts
364302
uses: actions/upload-artifact@v4
365303
with:

0 commit comments

Comments
 (0)