1+ name : ElectronNET Integration Tests
2+
3+ on :
4+ push :
5+ branches : [ develop, main ]
6+ pull_request :
7+ branches : [ develop, main ]
8+
9+ concurrency :
10+ group : integration-tests-${{ github.ref }}
11+ cancel-in-progress : true
12+
13+ jobs :
14+ tests :
15+ name : Integration Tests (${{ matrix.os }})
16+ runs-on : ${{ matrix.os }}
17+ strategy :
18+ fail-fast : false
19+ matrix :
20+ include :
21+ - os : ubuntu-latest
22+ rid : linux-x64
23+ - os : windows-latest
24+ rid : win-x64
25+
26+ env :
27+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE : 1
28+ DOTNET_NOLOGO : 1
29+ CI : true
30+ ELECTRON_ENABLE_LOGGING : 1
31+
32+ steps :
33+ - name : Checkout
34+ uses : actions/checkout@v4
35+
36+ - name : Setup .NET
37+ uses : actions/setup-dotnet@v4
38+ with :
39+ dotnet-version : ' 10.0.x'
40+ include-prerelease : false
41+
42+ - name : Setup Node.js
43+ uses : actions/setup-node@v4
44+ with :
45+ node-version : ' 22'
46+
47+ - name : Restore
48+ run : dotnet restore -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj
49+
50+ - name : Build
51+ run : dotnet build --no-restore -c Release -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj
52+
53+ - name : Install Linux GUI dependencies
54+ if : runner.os == 'Linux'
55+ run : |
56+ set -e
57+ sudo apt-get update
58+ # Core Electron dependencies
59+ sudo apt-get install -y xvfb \
60+ libgtk-3-0 libnss3 libgdk-pixbuf-2.0-0 libdrm2 libgbm1 libxss1 libxtst6 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libx11-xcb1 || true
61+ # Handle Ubuntu 24.04 time64 transition for ALSA
62+ if ! dpkg -s libasound2 >/dev/null 2>&1; then
63+ sudo apt-get install -y libasound2t64
64+ fi
65+
66+ - name : Run tests (Linux)
67+ if : runner.os == 'Linux'
68+ continue-on-error : true
69+ run : |
70+ mkdir -p test-results
71+ xvfb-run -a dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj \
72+ -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} \
73+ --logger "trx;LogFileName=TestResults.trx" \
74+ --results-directory test-results
75+
76+ - name : Run tests (Windows)
77+ if : runner.os == 'Windows'
78+ continue-on-error : true
79+ run : |
80+ New-Item -ItemType Directory -Force -Path test-results | Out-Null
81+ dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} --logger "trx;LogFileName=TestResults.trx" --results-directory test-results
82+
83+ - name : Upload raw test results
84+ if : always()
85+ uses : actions/upload-artifact@v4
86+ with :
87+ name : test-results-${{ matrix.os }}
88+ path : test-results/*.trx
89+ retention-days : 7
90+
91+ - name : Publish Test Results (Checks UI - Linux)
92+ if : always() && runner.os == 'Linux'
93+ uses : EnricoMi/publish-unit-test-result-action@v2
94+ with :
95+ files : test-results/*.trx
96+ check_name : ElectronNET Integration Tests (${{ matrix.os }})
97+ comment_mode : off
98+
99+ - name : Publish Test Results (Checks UI - Windows)
100+ if : always() && runner.os == 'Windows'
101+ uses : EnricoMi/publish-unit-test-result-action/windows@v2
102+ with :
103+ files : test-results/*.trx
104+ check_name : ElectronNET Integration Tests (${{ matrix.os }})
105+ comment_mode : off
106+
107+ - name : Fail if tests failed (after publishing)
108+ if : always()
109+ shell : pwsh
110+ run : |
111+ if (-not (Test-Path 'test-results')) { Write-Error 'No test-results folder found'; exit 1 }
112+ $failed = 0
113+ Get-ChildItem 'test-results' -Filter *.trx | ForEach-Object {
114+ [xml]$xml = Get-Content $_.FullName
115+ $counters = $xml.TestRun.ResultSummary.Counters
116+ if ($counters) {
117+ $failed += [int]$counters.failed + [int]$counters.error + [int]$counters.timeout
118+ }
119+ }
120+ if ($failed -gt 0) { Write-Error "Tests failed: $failed"; exit 1 } else { Write-Host 'All tests passed' }
121+
122+ summary :
123+ name : Aggregate
124+ runs-on : ubuntu-latest
125+ if : always()
126+ needs : [tests]
127+ steps :
128+ - name : Summary
129+ run : echo "All matrix test jobs completed."
0 commit comments