mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-07-19 14:30:37 +00:00
208 lines
7.1 KiB
YAML
208 lines
7.1 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "main"
|
|
pull_request:
|
|
branches:
|
|
- "main"
|
|
|
|
env:
|
|
SCCACHE_GHA_ENABLED: "on"
|
|
SCCACHE_BASEDIRS: ${{ github.workspace }}
|
|
SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
|
|
|
|
jobs:
|
|
build-test-linux:
|
|
strategy:
|
|
matrix:
|
|
build_arch: [x86, x64]
|
|
toolset: [gcc, clang]
|
|
include:
|
|
- build_arch: x86
|
|
gtk_packages: libgtk-4-dev:i386 libwebkitgtk-6.0-dev:i386
|
|
- build_arch: x64
|
|
gtk_packages: libgtk-4-dev libwebkitgtk-6.0-dev
|
|
name: Build-Test Linux ${{ matrix.toolset }} ${{ matrix.build_arch }}
|
|
runs-on: ubuntu-latest
|
|
container: ubuntu:24.04
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- name: Enable i386 architecture
|
|
if: ${{ matrix.build_arch == 'x86' }}
|
|
run: dpkg --add-architecture i386
|
|
|
|
- name: Install base packages
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y wget tar git make curl ${{ matrix.gtk_packages }}
|
|
|
|
- name: Checkout repository
|
|
uses: actions/[email protected]
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Configure gcc
|
|
uses: ./.github/actions/configure-gcc
|
|
with:
|
|
gcc_version: 14
|
|
enable_x86: ${{ case(matrix.build_arch == 'x86', 'true', 'false') }}
|
|
|
|
- name: Configure clang
|
|
if: ${{ matrix.toolset == 'clang' }}
|
|
uses: ./.github/actions/configure-clang
|
|
with:
|
|
clang_version: 20
|
|
enable_x86: ${{ case(matrix.build_arch == 'x86', 'true', 'false') }}
|
|
|
|
- name: Install node
|
|
uses: actions/[email protected]
|
|
with:
|
|
node-version: 24
|
|
|
|
- name: Set up sccache
|
|
uses: mozilla-actions/[email protected]
|
|
with:
|
|
version: v0.15.0
|
|
|
|
- name: Premake generate
|
|
working-directory: ${{ github.workspace }}
|
|
env:
|
|
PREMAKE_NO_PROMPT: 1
|
|
run: ./generate.sh --cc=${{ matrix.toolset }} --modman
|
|
|
|
- name: Build UI
|
|
working-directory: ${{ github.workspace }}
|
|
run: |
|
|
npm install
|
|
npm run build
|
|
|
|
- name: Build
|
|
working-directory: ${{ github.workspace }}
|
|
run: |
|
|
if [[ "${{ matrix.toolset }}" == "gcc" ]]; then
|
|
export CC="sccache gcc"
|
|
export CXX="sccache g++"
|
|
else
|
|
export CC="sccache clang"
|
|
export CXX="sccache clang++"
|
|
fi
|
|
[[ "${{ matrix.build_arch }}" == "x86" ]] && export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig:$PKG_CONFIG_PATH || true
|
|
echo "Package config path: $PKG_CONFIG_PATH"
|
|
scripts/build.sh release ${{ matrix.build_arch }}
|
|
chmod +x build/bin/Release_${{ matrix.build_arch }}/{ModMan,ImageConverter,Unlinker,Linker}
|
|
|
|
- name: Test
|
|
working-directory: ${{ github.workspace }}/build/lib/Release_${{ matrix.build_arch }}/tests
|
|
run: |
|
|
./CommonTests
|
|
./ObjCommonTests
|
|
./ObjCompilingTests
|
|
./ObjLoadingTests
|
|
./ObjWritingTests
|
|
./ParserTests
|
|
./SystemTests
|
|
./ZoneCodeGeneratorLibTests
|
|
./ZoneCommonTests
|
|
|
|
build-test-windows:
|
|
strategy:
|
|
matrix:
|
|
build_arch: [x86, x64]
|
|
include:
|
|
- build_arch: x86
|
|
msbuild_config: Win32
|
|
- build_arch: x64
|
|
msbuild_config: x64
|
|
name: Build-Test Windows ${{ matrix.build_arch }}
|
|
runs-on: windows-2025-vs2026
|
|
steps:
|
|
- name: Install node
|
|
uses: actions/[email protected]
|
|
with:
|
|
node-version: 24
|
|
|
|
- name: Add MSBuild to PATH
|
|
uses: microsoft/[email protected]
|
|
|
|
- name: Set up sccache
|
|
uses: mozilla-actions/[email protected]
|
|
with:
|
|
version: v0.15.0
|
|
|
|
- name: Configure sccache for MSBuild
|
|
shell: pwsh
|
|
run: |
|
|
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
|
$installationPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
|
|
if (-not $installationPath) {
|
|
throw "Could not locate the Visual C++ tools"
|
|
}
|
|
|
|
$toolsVersionFile = Join-Path $installationPath "VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt"
|
|
$toolsVersion = (Get-Content -Raw -LiteralPath $toolsVersionFile).Trim()
|
|
$targetArchitecture = "${{ matrix.build_arch }}"
|
|
$compilerDirectory = Join-Path $installationPath "VC\Tools\MSVC\$toolsVersion\bin\Hostx86\$targetArchitecture"
|
|
$compilerPath = Join-Path $compilerDirectory "cl.exe"
|
|
if (-not (Test-Path -LiteralPath $compilerPath)) {
|
|
throw "Could not locate cl.exe at $compilerPath"
|
|
}
|
|
|
|
# A cl.exe-named copy enables sccache's compiler-proxy mode. The real
|
|
# compiler directory must also be on PATH so cache misses can run cl.exe.
|
|
$wrapperDirectory = Join-Path $env:RUNNER_TEMP "sccache-msvc"
|
|
$wrapperPath = Join-Path $wrapperDirectory "cl.exe"
|
|
New-Item -ItemType Directory -Path $wrapperDirectory -Force | Out-Null
|
|
Copy-Item -LiteralPath (Get-Command sccache.exe).Source -Destination $wrapperPath -Force
|
|
$compilerDirectory >> $env:GITHUB_PATH
|
|
"SCCACHE_CL_WRAPPER=$wrapperPath" >> $env:GITHUB_ENV
|
|
|
|
- name: Checkout repository
|
|
uses: actions/[email protected]
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Premake generate
|
|
working-directory: ${{ github.workspace }}
|
|
env:
|
|
PREMAKE_NO_PROMPT: 1
|
|
run: ./generate.bat --modman
|
|
|
|
- name: Build UI
|
|
working-directory: ${{ github.workspace }}
|
|
run: |
|
|
npm install
|
|
npm run build
|
|
|
|
- name: Build
|
|
working-directory: ${{ github.workspace }}
|
|
run: |
|
|
msbuild /m /p:TrackFileAccess=false /p:UseMultiToolTask=true "/p:CLToolExe=$env:SCCACHE_CL_WRAPPER" /p:Configuration=Release /p:Platform=${{ matrix.msbuild_config }} build
|
|
|
|
- name: Test
|
|
working-directory: ${{ github.workspace }}/build/lib/Release_${{ matrix.build_arch }}/tests
|
|
run: |
|
|
$combinedExitCode = 0
|
|
./CommonTests
|
|
$combinedExitCode = [System.Math]::max($combinedExitCode, $LASTEXITCODE)
|
|
./ObjCommonTests
|
|
$combinedExitCode = [System.Math]::max($combinedExitCode, $LASTEXITCODE)
|
|
./ObjCompilingTests
|
|
$combinedExitCode = [System.Math]::max($combinedExitCode, $LASTEXITCODE)
|
|
./ObjLoadingTests
|
|
$combinedExitCode = [System.Math]::max($combinedExitCode, $LASTEXITCODE)
|
|
./ObjWritingTests
|
|
$combinedExitCode = [System.Math]::max($combinedExitCode, $LASTEXITCODE)
|
|
./ParserTests
|
|
$combinedExitCode = [System.Math]::max($combinedExitCode, $LASTEXITCODE)
|
|
./SystemTests
|
|
$combinedExitCode = [System.Math]::max($combinedExitCode, $LASTEXITCODE)
|
|
./ZoneCodeGeneratorLibTests
|
|
$combinedExitCode = [System.Math]::max($combinedExitCode, $LASTEXITCODE)
|
|
./ZoneCommonTests
|
|
$combinedExitCode = [System.Math]::max($combinedExitCode, $LASTEXITCODE)
|
|
exit $combinedExitCode
|