Skip to content

Commit e296ab7

Browse files
committed
Enable Build and Continuous Integration for Linux
1 parent b6ff16b commit e296ab7

30 files changed

+259
-139
lines changed

.github/workflows/Engine-CI.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ jobs:
2424
uses: ./.github/workflows/macOS-build.yml
2525
with:
2626
targetFramework: net8.0
27+
28+
linux:
29+
needs: clang-format
30+
uses: ./.github/workflows/linux-build.yml
31+
with:
32+
targetFramework: net8.0
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: ZEngine Cmake Linux Workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
configuration:
7+
type: string
8+
default: 'Debug'
9+
targetFramework:
10+
type: string
11+
default: 'net8.0'
12+
13+
jobs:
14+
Linux-Build:
15+
name: cmake-build-linux-${{ inputs.configuration }}
16+
runs-on: ubuntu-24.04
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v2
21+
22+
- name: Download the Microsoft repository GPG keys
23+
run: wget -q https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb
24+
25+
- name: Register the Microsoft repository GPG keys
26+
run: sudo dpkg -i packages-microsoft-prod.deb
27+
28+
- name: Install LLVM-20
29+
run: |
30+
wget https://apt.llvm.org/llvm.sh
31+
chmod +x llvm.sh
32+
sudo ./llvm.sh 20
33+
34+
- name: Update the list of packages
35+
run: sudo apt-get update
36+
37+
- name: Install Dependencies
38+
run: sudo apt-get install libasound2-dev libgl1-mesa-dev libpulse-dev libdbus-1-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev cmake apt-transport-https software-properties-common gcc g++ powershell clang-format-20 glslang-tools libwayland-dev libxkbcommon-dev
39+
40+
- name: CMake Build
41+
run: .\Scripts\BuildEngine.ps1 -Configurations ${{inputs.configuration}}
42+
shell: pwsh
43+
44+
- name: Publish Build Artifacts
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: Build-linux-${{inputs.configuration}}
48+
path: |
49+
Result.Linux.x64.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/publish/
50+
Result.Linux.x64.${{inputs.configuration}}/__externals/Vulkan-Loader/loader/
51+
Result.Linux.x64.${{inputs.configuration}}/ZEngine/tests/ZEngineTests
52+
Result.Linux.x64.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.CSharp.resources.dll
53+
!Result.Linux.x64.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll
54+
!Result.Linux.x64.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.resources.dll
55+
!Result.Linux.x64.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.Scripting.resources.dll
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Deploy for linux
2+
#
3+
name: linux Deploy Workflow
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
targetFramework:
9+
type: string
10+
required: true
11+
configuration:
12+
type: string
13+
default: 'Release'
14+
15+
jobs:
16+
deploy:
17+
name: deploy-linux-${{ inputs.configuration }}
18+
runs-on: ubuntu-24.04
19+
steps:
20+
- uses: actions/download-artifact@v4
21+
with:
22+
path: Result.Linux.x64.${{ inputs.configuration }}
23+
name: Build-linux-Release
24+
25+
- name: Publish Artifacts
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: linux-${{ inputs.configuration }}
29+
path: Result.Linux.x64.${{inputs.configuration}}/Panzerfaust/${{ inputs.configuration }}/${{inputs.targetFramework}}/publish/

.github/workflows/job-test-linux.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Run tests for linux
2+
#
3+
name: linux Test Workflow
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
configuration:
9+
type: string
10+
default: 'Debug'
11+
12+
jobs:
13+
test:
14+
name: test-linux-${{ inputs.configuration }}
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Download Artifacts
21+
uses: actions/download-artifact@v4
22+
with:
23+
name: Build-linux-${{ inputs.configuration }}
24+
path: Result.Linux.x64.${{ inputs.configuration }}
25+
26+
- name: Update access permission of ZEngineTests
27+
run: chmod +x ./Result.Linux.x64.${{ inputs.configuration }}/ZEngine/tests/ZEngineTests
28+
29+
- name: Run Tests
30+
run: .\Scripts\RunTests.ps1 -Configurations ${{ inputs.configuration }}
31+
shell: pwsh

.github/workflows/linux-build.yml

Lines changed: 27 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,35 @@
1-
# @JeanPhilippeKernel : Disabled because we only support Windows as platform for now
2-
#
31
name: ZEngine Linux Build
42

53
on:
6-
push:
7-
branches: [ master ]
8-
pull_request:
9-
branches: [ master ]
4+
workflow_call:
5+
inputs:
6+
targetFramework:
7+
required: true
8+
type: string
109

