Skip to content

Commit 766837b

Browse files
committed
chore: add basic CI with workflow dispatch
1 parent d5be3e5 commit 766837b

File tree

2 files changed

+152
-12
lines changed

2 files changed

+152
-12
lines changed

.github/workflows/desktop-regression.yml

Lines changed: 141 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Run android regression tests
1+
name: Run desktop regression tests
22
on:
33
workflow_dispatch:
44
inputs:
@@ -12,10 +12,150 @@ on:
1212
- bilb/session-playwright
1313
default: oxen-io/session-playwright
1414

15+
BRANCH_TO_CHECKOUT_PW:
16+
description: 'branch to checkout on session-playwright'
17+
required: true
18+
type: string
19+
default: ci-desktop-regression-self-hosted
20+
21+
SESSION_DESKTOP_REPO:
22+
description: 'Session desktop repo to checkout'
23+
required: true
24+
type: choice
25+
options:
26+
- oxen-io/session-desktop
27+
- bilb/session-desktop
28+
- yougotwill/session-desktop
29+
default: oxen-io/session-desktop
30+
31+
BRANCH_TO_CHECKOUT_SESSION:
32+
description: 'Branch to checkout on session-desktop'
33+
required: true
34+
type: string
35+
default: unstable
36+
37+
PLAYWRIGHT_REPEAT_COUNT:
38+
description: 'Repeats of each tests (0 to only run each once)'
39+
required: true
40+
type: number
41+
default: 0
42+
43+
PLAYWRIGHT_RETRIES_COUNT:
44+
description: 'Retries of each tests (0 to only run each once, 1 to run another attempt)'
45+
required: true
46+
type: number
47+
default: 0
48+
49+
PLAYWRIGHT_WORKER_COUNT:
50+
description: 'Playwright workers to start'
51+
required: true
52+
type: number
53+
default: 4
54+
55+
concurrency:
56+
group: ${{ github.workflow }}
57+
cancel-in-progress: true
58+
1559
jobs:
1660
desktop-regression:
1761
name: Desktop Regression Tests
1862
runs-on: [self-hosted, linux, x64, qa-desktop]
63+
container:
64+
image: mcr.microsoft.com/playwright:v1.47.1-noble
65+
options: --cpus 8
66+
67+
env:
68+
SESSION_DESKTOP_ROOT: '$GITHUB_WORKSPACE/desktop'
69+
# PLAYWRIGHT_CUSTOM_REPORTER: 1
70+
PLAYWRIGHT_REPEAT_COUNT: ${{ github.event.inputs.PLAYWRIGHT_REPEAT_COUNT }}
71+
PLAYWRIGHT_RETRIES_COUNT: ${{ github.event.inputs.PLAYWRIGHT_RETRIES_COUNT }}
72+
PLAYWRIGHT_WORKER_COUNT: ${{ github.event.inputs.PLAYWRIGHT_WORKER_COUNT }}
1973

