Add initial project structure with CMake configuration, Clang format … #7
This file contains hidden or 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: 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: | | |
| $roots = @( | |
| "C:\ProgramData\chocolatey\lib", | |
| "${env:ProgramFiles}", | |
| "${env:ProgramFiles(x86)}" | |
| ) | Where-Object { $_ -and (Test-Path $_) } | |
| $setupcItem = Get-ChildItem -Recurse -File -Filter setupc.exe -ErrorAction SilentlyContinue $roots | Select-Object -First 1 | |
| if (-not $setupcItem) { throw "setupc.exe not found after com0com install (searched: $($roots -join ', '))" } | |
| $infItem = Get-ChildItem -Recurse -File -Filter com0com.inf -ErrorAction SilentlyContinue $roots | Select-Object -First 1 | |
| if (-not $infItem) { throw "com0com.inf not found after com0com install (searched: $($roots -join ', '))" } | |
| # 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 | |