update premake #149
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
workflow_dispatch: | |
inputs: | |
remote_debug: | |
type: boolean | |
description: 'Run TMate if Building or Testing fails. (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
push: | |
branches: [ "main", "devel5"] | |
pull_request: | |
branches: [ "main", "devel5" ] | |
jobs: | |
MSVC: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
config: [Debug, Shipping] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
fetch-depth: '1' | |
- name: Premake | |
shell: pwsh | |
run: .\build\bin\win\premake5 --file=premake5.lua vs2022 | |
- name: Build | |
shell: pwsh | |
run: | | |
Import-Module (& .\build\bin\win\vswhere.exe -find Common7\Tools\Microsoft.VisualStudio.DevShell.dll) | |
Enter-VsDevShell -VsInstallPath (& .\build\bin\win\vswhere.exe -property installationPath) -Arch amd64 -SkipAutomaticLocation | |
msbuild .\out\vs2022\Equilibrium.sln /t:'base\base:Rebuild;base\base_memory_unittests:Rebuild;base\base_unittests:Rebuild' /p:Configuration=${{ matrix.config }} /p:Platform=x64 -m | |
- name: Test | |
shell: pwsh | |
run: Get-ChildItem -Path (Resolve-Path .\out\vs*\bin\*\equilibrium\) -Filter *.exe | ForEach-Object $_ { $p = @(); $p += '--gtest_color=no '; $p += '--gtest_output=xml:.\tests\' + $_.Name.Replace('.exe','') + '.xml'; &$_.PSPath $p; } | |
- name: Convert Gtest to JUnit | |
if: ${{ !cancelled() }} | |
shell: pwsh | |
run: | | |
$xsl = New-Object System.Xml.Xsl.XslCompiledTransform | |
$xsl.Load("${{github.workspace}}\.github\gtest_to_junit.xsl") | |
Get-ChildItem -Path .\tests\ -Filter *.xml | Where-Object { !$_.Name.StartsWith('convert') } | ForEach-Object $_ { $xsl.Transform($_.FullName,($_.Directory.FullName + '\convert-' + $_.Name)); } | |
- name: Setup tmate debug session | |
if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.remote_debug}} | |
uses: mxschmitt/action-tmate@v3 | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
if: ${{ !cancelled() }} | |
with: | |
name: test-results | |
path: .\tests\convert-*.xml | |
Linux: | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
config: [debug, shipping] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
fetch-depth: '1' | |
- name: Setup Dynamic Test Binary Name | |
run: echo "TEST_BINARY_NAME=$(if [[ '${{ matrix.config }}' == 'debug' ]]; then echo 'base_unittests_x86_64_d'; else echo 'base_unittests'; fi)" >> $GITHUB_ENV | |
- name: Setup development environment | |
uses: cachix/install-nix-action@v27 | |
with: | |
github_access_token: ${{ secrets.GH_TOKEN }} | |
- run: nix flake check | |
- name: Premake | |
run: ./build/premake_linux.sh ${{ matrix.config }} | |
# Explicitly source the environment with nix develop to contain the output | |
# in its own step, so that it can be cached. | |
- name: Fetch build tools | |
run: nix develop | |
# Build - again with nix develop, just to source env, should be instant. | |
- name: Build | |
run: nix develop .#linux --command bash -c 'gcc -v && make -C ./out/gmake2 config=${{ matrix.config }} -j$(nproc)' | |
- name: Test | |
run: | | |
# ubuntu 22.04 comes with libstdc++ | |
export LD_LIBRARY_PATH=$(dirname $(ldconfig -p | grep libstdc++.so.6 | head -n1 | awk '{print $4}')):$LD_LIBRARY_PATH | |
echo "LD_LIBRARY_PATH set to $LD_LIBRARY_PATH" | |
config="${{ matrix.config }}" | |
capitalized="$(echo "${config:0:1}" | tr '[:lower:]' '[:upper:]')${config:1}" | |
./out/gmake2/bin/"$capitalized"/equilibrium/"${{ env.TEST_BINARY_NAME }}" |