1110
jobs:
12-
Linux-Build:
13-
runs-on: ubuntu-latest
11+
cmake-build:
1412
strategy:
1513
matrix:
16-
buildConfiguration: [Debug, Release]
17-
18-
steps:
19-
- name: Checkout repository
20-
uses: actions/checkout@v2
21-
22-
# - name: Checkout submodules
23-
# run: git submodule update --init --recursive
24-
25-
# - name: Install development library
26-
# run: sudo apt-get install libasound2-dev libgl1-mesa-dev libpulse-dev libdbus-1-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev
27-
28-
# - name: Install CMake
29-
# uses: jwlawson/[email protected]
30-
# with:
31-
# cmake-version: '3.20.x'
32-
33-
# - name: Install pre-requisite packages.
34-
# run: sudo apt-get install -y wget apt-transport-https software-properties-common
35-
36-
# - name: Download the Microsoft repository GPG keys
37-
# run: wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
38-
39-
# - name: Register the Microsoft repository GPG keys
40-
# run: sudo dpkg -i packages-microsoft-prod.deb
41-
42-
# - name: Update the list of packages after we added packages.microsoft.com
43-
# run: sudo apt-get update
44-
45-
# - name: Install PowerShell
46-
# run: sudo apt-get install -y powershell
47-
48-
# - name: Add GCC Toolchain repository
49-
# run: sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
50-
51-
# - name: Install GCC compiler
52-
# run: sudo apt install -y gcc-11
53-
54-
# - name: Install G++ compiler
55-
# run: sudo apt install -y g++-11
14+
buildConfiguration: [Debug, Release]
15+
uses: ./.github/workflows/job-cmakebuild-linux.yml
16+
with:
17+
configuration: ${{matrix.buildConfiguration}}
18+
targetframework: ${{inputs.targetFramework}}
19+
20+
test:
21+
needs: cmake-build
22+
strategy:
23+
matrix:
24+
testConfiguration: [Debug, Release]
25+
uses: ./.github/workflows/job-test-linux.yml
26+
with:
27+
configuration: ${{matrix.testConfiguration}}
28+
29+
deploy:
30+
needs: test
31+
uses: ./.github/workflows/job-deploy-linux.yml
32+
with:
33+
configuration: Release
34+
targetframework: ${{inputs.targetFramework}}
5635

57-
# - name: CMake Build
58-
# run: .\Scripts\BuildEngine.ps1 -Configurations ${{matrix.buildConfiguration}}
59-
# shell: pwsh

Obelisk/EntryPoint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ int applicationEntryPoint(int argc, char* argv[])
1818
MemoryManager manager = {};
1919
MemoryConfiguration config = {.DefaultSize = ZGiga(3u)};
2020
manager.Initialize(config);
21-
auto arena = &(manager.ArenaAllocator);
21+
auto arena = &(manager.Allocator);
2222

2323
LoggerConfiguration logger_cfg = {};
2424
Logger::Initialize(arena, logger_cfg);

Panzerfaust/Panzerfaust.csproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<ApplicationIcon>./Assets/avalonia-logo.ico</ApplicationIcon>
1010
<BaseOutputPath Condition="$([MSBuild]::IsOSPlatform('Windows')) == 'true'">..\Result.Windows.x64.MultiConfig</BaseOutputPath>
1111
<BaseOutputPath Condition="$([MSBuild]::IsOSPlatform('OSX')) == 'true'">..\Result.Darwin.x64.$(Configuration)</BaseOutputPath>
12+
<BaseOutputPath Condition="$([MSBuild]::IsOSPlatform('Linux')) == 'true'">..\Result.Linux.x64.$(Configuration)</BaseOutputPath>
1213
<Platforms>x64;arm64</Platforms>
1314
</PropertyGroup>
1415
<PropertyGroup Condition=" $([MSBuild]::IsOSPlatform('Windows')) == 'true' AND '$(Configuration)' == 'Debug' ">
@@ -56,6 +57,21 @@
5657
<OutputPath>$(BaseOutputPath)\Panzerfaust\$(Configuration)</OutputPath>
5758
<DefineConstants>TRACE;__MACOS__</DefineConstants>
5859
</PropertyGroup>
60+
<PropertyGroup Condition=" $([MSBuild]::IsOSPlatform('Linux')) == 'true' AND '$(Configuration)' == 'Debug' ">
61+
<PlatformTarget>x64</PlatformTarget>
62+
<DebugSymbols>true</DebugSymbols>
63+
<DebugType>full</DebugType>
64+
<Optimize>false</Optimize>
65+
<OutputPath>$(BaseOutputPath)\Panzerfaust\$(Configuration)</OutputPath>
66+
<DefineConstants>TRACE;DEBUG</DefineConstants>
67+
</PropertyGroup>
68+
<PropertyGroup Condition=" $([MSBuild]::IsOSPlatform('Linux')) == 'true' AND '$(Configuration)' == 'Release' ">
69+
<PlatformTarget>x64</PlatformTarget>
70+
<DebugType>pdbonly</DebugType>
71+
<Optimize>true</Optimize>
72+
<OutputPath>$(BaseOutputPath)\Panzerfaust\$(Configuration)</OutputPath>
73+
<DefineConstants>TRACE</DefineConstants>
74+
</PropertyGroup>
5975
<PropertyGroup>
6076
<ApplicationManifest>app.manifest</ApplicationManifest>
6177
</PropertyGroup>

