Skip to content

Commit 85cb122

Browse files
committed
ci: add electron tests on pull request
1 parent db14913 commit 85cb122

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

.github/workflows/test-on-pr.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,64 @@ jobs:
6161
echo "Windows tests failed, marking step as failed"
6262
exit 1
6363
shell: cmd
64+
65+
test-electron:
66+
strategy:
67+
fail-fast: false
68+
matrix:
69+
platform: [macos-15, ubuntu-22.04, windows-latest]
70+
71+
runs-on: ${{ matrix.platform }}
72+
timeout-minutes: 60
73+
steps:
74+
- uses: actions/checkout@v4
75+
- name: setup node
76+
uses: actions/setup-node@v4
77+
with:
78+
node-version: 18
79+
- name: install dependencies (ubuntu only)
80+
if: matrix.platform == 'ubuntu-22.04'
81+
run: |
82+
sudo apt-get update
83+
sudo apt-get install -y xvfb
84+
- name: install frontend dependencies
85+
run: |
86+
npm install
87+
echo "npm run build not executed as we will be running tests against the checked in release artifacts only!"
88+
npm run _copy-dist-to-test
89+
- name: Run electron integration tests in ubuntu
90+
if: matrix.platform == 'ubuntu-22.04'
91+
run: |
92+
npm run _serve-tauri &
93+
sleep 2
94+
xvfb-run ./src-electron/node_modules/.bin/electron src-electron/main.js --quit-when-done
95+
96+
- name: Run electron integration tests in macos
97+
if: matrix.platform == 'macos-15'
98+
run: |
99+
npm run _serve-tauri &
100+
sleep 2
101+
./src-electron/node_modules/.bin/electron src-electron/main.js --quit-when-done
102+
103+
- name: Run electron integration tests in windows
104+
if: matrix.platform == 'windows-latest'
105+
id: windowsElectronRun
106+
run: |
107+
Start-Process -NoNewWindow -FilePath "npm" -ArgumentList "run", "_serve-tauri"
108+
Start-Sleep -Seconds 2
109+
& ".\src-electron\node_modules\.bin\electron.cmd" "src-electron\main.js" "--quit-when-done" 2>&1 | Tee-Object -FilePath electron-output.txt
110+
shell: pwsh
111+
continue-on-error: true
112+
113+
- name: Print windows electron test output to console
114+
if: matrix.platform == 'windows-latest'
115+
run: |
116+
type electron-output.txt
117+
shell: cmd
118+
119+
- name: Fail on electron test runs failed in windows
120+
if: matrix.platform == 'windows-latest' && steps.windowsElectronRun.outcome == 'failure'
121+
run: |
122+
echo "Windows Electron tests failed, marking step as failed"
123+
exit 1
124+
shell: cmd

0 commit comments

Comments
 (0)