2074
steps:
2175
- uses: actions/checkout@v4
76+
- name: Runner Details
77+
run: |
78+
echo "SESSION_DESKTOP_ROOT ${{ env.SESSION_DESKTOP_ROOT }}"
79+
echo "PLAYWRIGHT_REPO ${{ github.event.inputs.PLAYWRIGHT_REPO }}"
80+
echo "BRANCH_TO_CHECKOUT_PW ${{ github.event.inputs.BRANCH_TO_CHECKOUT_PW }}"
81+
echo "SESSION_DESKTOP_REPO ${{ github.event.inputs.SESSION_DESKTOP_REPO }}"
82+
echo "BRANCH_TO_CHECKOUT_SESSION ${{ github.event.inputs.BRANCH_TO_CHECKOUT_SESSION }}"
83+
84+
- uses: actions/checkout@v4
85+
name: 'Checkout playwright'
86+
with:
87+
repository: ${{ github.event.inputs.PLAYWRIGHT_REPO }}
88+
ref: ${{ github.event.inputs.BRANCH_TO_CHECKOUT_PW }}
89+
path: 'playwright'
90+
91+
- name: Install system deps
92+
run: apt update && apt install -y git g++ build-essential cmake
93+
94+
- uses: actions/checkout@v4
95+
name: 'Checkout Session desktop'
96+
with:
97+
repository: ${{ github.event.inputs.SESSION_DESKTOP_REPO }}
98+
ref: ${{ github.event.inputs.BRANCH_TO_CHECKOUT_SESSION }}
99+
path: 'desktop'
100+
101+
- name: Install node
102+
uses: actions/setup-node@v3
103+
with:
104+
node-version-file: 'desktop/.nvmrc'
105+
106+
- uses: actions/setup-python@v4
107+
with:
108+
python-version: '3.11'
109+
110+
- uses: actions/cache/restore@v4
111+
id: cache-desktop-modules
112+
113+
- name: Install yarn
114+
run: |
115+
npm install -g yarn
116+
117+
- name: List desktop folder
118+
run: |
119+
pwd
120+
ls -la desktop
121+
122+
- name: List playwright folder
123+
run: |
124+
pwd
125+
ls -la playwright
126+
127+
- name: Install desktop dependencies
128+
shell: bash
129+
if: steps.cache-desktop-modules.outputs.cache-hit != 'true'
130+
run: cd $GITHUB_WORKSPACE/desktop && yarn install --frozen-lockfile --network-timeout 600000
131+
132+
- uses: actions/cache/save@v4
133+
if: always()
134+
with:
135+
path: node_modules
136+
key: ${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package.json', 'yarn.lock', 'patches/**') }}
137+
138+
- name: Build desktop
139+
shell: bash
140+
run: cd $GITHUB_WORKSPACE/desktop && yarn build-everything
141+
142+
- name: Install playwright dependencies
143+
run: |
144+
cd $GITHUB_WORKSPACE/playwright && yarn install --frozen-lockfile
145+
146+
- name: Build the Desktop tests
147+
run: |
148+
cd $GITHUB_WORKSPACE/playwright
149+
yarn tsc
150+
151+
- name: Run the Android tests
152+
run: |
153+
cd $GITHUB_WORKSPACE/playwright
154+
yarn test -g "Create User"
155+
156+
- name: Kill all running electron app
157+
if: always()
158+
continue-on-error: true # just so we don't fail
159+
shell: bash
160+
run: |
161+
killall electron;

tests/automation/setup/open.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,20 @@ const openElectronAppOnly = async (multi: string) => {
5656
process.env.NODE_APP_INSTANCE = `${MULTI_PREFIX}-devprod-${uniqueId}-${process.env.MULTI}`;
5757
process.env.NODE_ENV = NODE_ENV;
5858

59-
if (!isEmpty(process.env.CI)) {
60-
const sessionBinPath = getSessionDesktopBinPath();
61-
const fakeHome = `/tmp/${process.env.NODE_APP_INSTANCE}`;
59+
// if (!isEmpty(process.env.CI)) {
60+
// const sessionBinPath = getSessionDesktopBinPath();
61+
// const fakeHome = `/tmp/${process.env.NODE_APP_INSTANCE}`;
6262

63-
console.info(` CI RUN`);
64-
console.info(` SESSION_BIN_PATH=${sessionBinPath}`);
65-
console.info(` HOME="${fakeHome}"`);
63+
// console.info(` CI RUN`);
64+
// console.info(` SESSION_BIN_PATH=${sessionBinPath}`);
65+
// console.info(` HOME="${fakeHome}"`);
6666

67-
process.env.HOME = fakeHome;
67+
// process.env.HOME = fakeHome;
6868

69-
return electron.launch({
70-
executablePath: sessionBinPath,
71-
});
72-
}
69+
// return electron.launch({
70+
// executablePath: sessionBinPath,
71+
// });
72+
// }
7373
console.info(` NON CI RUN`);
7474
console.info(' NODE_ENV', process.env.NODE_ENV);
7575
console.info(' NODE_APP_INSTANCE', process.env.NODE_APP_INSTANCE);

0 commit comments

Comments
 (0)