3535 - os : ubuntu-24.04-arm
3636 name : linux-arm64
3737
38+ # Linux armv7 (32-bit) via cross-compile on x64 runner
39+ - os : ubuntu-24.04
40+ name : linux-armv7
41+ cross : armv7
42+
3843 permissions :
3944 contents : write
4045
8893 if : runner.os == 'Windows'
8994 shell : pwsh
9095 run : |
91- # Pin CMake version via Chocolatey
9296 choco install -y cmake --version=$env:CMAKE_VERSION --allow-downgrade
9397 refreshenv
9498 cmake --version
@@ -102,13 +106,39 @@ jobs:
102106 run : |
103107 brew install ninja llvm libsodium
104108
105- - name : Install dependencies (Linux)
106- if : runner.os == 'Linux'
109+ - name : Install dependencies (Linux native )
110+ if : runner.os == 'Linux' && matrix.name != 'linux-armv7'
107111 run : |
108112 sudo apt-get update
109113 sudo apt-get install -y zip libsodium-dev
110114 /home/linuxbrew/.linuxbrew/bin/brew install ninja llvm
111115
116+ # armv7 cross toolchain + deps (build-only)
117+ - name : Install dependencies (Linux armv7 cross)
118+ if : runner.os == 'Linux' && matrix.name == 'linux-armv7'
119+ shell : bash
120+ run : |
121+ set -euo pipefail
122+ sudo apt-get update
123+ sudo apt-get install -y \
124+ zip \
125+ gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \
126+ pkg-config-arm-linux-gnueabihf
127+
128+ # Build libsodium for armv7 (so link works)
129+ ver="1.0.21"
130+ curl -fsSL "https://download.libsodium.org/libsodium/releases/libsodium-${ver}.tar.gz" -o "${RUNNER_TEMP}/libsodium-${ver}.tar.gz"
131+ tar -xzf "${RUNNER_TEMP}/libsodium-${ver}.tar.gz" -C "${RUNNER_TEMP}"
132+ pushd "${RUNNER_TEMP}/libsodium-${ver}"
133+ ./configure \
134+ --host=arm-linux-gnueabihf \
135+ --prefix="${RUNNER_TEMP}/armv7-prefix" \
136+ --enable-static \
137+ --disable-shared
138+ make -j"$(nproc)"
139+ make install
140+ popd
141+
112142 - name : Install dependencies (Windows)
113143 if : runner.os == 'Windows'
114144 shell : pwsh
@@ -128,7 +158,7 @@ jobs:
128158 # ---------------------------
129159
130160 - name : Configure LLVM toolchain (macOS and Linux)
131- if : runner.os != 'Windows'
161+ if : runner.os != 'Windows' && matrix.name != 'linux-armv7'
132162 shell : bash
133163 run : |
134164 BREW_CMD="brew"
@@ -150,12 +180,30 @@ jobs:
150180 echo "LDFLAGS=-isysroot ${SDKROOT} -L${LIBCXX_DIR} -Wl,-rpath,${LIBCXX_DIR}" >> "$GITHUB_ENV"
151181 fi
152182
183+ # armv7: create toolchain file for cross build
184+ - name : Create CMake toolchain (armv7)
185+ if : runner.os == 'Linux' && matrix.name == 'linux-armv7'
186+ shell : bash
187+ run : |
188+ cat > "${RUNNER_TEMP}/toolchain-armv7.cmake" <<'EOF'
189+ set(CMAKE_SYSTEM_NAME Linux)
190+ set(CMAKE_SYSTEM_PROCESSOR armv7)
191+
192+ set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
193+ set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
194+
195+ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
196+ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
197+ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
198+ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
199+ EOF
200+
153201 # ---------------------------
154202 # Print versions (so you can confirm parity)
155203 # ---------------------------
156204
157205 - name : Tool versions (macOS/Linux)
158- if : runner.os != 'Windows'
206+ if : runner.os != 'Windows' && matrix.name != 'linux-armv7'
159207 shell : bash
160208 run : |
161209 echo "cmake: $(cmake --version | head -n 1)"
@@ -165,23 +213,29 @@ jobs:
165213 dpkg -l | grep -E 'libsodium-dev|zip' || true
166214 fi
167215
216+ - name : Tool versions (Linux armv7 cross)
217+ if : runner.os == 'Linux' && matrix.name == 'linux-armv7'
218+ shell : bash
219+ run : |
220+ echo "cmake: $(cmake --version | head -n 1)"
221+ arm-linux-gnueabihf-g++ --version | head -n 1
222+ echo "prefix: ${RUNNER_TEMP}/armv7-prefix"
223+ ls -la "${RUNNER_TEMP}/armv7-prefix/lib" || true
224+
168225 - name : Tool versions (Windows)
169226 if : runner.os == 'Windows'
170227 shell : pwsh
171228 run : |
172229 cmake --version
173230
174- # VS / MSVC version (safe, no failing exit codes)
175231 $vsver = (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
176232 -latest -products * -property installationVersion) 2>$null
177233 if ($vsver) { Write-Host "Visual Studio: $vsver" }
178234
179- # Show where cl.exe is, then print version without failing the step
180235 $cl = Get-Command cl.exe -ErrorAction SilentlyContinue
181236 if ($cl) {
182237 Write-Host "cl.exe: $($cl.Source)"
183238 cmd /c "cl /Bv" | Out-Host
184- # Some environments still return non-zero for cl commands; don't fail the job
185239 $global:LASTEXITCODE = 0
186240 }
187241
@@ -203,9 +257,9 @@ jobs:
203257 -DCMAKE_CXX_COMPILER="${CXX}"
204258 -DCMAKE_CXX_SCAN_FOR_MODULES=ON
205259
206- # ✅ Linux: build with clang (works), but disable tests for now
260+ # Linux native : build with clang (works), disable tests for now
207261 - name : Configure project (Linux)
208- if : runner.os == 'Linux'
262+ if : runner.os == 'Linux' && matrix.name != 'linux-armv7'
209263 run : >
210264 cmake -S . -B build -G Ninja
211265 -DCMAKE_BUILD_TYPE=Release
@@ -214,7 +268,19 @@ jobs:
214268 -DCMAKE_CXX_COMPILER="${CXX}"
215269 -DCMAKE_CXX_SCAN_FOR_MODULES=ON
216270
217- # ✅ Windows: VS generator + MSVC cl.exe
271+ # Linux armv7: cross build with GCC, disable modules scanning for stability
272+ - name : Configure project (Linux armv7)
273+ if : runner.os == 'Linux' && matrix.name == 'linux-armv7'
274+ shell : bash
275+ run : |
276+ cmake -S . -B build -G Ninja \
277+ -DCMAKE_BUILD_TYPE=Release \
278+ -DBUILD_TESTING=OFF \
279+ -DCMAKE_TOOLCHAIN_FILE="${RUNNER_TEMP}/toolchain-armv7.cmake" \
280+ -DCMAKE_PREFIX_PATH="${RUNNER_TEMP}/armv7-prefix" \
281+ -DCMAKE_CXX_SCAN_FOR_MODULES=OFF
282+
283+ # Windows: VS generator + MSVC cl.exe
218284 - name : Configure project (Windows)
219285 if : runner.os == 'Windows'
220286 shell : pwsh
@@ -271,8 +337,14 @@ jobs:
271337
272338 - name : Package artifacts (Linux)
273339 if : runner.os == 'Linux'
340+ shell : bash
274341 run : |
275- zip -j ${{ matrix.name }}.zip build/vaultguard build/recover_key
342+ # Native builds output to build/..., cross builds too (but different arch)
343+ zip -j ${{ matrix.name }}.zip build/vaultguard build/recover_key || {
344+ echo "Expected binaries not found. Listing build dir:"
345+ ls -la build || true
346+ exit 1
347+ }
276348
277349 # ---------------------------
278350 # Upload + Release
0 commit comments