Skip to content

Commit e588f97

Browse files
committed
Add test workflow
1 parent aba169e commit e588f97

1 file changed

Lines changed: 111 additions & 0 deletions

File tree

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: ElectronNET Integration Tests
2+
3+
on:
4+
push:
5+
branches: [ develop, main ]
6+
pull_request:
7+
branches: [ develop, main ]
8+
9+
permissions:
10+
contents: read
11+
checks: write
12+
actions: read
13+
statuses: write
14+
# needed for publish-unit-test-result-action
15+
16+
concurrency:
17+
group: integration-tests-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
tests:
22+
name: Integration Tests (${{ matrix.os }})
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
include:
28+
- os: ubuntu-latest
29+
rid: linux-x64
30+
- os: windows-latest
31+
rid: win-x64
32+
33+
env:
34+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
35+
DOTNET_NOLOGO: 1
36+
CI: true
37+
ELECTRON_ENABLE_LOGGING: 1
38+
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
43+
- name: Setup .NET
44+
uses: actions/setup-dotnet@v4
45+
with:
46+
dotnet-version: '10.0.x'
47+
include-prerelease: false
48+
49+
- name: Setup Node.js
50+
uses: actions/setup-node@v4
51+
with:
52+
node-version: '22'
53+
cache: 'npm'
54+
55+
- name: Restore
56+
run: dotnet restore -r ${{ matrix.rid }} src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj
57+
58+
- name: Build
59+
run: dotnet build --no-restore -c Release -r ${{ matrix.rid }} src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj
60+
61+
- name: Install Linux GUI dependencies
62+
if: runner.os == 'Linux'
63+
run: |
64+
sudo apt-get update
65+
sudo apt-get install -y xvfb \
66+
libgtk-3-0 libnss3 libgdk-pixbuf2.0-0 libdrm2 libgbm1 libasound2 libxss1 libxtst6 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libx11-xcb1
67+
68+
- name: Run tests (Linux)
69+
if: runner.os == 'Linux'
70+
run: |
71+
mkdir -p test-results
72+
xvfb-run -a dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj \
73+
-c Release --no-build -r ${{ matrix.rid }} \
74+
--logger "trx;LogFileName=TestResults.trx" \
75+
--results-directory test-results
76+
77+
- name: Run tests (Windows)
78+
if: runner.os == 'Windows'
79+
run: |
80+
mkdir test-results
81+
dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj \
82+
-c Release --no-build -r ${{ matrix.rid }} \
83+
--logger "trx;LogFileName=TestResults.trx" \
84+
--results-directory test-results
85+
86+
- name: Upload raw test results
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: test-results-${{ matrix.os }}
90+
path: test-results/*.trx
91+
retention-days: 7
92+
93+
- name: Publish Test Results (Checks UI)
94+
uses: EnricoMi/publish-unit-test-result-action@v2
95+
if: always()
96+
with:
97+
files: test-results/*.trx
98+
check_name: ElectronNET Integration Tests (${{ matrix.os }})
99+
comment_mode: off
100+
101+
- name: Fail if tests failed
102+
if: steps.Publish_Test_Results.outcome == 'failure'
103+
run: exit 1
104+
105+
summary:
106+
name: Aggregate
107+
runs-on: ubuntu-latest
108+
needs: [tests]
109+
steps:
110+
- name: Summary
111+
run: echo "All matrix test jobs completed."

0 commit comments

Comments
 (0)