Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
367 changes: 367 additions & 0 deletions .github/workflows/RELEASE_CHECK.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,367 @@
name: Release check

on:
push:
branches:
- main
- dev
- release/**
paths:
- ".github/workflows/RELEASE_CHECK.yml"
- ".github/workflows/release.yml"
- "CMakeLists.txt"
- "cmake/**"
- "config/**"
- "examples/**"
- "tests/**"
- "modules/**"
- "scripts/**"
- ".gitmodules"
- "vcpkg.json"
- "README.md"
- "CHANGELOG.md"

pull_request:
branches:
- main
- dev
- release/**
paths:
- ".github/workflows/RELEASE_CHECK.yml"
- ".github/workflows/release.yml"
- "CMakeLists.txt"
- "cmake/**"
- "config/**"
- "examples/**"
- "tests/**"
- "modules/**"
- "scripts/**"
- ".gitmodules"
- "vcpkg.json"
- "README.md"
- "CHANGELOG.md"

workflow_dispatch:

permissions:
contents: read

concurrency:
group: release-check-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release-check:
name: check (${{ matrix.vixos }} / ${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
vixos: linux
arch: x86_64

- os: ubuntu-24.04-arm
vixos: linux
arch: aarch64

- os: macos-15-intel
vixos: macos
arch: x86_64

- os: macos-14
vixos: macos
arch: aarch64

- os: windows-2022
vixos: windows
arch: x86_64

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Setup CMake
uses: lukka/get-cmake@latest

- name: Install deps (Linux x86_64)
if: runner.os == 'Linux' && matrix.arch == 'x86_64'
shell: bash
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
ninja-build \
ca-certificates \
git \
curl \
nlohmann-json3-dev \
libssl-dev \
zlib1g-dev \
libsqlite3-dev \
libbrotli-dev \
libspdlog-dev \
libfmt-dev

- name: Setup Linux aarch64 toolchain
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
shell: bash
run: |
set -euxo pipefail

sudo dpkg --add-architecture arm64
sudo apt-get update

sudo apt-get install -y --no-install-recommends \
build-essential \
gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu \
pkg-config \
ninja-build \
ca-certificates \
git \
curl \
nlohmann-json3-dev:arm64 \
libssl-dev:arm64 \
zlib1g-dev:arm64 \
libsqlite3-dev:arm64 \
libbrotli-dev:arm64 \
libspdlog-dev \
libfmt-dev

cat > toolchain-aarch64.cmake <<'EOF'
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)

set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)

set(CMAKE_FIND_ROOT_PATH
/usr/aarch64-linux-gnu
/usr/lib/aarch64-linux-gnu
/usr/include/aarch64-linux-gnu
/usr
)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)

list(APPEND CMAKE_PREFIX_PATH
/usr/lib/x86_64-linux-gnu/cmake
/usr/lib/cmake
/lib/x86_64-linux-gnu/cmake
)

set(PKG_CONFIG_EXECUTABLE /usr/bin/pkg-config)
set(ENV{PKG_CONFIG_LIBDIR} "/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig")
set(ENV{PKG_CONFIG_PATH} "")
EOF

- name: Install deps (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
set -euxo pipefail
brew update
brew install pkg-config openssl@3 spdlog fmt

- name: Setup vcpkg (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
git clone https://github.com/microsoft/vcpkg $env:GITHUB_WORKSPACE\vcpkg
"VCPKG_ROOT=$env:GITHUB_WORKSPACE\vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Append
cd $env:GITHUB_WORKSPACE\vcpkg
.\bootstrap-vcpkg.bat

- name: Configure (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -euxo pipefail

CMAKE_ARGS=(
-S . -B build -G Ninja
-DCMAKE_BUILD_TYPE=Release
-DVIX_ENABLE_INSTALL=OFF
-DVIX_DB_USE_MYSQL=OFF
-DVIX_CORE_WITH_MYSQL=OFF
-DVIX_ENABLE_HTTP_COMPRESSION=OFF
)

if [ "${{ runner.os }}" = "Linux" ] && [ "${{ matrix.arch }}" = "aarch64" ]; then
CMAKE_ARGS+=(
-DCMAKE_TOOLCHAIN_FILE="${GITHUB_WORKSPACE}/toolchain-aarch64.cmake"
)
fi

if [ "${{ runner.os }}" = "macOS" ]; then
BREW_PREFIX="$(brew --prefix)"
BREW_SSL="$(brew --prefix openssl@3 2>/dev/null || true)"

if [ -n "$BREW_SSL" ] && [ -d "$BREW_SSL" ]; then
CMAKE_ARGS+=(-DOPENSSL_ROOT_DIR="$BREW_SSL")
CMAKE_ARGS+=(-DCMAKE_PREFIX_PATH="$BREW_PREFIX")
fi
fi

: > cmake_output.log
cmake "${CMAKE_ARGS[@]}" 2>&1 | tee -a cmake_output.log

- name: Build (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -euxo pipefail
: > build_output.log
cmake --build build -j 2 2>&1 | tee -a build_output.log

- name: Package and validate (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -euxo pipefail

BIN=""
for p in "build/vix" "build/bin/vix" "build/Release/vix"; do
if [ -f "$p" ]; then
BIN="$p"
break
fi
done

if [ -z "$BIN" ]; then
echo "::error::Expected vix binary not found"
find build -maxdepth 6 -type f -name vix -print || true
exit 1
fi

mkdir -p dist smoke
cp "$BIN" dist/vix
chmod +x dist/vix

ASSET="vix-${{ matrix.vixos }}-${{ matrix.arch }}.tar.gz"
tar -C dist -czf "dist/$ASSET" vix
rm -f dist/vix

tar -xzf "dist/$ASSET" -C smoke
file smoke/vix

if [ "${{ matrix.vixos }}" = "linux" ] && [ "${{ matrix.arch }}" = "x86_64" ]; then
ldd smoke/vix || true
smoke/vix --version
fi

if [ "${{ matrix.vixos }}" = "macos" ]; then
smoke/vix --version
fi

- name: Vcpkg install (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd $env:GITHUB_WORKSPACE
& "$env:VCPKG_ROOT\vcpkg.exe" install --triplet x64-windows --x-manifest-root "$env:GITHUB_WORKSPACE"
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

- name: Configure (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
"" | Out-File -FilePath cmake_output.log -Encoding utf8

cmake -S . -B build -A x64 `
-DVIX_ENABLE_INSTALL=OFF `
-DVIX_DB_USE_MYSQL=OFF `
-DVIX_CORE_WITH_MYSQL=OFF `
-DVIX_ENABLE_HTTP_COMPRESSION=OFF `
-DVCPKG_TARGET_TRIPLET=x64-windows `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake" 2>&1 | Tee-Object -FilePath cmake_output.log -Append

if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

- name: Build (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
"" | Out-File -FilePath build_output.log -Encoding utf8
cmake --build build --config Release 2>&1 | Tee-Object -FilePath build_output.log -Append
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

- name: Package and validate (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$candidates = @(
"build\vix.exe",
"build\Release\vix.exe",
"build\bin\vix.exe",
"build\Release\bin\vix.exe"
)

$bin = $null
foreach ($p in $candidates) {
if (Test-Path $p) {
$bin = $p
break
}
}

if (!$bin) {
Write-Host "::error::Expected vix.exe not found"
if (Test-Path "build") {
Get-ChildItem -Recurse build | Select-Object FullName
}
exit 1
}

New-Item -ItemType Directory -Force -Path dist | Out-Null
Copy-Item $bin dist\vix.exe

$asset = "vix-windows-${{ matrix.arch }}.zip"
Compress-Archive -Path dist\vix.exe -DestinationPath "dist\$asset" -Force

New-Item -ItemType Directory -Force -Path smoke | Out-Null
Expand-Archive -Path "dist\$asset" -DestinationPath smoke -Force
.\smoke\vix.exe --version

- name: Collect logs
if: always()
shell: bash
run: |
set +e
OUT="logs/${{ matrix.vixos }}-${{ matrix.arch }}"
mkdir -p "$OUT"

test -f cmake_output.log && cp -f cmake_output.log "$OUT/" || true
test -f build_output.log && cp -f build_output.log "$OUT/" || true

if [ -d build ]; then
find build -maxdepth 4 -type f \
\( -name "CMakeCache.txt" -o -name "CMakeError.log" -o -name "CMakeOutput.log" -o -name "CMakeConfigureLog.yaml" \) \
-exec cp -f {} "$OUT/" \; || true
fi

- name: Upload logs
if: always()
uses: actions/upload-artifact@v4
with:
name: release-check-logs-${{ matrix.vixos }}-${{ matrix.arch }}
path: logs/${{ matrix.vixos }}-${{ matrix.arch }}/*
if-no-files-found: warn

- name: Upload checked package
uses: actions/upload-artifact@v4
with:
name: release-check-dist-${{ matrix.vixos }}-${{ matrix.arch }}
path: dist/*
if-no-files-found: error
Loading