Skip to content

Add initial project structure with CMake configuration, Clang format … #8

Add initial project structure with CMake configuration, Clang format …

Add initial project structure with CMake configuration, Clang format … #8

Workflow file for this run

name: Deno Integration Tests
on:
push:
branches: [ main, master ]
pull_request:
jobs:
deno-tests:
name: Deno integration tests (deno ${{ matrix.deno }})
runs-on: windows-latest
strategy:
matrix:
deno: ["2.6.0", "2.5.0"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install virtual COM port driver (com0com)
shell: pwsh
run: |
choco install com0com --yes --no-progress
- name: Create virtual COM pair and start echo
shell: pwsh
run: |
if (-not $env:ChocolateyInstall) { $env:ChocolateyInstall = "C:\ProgramData\chocolatey" }
$pkgRoot = Join-Path $env:ChocolateyInstall "lib\com0com"
if (-not (Test-Path $pkgRoot)) { throw "com0com package root not found at $pkgRoot" }
# Avoid searching huge directories (Program Files). Only look inside the Chocolatey package folder.
$setupcItem = Get-ChildItem -Recurse -File -Filter setupc.exe -ErrorAction Stop $pkgRoot | Select-Object -First 1
if (-not $setupcItem) { throw "setupc.exe not found under $pkgRoot" }
$infItem = Get-ChildItem -Recurse -File -Filter com0com.inf -ErrorAction Stop $pkgRoot | Select-Object -First 1
if (-not $infItem) { throw "com0com.inf not found under $pkgRoot" }
# Create COM5<->COM6
Push-Location $infItem.DirectoryName
& $setupcItem.FullName install PortName=COM5 PortName=COM6 | Out-Host
Pop-Location
# Start an echo loop on COM6 in the background
$echoScript = @'
Add-Type -AssemblyName System.IO.Ports
$sp = New-Object System.IO.Ports.SerialPort "COM6", 115200, "None", 8, "One"
$sp.ReadTimeout = 500
$sp.WriteTimeout = 500
$sp.Open()
try {
while ($true) {
try {
$b = $sp.ReadByte()
if ($b -ge 0) { $sp.BaseStream.WriteByte([byte]$b); $sp.BaseStream.Flush() }
} catch [System.TimeoutException] {
continue
}
}
} finally {
$sp.Close()
}
'@
Set-Content -Path echo.ps1 -Value $echoScript -Encoding utf8
Start-Process pwsh -ArgumentList "-NoProfile","-ExecutionPolicy","Bypass","-File","echo.ps1" -WindowStyle Hidden
Start-Sleep -Seconds 2
- name: Setup CMake >= 3.30
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: "3.31.x"
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: ${{ matrix.deno }}
- name: Configure CMake (Release)
run: |
cmake -S . -B build -G "Visual Studio 17 2022" -A x64
- name: Build (Release)
run: |
cmake --build build --config Release
- name: Run Deno integration tests
working-directory: integration_tests
env:
SERIAL_TEST_PORT: COM5
run: |
deno task test