Skip to content

Build cross-platform installers #94

Build cross-platform installers

Build cross-platform installers #94

Workflow file for this run

name: Build cross-platform installers
on:
workflow_dispatch:
inputs:
upload_assets:
description: "Update latest release"
required: false
default: "true"
jobs:
build:
name: ${{ matrix.os }} / ${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
# ================= Windows =================
- os: windows
arch: x64
runner: windows-latest
generator: "Visual Studio 17 2022"
vs_arch: x64
triplet: x64-windows-static
- os: windows
arch: arm64
runner: windows-11-arm
generator: "Visual Studio 17 2022"
vs_arch: ARM64
triplet: arm64-windows-static
# ================= Linux =================
- os: linux
arch: x64
runner: ubuntu-latest
generator: Ninja
triplet: x64-linux
- os: linux
arch: arm64
runner: ubuntu-24.04-arm
generator: Ninja
triplet: arm64-linux
# ================= macOS =================
- os: macos
arch: x64
runner: macos-15-intel
generator: Ninja
triplet: x64-osx
- os: macos
arch: arm64
runner: macos-latest
generator: Ninja
triplet: arm64-osx
steps:
- name: Correlation marker
run: echo "distinct_id=${{ inputs.distinct_id }}"
- name: Checkout wrapper repository
uses: actions/checkout@v4
- name: Clone external repository
run: |
git clone --recurse-submodules https://github.com/sineorg/installer.git external
# ---------- Linux OpenGL / X11 ----------
- name: Install OpenGL dependencies (Linux)
if: matrix.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libgl1-mesa-dev \
libx11-dev \
libxrandr-dev \
libxinerama-dev \
libxcursor-dev \
libxi-dev
# ---------- Ninja ----------
- name: Install Ninja (Linux)
if: matrix.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
# ---------- vcpkg ----------
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: vcpkg
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
# ---------- Configure ----------
- name: Configure (Windows)
if: matrix.os == 'windows'
run: |
cmake -S external -B build `
-G "${{ matrix.generator }}" `
-A ${{ matrix.vs_arch }} `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }}
env:
VCPKG_ROOT: ${{ github.workspace }}\vcpkg
- name: Configure (Linux / macOS)
if: matrix.os != 'windows'
run: |
cmake -S external -B build \
-G "${{ matrix.generator }}"
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
# ---------- Build ----------
- name: Build
run: |
cmake --build build --config Release
# ---------- Artifacts ----------
- name: Make executable (Linux/macOS)
if: runner.os != 'Windows'
run: |
chmod +x build/sine_installer
if [[ "${{ matrix.os }}" == "linux" ]]; then
cp build/sine_installer sine-linux-${{ matrix.arch }}
elif [[ "${{ matrix.os }}" == "macos" ]]; then
cp build/sine_installer sine-osx-${{ matrix.arch }}
fi
- name: Prepare executable for upload
if: runner.os == 'Windows'
shell: pwsh
run: |
Copy-Item "build/Release/sine_installer.exe" -Destination "sine-win-${{ matrix.arch }}.exe"
- name: Upload Linux executable
if: matrix.os == 'linux'
uses: actions/upload-artifact@v4
with:
name: sine-linux-${{ matrix.arch }}
path: sine-linux-${{ matrix.arch }}
- name: Upload macOS executable
if: matrix.os == 'macos'
uses: actions/upload-artifact@v4
with:
name: sine-osx-${{ matrix.arch }}
path: sine-osx-${{ matrix.arch }}
- name: Upload Windows executable
if: matrix.os == 'windows'
uses: actions/upload-artifact@v4
with:
name: sine-win-${{ matrix.arch }}
path: sine-win-${{ matrix.arch }}.exe