Skip to content

Commit 0e55a6d

Browse files
committed
ci: Add Build workflow
`lxmonika` and the `monika.exe` CLI will be built and packed for all supported architectures for each commit. Monix is not included. This workflow only includes a basic build. No testing is carried out yet.
1 parent be8d24a commit 0e55a6d

File tree

3 files changed

+161
-0
lines changed

3 files changed

+161
-0
lines changed

.github/workflows/build.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
- "staging"
8+
- "dev/**"
9+
pull_request:
10+
branches:
11+
- "master"
12+
13+
jobs:
14+
build:
15+
strategy:
16+
matrix:
17+
platform: [x86, x64, ARM, ARM64]
18+
configuration: [Debug, Release]
19+
runs-on: windows-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Install build dependencies
26+
run: powershell.exe -File ${{ github.workspace }}\setup.ps1
27+
shell: cmd
28+
29+
- name: Add msbuild to PATH
30+
uses: microsoft/setup-msbuild@v2
31+
32+
- name: Build
33+
run: |
34+
msbuild ${{ github.workspace }}\lxmonika.sln ^
35+
/p:Platform=${{ matrix.platform }} ^
36+
/p:Configuration=${{ matrix.configuration }}
37+
shell: cmd
38+
39+
- name: Pack build artifacts
40+
run: |
41+
powershell.exe -File ${{ github.workspace }}\pack.ps1 ^
42+
-Platform ${{ matrix.platform }} ^
43+
-Configuration ${{ matrix.configuration }}
44+
shell: cmd
45+
46+
- name: Upload artifacts
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: monika_${{ matrix.platform }}_${{ matrix.configuration }}
50+
path: out

pack.ps1

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
param(
2+
[Parameter(Mandatory=$true)]
3+
[string]$Platform,
4+
[Parameter(Mandatory=$true)]
5+
[string]$Configuration
6+
)
7+
8+
$outDir = (Join-Path $PSScriptRoot "out")
9+
10+
Remove-Item -Recurse -Path $outDir
11+
mkdir $outDir | Out-Null
12+
13+
function Get-LxMonikaArtifact(
14+
[string]$Project,
15+
[string]$File
16+
)
17+
{
18+
return Join-Path "$PSScriptRoot\$Project\bin\$Configuration\$Platform" $File
19+
}
20+
21+
# monika.exe
22+
23+
Copy-Item `
24+
-Path (Get-LxMonikaArtifact "monika" "monika.exe") `
25+
-Destination $outDir
26+
27+
# lxmonika
28+
29+
$usefulExts = @(".sys", ".lib", ".cer")
30+
31+
foreach ($ext in $usefulExts)
32+
{
33+
Copy-Item `
34+
-Path (Get-LxMonikaArtifact "lxmonika" "lxmonika$ext") `
35+
-Destination $outDir
36+
}
37+
38+
# lxstub
39+
40+
foreach ($ext in $usefulExts)
41+
{
42+
Copy-Item `
43+
-Path (Get-LxMonikaArtifact "lxstub" "LXCORE$ext") `
44+
-Destination $outDir
45+
}
46+
47+
# PDBs
48+
49+
$pdbDir = (Join-Path $outDir "pdb")
50+
mkdir $pdbDir | Out-Null
51+
52+
Copy-Item `
53+
-Path (Get-LxMonikaArtifact "monika" "monika.pdb") `
54+
-Destination $pdbDir
55+
56+
Copy-Item `
57+
-Path (Get-LxMonikaArtifact "lxmonika" "lxmonika.pdb") `
58+
-Destination $pdbDir
59+
60+
Copy-Item `
61+
-Path (Get-LxMonikaArtifact "lxstub" "LXCORE.pdb") `
62+
-Destination $pdbDir
63+

setup.ps1

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Setup WDK and corresponding SDK
2+
3+
curl.exe `
4+
-SL https://download.microsoft.com/download/C/D/8/CD8533F8-5324-4D30-824C-B834C5AD51F9/standalonesdk/sdksetup.exe `
5+
-o sdksetup_14393.exe
6+
Start-Process .\sdksetup_14393.exe -Wait -ArgumentList '/ceip off /features + /q'
7+
Remove-Item sdksetup_14393.exe
8+
9+
curl.exe `
10+
-SL https://download.microsoft.com/download/8/1/6/816FE939-15C7-4185-9767-42ED05524A95/wdk/wdksetup.exe `
11+
-o wdksetup_14393.exe
12+
Start-Process .\wdksetup_14393.exe -Wait -ArgumentList '/ceip off /features + /q'
13+
Remove-Item wdksetup_14393.exe
14+
15+
curl.exe `
16+
-SL https://download.microsoft.com/download/5/A/0/5A08CEF4-3EC9-494A-9578-AB687E716C12/windowssdk/winsdksetup.exe `
17+
-o sdksetup_17134.exe
18+
Start-Process .\sdksetup_17134.exe -Wait -ArgumentList '/ceip off /features + /q'
19+
Remove-Item sdksetup_17134.exe
20+
21+
curl.exe `
22+
-SL https://download.microsoft.com/download/B/5/8/B58D625D-17D6-47A8-B3D3-668670B6D1EB/wdk/wdksetup.exe `
23+
-o wdksetup_17134.exe
24+
Start-Process .\wdksetup_17134.exe -Wait -ArgumentList '/ceip off /features + /q'
25+
Remove-Item wdksetup_17134.exe
26+
27+
# Hacks to enable ARM32 builds
28+
29+
$vsPath = (vswhere -property installationPath | Out-String).Trim();
30+
31+
$arm64Path = (Join-Path $vsPath "\MSBuild\Microsoft\VC\v170\Platforms\ARM64");
32+
$armPath = (Join-Path $vsPath "\MSBuild\Microsoft\VC\v170\Platforms\ARM")
33+
34+
if (Test-Path $arm64Path)
35+
{
36+
Push-Location $arm64Path
37+
foreach ($file in (Get-ChildItem -Recurse $arm64Path -File))
38+
{
39+
$relativePath = Resolve-Path -Path $file.FullName -Relative
40+
$armFilePath = Join-Path $armPath $relativePath
41+
if (Test-Path (Join-Path $armPath $relativePath))
42+
{
43+
continue;
44+
}
45+
Copy-Item -Path $file.FullName -Destination $armFilePath -Force -Verbose
46+
}
47+
Pop-Location
48+
}

0 commit comments

Comments
 (0)