Skip to content

Diag: isolate Taskly backend in console host #19

Diag: isolate Taskly backend in console host

Diag: isolate Taskly backend in console host #19

Workflow file for this run

name: Rivet Windows Experiment
on:
push:
branches: [experiment/taskly-rivet]
paths:
- 'apps/windows/**'
- 'racket/**'
- 'rivet.rktd'
- '.github/workflows/rivet-windows.yml'
pull_request:
paths:
- 'apps/windows/**'
- 'racket/**'
- 'rivet.rktd'
- '.github/workflows/rivet-windows.yml'
permissions:
contents: read
concurrency:
group: rivet-windows-${{ github.ref }}
cancel-in-progress: true
env:
RIVET_COMMIT: fe01374f1219277e88a33801e8f3cef914e3e79f
jobs:
windows:
name: WinUI Native + embedded Rivet
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Build native fallback mode
shell: pwsh
run: dotnet build apps/windows/Taskly/Taskly.csproj -c Release -p:Platform=x64
- name: Set up Racket CS
uses: Bogdanp/setup-racket@v1.15
with:
architecture: x64
distribution: full
variant: CS
version: '9.3'
- name: Install pinned Rivet
shell: pwsh
run: |
$rivet = Join-Path $env:RUNNER_TEMP 'rivet'
git clone https://github.com/turinglambdaai/rivet.git $rivet
git -C $rivet checkout $env:RIVET_COMMIT
raco pkg install --auto --no-docs --name rivet --link $rivet
"RIVET_ROOT=$rivet" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build Taskly embedded Racket bundle
shell: pwsh
run: raco rivet build-dotnet
- name: Run Taskly backend in plain .NET console host
shell: pwsh
run: |
$stage = Join-Path $env:GITHUB_WORKSPACE '.rivet\dotnet\windows-x64'
$smoke = Join-Path $env:RUNNER_TEMP 'taskly-embedded-console'
New-Item -ItemType Directory -Force -Path $smoke | Out-Null
$project = @"
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$env:RIVET_ROOT\platform\dotnet\Rivet.Runtime\Rivet.Runtime.csproj" />
<Compile Include="$env:GITHUB_WORKSPACE\dotnet\GeneratedBackend.cs" Link="GeneratedBackend.cs" />
</ItemGroup>
</Project>
"@
Set-Content -Path (Join-Path $smoke 'Smoke.csproj') -Value $project -Encoding utf8
$program = @'
using Rivet.Runtime;
using Taskly.RivetGenerated;
var stage = args[0];
var db = Path.Combine(Path.GetTempPath(), $"taskly-console-{Guid.NewGuid():N}.db");
Console.WriteLine("console:client-start");
await using var client = await EmbeddedRivetClient.StartAsync(new EmbeddedRivetOptions(stage));
Console.WriteLine("console:client-ready");
var api = new RivetAPI(client);
Console.WriteLine("console:open-start");
var snapshot = await api.OpenDatabaseAsync(db);
Console.WriteLine($"console:open-done:lists={snapshot.Lists.Count}:tasks={snapshot.Tasks.Count}");
await api.CloseDatabaseAsync();
Console.WriteLine("console:close-done");
try { File.Delete(db); } catch { }
'@
Set-Content -Path (Join-Path $smoke 'Program.cs') -Value $program -Encoding utf8
# The bridge and libracketcs are staged at the bundle root. Ensure the
# normal Windows loader can resolve the same native files as Taskly.
$env:PATH = "$stage;$env:PATH"
dotnet run --project (Join-Path $smoke 'Smoke.csproj') -c Release -- $stage
- name: Build WinUI Rivet mode
shell: pwsh
run: |
dotnet clean apps/windows/Taskly/Taskly.csproj -c Release -p:Platform=x64
dotnet build apps/windows/Taskly/Taskly.csproj `
-c Release `
-p:Platform=x64 `
-p:UseRivetBackend=true `
-p:RivetRoot="$env:RIVET_ROOT"
- name: Verify embedded runtime layout
shell: pwsh
run: |
$exe = Get-ChildItem 'apps/windows/Taskly/bin' -Recurse -Filter 'Taskly.exe' |
Sort-Object LastWriteTime -Descending |
Select-Object -First 1
if ($null -eq $exe) { throw 'Taskly.exe was not produced' }
$out = $exe.Directory.FullName
if (-not (Test-Path (Join-Path $out 'rivet_native.dll'))) {
throw 'rivet_native.dll is missing beside Taskly.exe'
}
$racket = Get-ChildItem $out -Filter '*racketcs*.dll' | Select-Object -First 1
if ($null -eq $racket) { throw 'Racket CS runtime DLL is missing beside Taskly.exe' }
if (-not (Test-Path (Join-Path $out 'rivet/res/core.zo'))) {
throw 'compiled Taskly Racket backend is missing from output'
}
foreach ($boot in @('petite.boot', 'scheme.boot', 'racket.boot')) {
if (-not (Test-Path (Join-Path $out "rivet/runtime/$boot"))) {
throw "$boot is missing from Taskly output"
}
}
"TASKLY_RIVET_EXE=$($exe.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Host "Embedded Taskly output: $out"
- name: Run Taskly embedded runtime smoke
shell: pwsh
run: |
$log = Join-Path $env:RUNNER_TEMP 'taskly-rivet-smoke.log'
Remove-Item $log -ErrorAction SilentlyContinue
$env:TASKLY_RIVET_SMOKE_LOG = $log
$process = Start-Process `
-FilePath $env:TASKLY_RIVET_EXE `
-ArgumentList '__rivet-smoke' `
-Wait `
-PassThru
Write-Host '--- Taskly embedded smoke phases ---'
if (Test-Path $log) {
Get-Content $log
} else {
Write-Host '(no phase log was produced)'
}
Write-Host '--- end smoke phases ---'
if ($process.ExitCode -ne 0) {
$hex = [BitConverter]::ToUInt32([BitConverter]::GetBytes([int]$process.ExitCode), 0)
throw ('Taskly embedded Rivet smoke failed with exit code {0} (0x{1:X8})' -f `
$process.ExitCode, $hex)
}
Write-Host 'Taskly embedded Rivet smoke completed successfully.'