ci: run sqlx client directly #20
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: Cross-Platform CI | |
| on: | |
| push: | |
| branches: [ chore/windows-cancel-test ] | |
| jobs: | |
| test: | |
| name: Run sleep example | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| # os: [ubuntu-latest, windows-latest, macos-latest] | |
| os: [windows-latest] | |
| include: | |
| # - os: ubuntu-latest | |
| # platform: Linux | |
| - os: windows-latest | |
| platform: Windows | |
| # - os: macos-latest | |
| # platform: macOS | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: stable | |
| # - name: Run sleep example on ${{ matrix.platform }} | |
| # run: cargo run --example sleep | |
| # timeout-minutes: 10 | |
| - name: build background server | |
| run: cargo build --example server | |
| - name: Start server in background | |
| shell: powershell | |
| run: | | |
| Start-Process -FilePath "./target/debug/examples/server" -RedirectStandardOutput "server.log" -RedirectStandardError "server-error.log" -NoNewWindow | |
| # Check every second for 30 seconds | |
| for ($i = 1; $i -le 30; $i++) { | |
| Start-Sleep -Seconds 1 | |
| # Check if process exists | |
| $serverProcess = Get-Process | Where-Object {$_.ProcessName -like "*server*"} | |
| if (-not $serverProcess) { | |
| Write-Host "ERROR: Server process not found after $i seconds!" | |
| Write-Host "=== Server logs ===" | |
| Get-Content "server.log" -ErrorAction SilentlyContinue | |
| Get-Content "server-error.log" -ErrorAction SilentlyContinue | |
| exit 1 | |
| } | |
| } | |
| cargo run --example sqlx | |
| - name: show logs | |
| if: always() | |
| shell: powershell | |
| run: | | |
| if (Test-Path "server.log") { | |
| Write-Host "=== Server Output ===" | |
| Get-Content "server.log" | |
| } | |
| if (Test-Path "server-error.log") { | |
| Write-Host "=== Server Errors ===" | |
| Get-Content "server-error.log" | |
| } |