👷 Add kernel build step to CI #208
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: Build and Test | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: self-hosted | |
outputs: | |
testkernels: ${{ steps.testkernels_output.outputs.testkernels }} | |
env: | |
USER_KIT_PATH: 'C:\CosmosRun\' | |
BochsPath: 'C:\Program Files (x86)\Bochs-2.6.8\Bochs.exe' | |
steps: | |
- name: Checkout Cosmos | |
uses: actions/checkout@v3 | |
with: | |
repository: CosmosOS/Cosmos | |
path: Cosmos | |
- name: Checkout Common | |
uses: actions/checkout@v3 | |
with: | |
repository: CosmosOS/Common | |
path: Common | |
- name: Checkout IL2CPU | |
uses: actions/checkout@v3 | |
with: | |
repository: CosmosOS/IL2CPU | |
path: IL2CPU | |
- name: Checkout XSharp | |
uses: actions/checkout@v3 | |
with: | |
repository: CosmosOS/XSharp | |
path: XSharp | |
- name: Setup MSBuild | |
uses: microsoft/[email protected] | |
- name: Nuget - Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget | |
- name: Nuget - Restore | |
run: | | |
msbuild Cosmos\Build.sln /t:Restore /maxcpucount /verbosity:normal /p:Net48=True | |
- name: Build - Cosmos | |
run: | | |
msbuild Cosmos\Build.sln /t:Build /maxcpucount /verbosity:normal /p:Net48=True | |
- name: Build - IL2CPU | |
run: | | |
dotnet publish IL2CPU\source\IL2CPU -o "$($env:USER_KIT_PATH)Build\IL2CPU\" | |
- name: Copy Output - Cosmos | |
run: | | |
xcopy /Y "Cosmos\source\Cosmos.Build.Tasks\tools\grub2\boot\grub\i386-pc\*.*" "$($env:USER_KIT_PATH)Build\ISO\boot\grub\i386-pc\" | |
xcopy /Y "Cosmos\Build\grub2\boot\grub\grub.cfg" "$($env:USER_KIT_PATH)Build\ISO\boot\grub" | |
xcopy /Y /S "Cosmos\Build\VMware\*" "$($env:USER_KIT_PATH)Build\VMware\" | |
xcopy /Y /S "Cosmos\Build\Tools" "$($env:USER_KIT_PATH)Build\Tools\" | |
- name: Copy Output - IL2CPU | |
run: | | |
xcopy /Y "IL2CPU\source\Cosmos.Core.DebugStub\*.xs" "$($env:USER_KIT_PATH)XSharp\DebugStub\" | |
# - name: Send test kernels to GITHUB_OUTPUT | |
# id: testkernels_output | |
# run: | | |
# $testList = dotnet test Cosmos\Tests\Cosmos.TestRunner.UnitTest\Cosmos.TestRunner.UnitTest.csproj --list-tests | |
# Write-Host $testList | |
# $testList >> tests.txt | |
# $match = Select-String -Pattern "^.*TestKernel\((.*)\)$" -Path tests.txt | |
# Write-Host $match | |
# $testKernels = $match.matches.groups | where { $_.index % 2 -ne 0 } | Select-Object value | foreach { $_.value } | |
# Write-Host $testKernels | |
# $testKernelsEnv = "" | |
# $testKernels | foreach { $testKernelsEnv += "$($_)," } | |
# $testKernelsEnv = $testKernelsEnv.Trim(",") | |
# Write-Host $testKernelsEnv | |
# "testkernels=[$($testKernelsEnv)]" >> $env:GITHUB_OUTPUT | |
test: | |
if: ${{ success() }} | |
needs: [build] | |
runs-on: self-hosted | |
strategy: | |
matrix: | |
kernel: [ | |
"BoxingTests.Kernel", | |
"Cosmos.Compiler.Tests.TypeSystem.Kernel", | |
"Cosmos.Compiler.Tests.Bcl.Kernel", | |
"Cosmos.Compiler.Tests.Bcl.System.Kernel", | |
"Cosmos.Compiler.Tests.Exceptions.Kernel", | |
"Cosmos.Compiler.Tests.MethodTests.Kernel", | |
"Cosmos.Compiler.Tests.SingleEchoTest.Kernel", | |
"Cosmos.Kernel.Tests.Fat.Kernel", | |
"Cosmos.Kernel.Tests.IO.Kernel", | |
"SimpleStructsAndArraysTest.Kernel", | |
"Cosmos.Kernel.Tests.DiskManager.Kernel", | |
"GraphicTest.Kernel", | |
"NetworkTest.Kernel", | |
"AudioTests.Kernel", | |
"MemoryOperationsTest.Kernel", | |
"ProcessorTests.Kernel" | |
] | |
env: | |
USER_KIT_PATH: 'C:\CosmosRun\' | |
BochsPath: 'C:\Program Files (x86)\Bochs-2.6.8\Bochs.exe' | |
steps: | |
- name: Checkout Cosmos | |
uses: actions/checkout@v3 | |
with: | |
repository: CosmosOS/Cosmos | |
path: Cosmos | |
- name: Checkout Common | |
uses: actions/checkout@v3 | |
with: | |
repository: CosmosOS/Common | |
path: Common | |
- name: Checkout IL2CPU | |
uses: actions/checkout@v3 | |
with: | |
repository: CosmosOS/IL2CPU | |
path: IL2CPU | |
- name: Checkout XSharp | |
uses: actions/checkout@v3 | |
with: | |
repository: CosmosOS/XSharp | |
path: XSharp | |
- name: Copy Bochs | |
run: | | |
xcopy /Y /S "Cosmos\Resources\Bochs\*.*" "${env:ProgramFiles(x86)}\Bochs-2.6.8\" | |
- name: Build the Project | |
run: | | |
dotnet build "Cosmos\Tests\Cosmos.TestRunner.UnitTest\Cosmos.TestRunner.UnitTest.csproj" --logger "trx;LogFileName=$($env:USER_KIT_PATH)TestResults\${{ matrix.kernel }}-TestResult.trx" --filter "FullyQualifiedName~${{ matrix.kernel }}" | |
- name: Test - Cosmos | |
env: | |
CI: "True" | |
run: | | |
dotnet test "Cosmos\Tests\Cosmos.TestRunner.UnitTest\Cosmos.TestRunner.UnitTest.csproj" --logger "trx;LogFileName=$($env:USER_KIT_PATH)TestResults\${{ matrix.kernel }}-TestResult.trx" --filter "FullyQualifiedName~${{ matrix.kernel }}" | |
- name: Upload Test Logs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-logs | |
path: ${{ env.USER_KIT_PATH }}TestResults |