Scripts/BuildEngine.ps1

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) {
113113
# Check the system name
114114
if ($IsLinux) {
115115
$systemName = "Linux"
116-
$cMakeGenerator
117116
}
118117
elseif ($IsMacOS) {
119118
$systemName = "Darwin"
@@ -131,7 +130,6 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) {
131130
[string]$BuildDirectoryName = "Result." + $systemName + "." + $architecture + "." + $BuildDirectoryNameExtension
132131
[string]$buildDirectoryPath = [IO.Path]::Combine($RepoRoot, $BuildDirectoryName)
133132
[string]$cMakeCacheVariableOverride = ""
134-
[string]$cMakeGenerator = ""
135133

136134
# Create build directory
137135
if (-Not (Test-Path $buildDirectoryPath)) {
@@ -171,11 +169,7 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) {
171169
$cMakeCacheVariableOverride += ' -DCMAKE_CONFIGURATION_TYPES=Debug;Release '
172170
}
173171
"Linux" {
174-
$cMakeGenerator = "-G `"Unix Makefiles`""
175-
176-
# Set Linux build compiler
177-
$env:CC = '/usr/bin/gcc-11'
178-
$env:CXX = '/usr/bin/g++-11'
172+
$cMakeGenerator = "-G `"Ninja`""
179173
}
180174
"Darwin" {
181175
$cMakeGenerator = "-G `"Xcode`""

Scripts/PostBuild.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ param (
2828
[string[]] $SystemName = 'Windows',
2929

3030
[Parameter(HelpMessage="Architecture type to build, default to x64")]
31-
[ValidateSet('win-x64', 'arm64', 'osx-x64', 'osx-arm64')]
31+
[ValidateSet('win-x64', 'arm64', 'osx-x64', 'osx-arm64', 'linux-x64')]
3232
[string[]] $Architectures = 'win-x64',
3333

3434
[Parameter(HelpMessage="Configuration type to build, default to Debug")]
@@ -103,7 +103,8 @@ $ContentsToProcess = @(
103103
}
104104
}
105105
"Linux" {
106-
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"}
106+
@{ From = "$OuputBuildDirectory\Obelisk"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"}
107+
@{ From = "$OuputBuildDirectory\Obelisk"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\publish\Editor"}
107108
}
108109
Default {
109110
throw 'This system is not supported'
@@ -133,4 +134,4 @@ foreach ($item in $ContentsToProcess) {
133134
[string]$ToDirectory = $content.To
134135
Write-Host "Copied $name --> $ToDirectory"
135136
}
136-
}
137+
}

Scripts/RunTests.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ function RunTests {
6767
"Darwin" {
6868
$testExecutablePath = Join-Path $OutputBuildDirectory -ChildPath "ZEngine/tests/$Configuration/ZEngineTests"
6969
}
70-
"Linux" {}
70+
"Linux" {
71+
$testExecutablePath = Join-Path $OutputBuildDirectory -ChildPath "ZEngine/tests/ZEngineTests"
72+
}
7173
Default {
7274
throw 'This system is not supported'
7375
}
@@ -79,11 +81,11 @@ function RunTests {
7981
& $testExecutablePath
8082
}
8183
else {
82-
Write-Warning "Test executable does not exist: $testExecutablePath"
84+
Write-Error "Test executable does not exist: $testExecutablePath"
8385
}
8486
}
8587

8688
# Run tests for each configuration
8789
foreach ($config in $Configurations) {
88-
RunTests -Configuration $config
90+
RunTests -Configuration $config
8991
}

0 commit comments

Comments
 (0)