170 lines
5.2 KiB
YAML
170 lines
5.2 KiB
YAML
# .github/workflows/release.yml
|
|
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
arch: x86_64
|
|
target_name: creep-linux-x86_64
|
|
|
|
- os: ubuntu-latest
|
|
arch: arm64
|
|
target_name: creep-linux-arm64
|
|
|
|
- os: windows-latest
|
|
arch: x86_64
|
|
target_name: creep-windows-x86_64.exe
|
|
|
|
- os: windows-latest
|
|
arch: arm64
|
|
target_name: creep-windows-arm64.exe
|
|
|
|
- os: macos-latest
|
|
arch: arm64
|
|
target_name: creep-macos-arm64
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
name: "Build · ${{ matrix.target_name }}"
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Log build target info
|
|
shell: bash
|
|
run: |
|
|
echo "================================================"
|
|
echo " Target : ${{ matrix.target_name }}"
|
|
echo " OS : ${{ matrix.os }}"
|
|
echo " Arch : ${{ matrix.arch }}"
|
|
echo " Ref : ${{ github.ref }}"
|
|
echo " Commit : ${{ github.sha }}"
|
|
echo "================================================"
|
|
|
|
# Linux ARM64 cross-compiler
|
|
- name: Install ARM64 cross-compiler (Linux ARM64 only)
|
|
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'arm64'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
|
aarch64-linux-gnu-g++ --version
|
|
|
|
# CMake configure
|
|
- name: Configure (Linux x86_64)
|
|
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'x86_64'
|
|
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
|
|
|
|
- name: Configure (Linux ARM64)
|
|
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'arm64'
|
|
run: |
|
|
cmake -B build -DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_SYSTEM_NAME=Linux \
|
|
-DCMAKE_SYSTEM_PROCESSOR=aarch64 \
|
|
-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
|
|
-DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++
|
|
|
|
- name: Configure (Windows x86_64)
|
|
if: matrix.os == 'windows-latest' && matrix.arch == 'x86_64'
|
|
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -A x64
|
|
|
|
- name: Configure (Windows ARM64)
|
|
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64'
|
|
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -A ARM64
|
|
|
|
- name: Configure (macOS ARM64)
|
|
if: matrix.os == 'macos-latest'
|
|
run: |
|
|
cmake -B build -DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_OSX_ARCHITECTURES=arm64
|
|
|
|
# Build
|
|
- name: Build
|
|
run: cmake --build build --config Release --verbose
|
|
|
|
# Verify binary exists (Linux/macOS)
|
|
- name: Verify binary exists (Linux / macOS)
|
|
if: runner.os != 'Windows'
|
|
run: |
|
|
BIN=$(find build -maxdepth 4 -type f -name creep | head -n 1)
|
|
if [ -z "$BIN" ]; then
|
|
echo "✗ ERROR: creep binary not found"
|
|
echo "Contents of build/:"
|
|
find build -maxdepth 4 -type f
|
|
exit 1
|
|
fi
|
|
echo "✓ Binary found at $BIN"
|
|
mv "$BIN" "${{ matrix.target_name }}"
|
|
|
|
# Verify binary exists (Windows)
|
|
- name: Verify binary exists (Windows)
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
$bin = Get-ChildItem -Recurse -Filter creep.exe | Select-Object -First 1
|
|
if (-not $bin) {
|
|
Write-Error "✗ ERROR: creep.exe not found"
|
|
Get-ChildItem -Recurse build
|
|
exit 1
|
|
}
|
|
Write-Host "✓ Binary found at $($bin.FullName)"
|
|
Move-Item $bin.FullName "${{ matrix.target_name }}"
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.target_name }}
|
|
path: ${{ matrix.target_name }}
|
|
if-no-files-found: error
|
|
|
|
release:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
name: "Create Release"
|
|
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts/
|
|
|
|
- name: Verify all artifacts downloaded
|
|
run: |
|
|
echo "→ Checking artifacts..."
|
|
EXPECTED=(
|
|
"creep-linux-x86_64/creep-linux-x86_64"
|
|
"creep-linux-arm64/creep-linux-arm64"
|
|
"creep-windows-x86_64.exe/creep-windows-x86_64.exe"
|
|
"creep-windows-arm64.exe/creep-windows-arm64.exe"
|
|
"creep-macos-arm64/creep-macos-arm64"
|
|
)
|
|
MISSING=0
|
|
for f in "${EXPECTED[@]}"; do
|
|
if [ ! -f "artifacts/$f" ]; then
|
|
echo "✗ Missing: $f"
|
|
MISSING=$((MISSING + 1))
|
|
else
|
|
echo "✓ Found: $f"
|
|
fi
|
|
done
|
|
if [ "$MISSING" -gt 0 ]; then
|
|
echo "✗ $MISSING artifact(s) missing — aborting release"
|
|
exit 1
|
|
fi
|
|
echo "✓ All artifacts present"
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: artifacts/**/*
|
|
fail_on_unmatched_files: true
|
|
generate_release_notes: true
|