Skip to content

Commit 1cf3cd1

Browse files
committed
chore: allow to run desktop regressions from an url
1 parent 32449e4 commit 1cf3cd1

File tree

2 files changed

+60
-120
lines changed

2 files changed

+60
-120
lines changed

.github/workflows/desktop-regression.yml

Lines changed: 55 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,11 @@ name: Run desktop regression tests
22
on:
33
workflow_dispatch:
44
inputs:
5-
PLAYWRIGHT_REPO:
6-
description: 'Playwright repo to checkout'
7-
required: true
8-
type: choice
9-
options:
10-
- session-foundation/session-playwright
11-
- burtonemily/session-playwright
12-
- bilb/session-playwright
13-
default: session-foundation/session-playwright
14-
15-
BRANCH_TO_CHECKOUT_PW:
16-
description: 'branch to checkout on session-playwright'
5+
DESKTOP_JOB_URL:
6+
description: 'The url of the session-desktop job'
177
required: true
188
type: string
19-
default: regression-tests-groups
20-
21-
SESSION_DESKTOP_REPO:
22-
description: 'Session desktop repo to checkout'
23-
required: true
24-
type: choice
25-
options:
26-
- session-foundation/session-desktop
27-
- bilb/session-desktop
28-
- yougotwill/session-desktop
29-
default: session-foundation/session-desktop
30-
31-
BRANCH_TO_CHECKOUT_SESSION:
32-
description: 'Branch to checkout on session-desktop'
33-
required: true
34-
type: string
35-
default: dev
9+
default: https://github.com/session-foundation/session-desktop/actions/runs/17312227704
3610

3711
PLAYWRIGHT_REPEAT_COUNT:
3812
description: 'Repeats of each tests (0 to only run each once)'
@@ -59,116 +33,94 @@ concurrency:
5933
jobs:
6034
desktop-regression:
6135
name: Desktop Regression Tests
62-
runs-on: [self-hosted, Linux, X64, qa-desktop]
63-
container:
64-
image: mcr.microsoft.com/playwright:v1.51.0-noble
65-
options: --cpus 16
36+
runs-on: [self-hosted, qa-android]
6637

6738
env:
39+
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
6840
PLAYWRIGHT_REPEAT_COUNT: ${{ github.event.inputs.PLAYWRIGHT_REPEAT_COUNT }}
6941
PLAYWRIGHT_RETRIES_COUNT: ${{ github.event.inputs.PLAYWRIGHT_RETRIES_COUNT }}
7042
PLAYWRIGHT_WORKERS_COUNT: ${{ github.event.inputs.PLAYWRIGHT_WORKERS_COUNT }}
71-
DESKTOP_CACHED_FOLDER: desktop/node_modules
43+
DESKTOP_JOB_URL: ${{ github.event.inputs.DESKTOP_JOB_URL }}
44+
ARTIFACT_NAME: 'Linux-X64-deb-qa-production'
45+
CI: true
7246

7347
steps:
7448
- uses: actions/checkout@v4
49+
with:
50+
lfs: true
51+
7552
- name: Runner Details
7653
run: |
77-
echo "PLAYWRIGHT_REPO ${{ github.event.inputs.PLAYWRIGHT_REPO }}"
78-
echo "BRANCH_TO_CHECKOUT_PW ${{ github.event.inputs.BRANCH_TO_CHECKOUT_PW }}"
79-
echo "SESSION_DESKTOP_REPO ${{ github.event.inputs.SESSION_DESKTOP_REPO }}"
80-
echo "BRANCH_TO_CHECKOUT_SESSION ${{ github.event.inputs.BRANCH_TO_CHECKOUT_SESSION }}"
54+
echo "DESKTOP_JOB_URL ${{ github.event.inputs.DESKTOP_JOB_URL }}"
55+
echo "PLAYWRIGHT_REPEAT_COUNT ${{ github.event.inputs.PLAYWRIGHT_REPEAT_COUNT }}"
56+
echo "PLAYWRIGHT_RETRIES_COUNT ${{ github.event.inputs.PLAYWRIGHT_RETRIES_COUNT }}"
57+
echo "PLAYWRIGHT_WORKERS_COUNT ${{ github.event.inputs.PLAYWRIGHT_WORKERS_COUNT }}"
8158
82-
- uses: actions/checkout@v4
83-
name: 'Checkout playwright'
84-
with:
85-
repository: ${{ github.event.inputs.PLAYWRIGHT_REPO }}
86-
ref: ${{ github.event.inputs.BRANCH_TO_CHECKOUT_PW }}
87-
path: 'playwright'
59+
- name: 'Download prebuilt session-desktop'
60+
run: |
61+
RUN_ID=$(echo "$DESKTOP_JOB_URL" | sed -E 's|.*/runs/([0-9]+).*|\1|')
62+
echo "Run ID: $RUN_ID"
8863
89-
- name: Install system deps
90-
run: apt update && apt install -y git g++ build-essential cmake
9164
92-
- uses: actions/checkout@v4
93-
name: 'Checkout Session desktop'
94-
with:
95-
repository: ${{ github.event.inputs.SESSION_DESKTOP_REPO }}
96-
ref: ${{ github.event.inputs.BRANCH_TO_CHECKOUT_SESSION }}
97-
path: 'desktop'
65+
response=$(curl -s -H "Authorization: Bearer $PAT_TOKEN" \
66+
-H "Accept: application/vnd.github+json" \
67+
"https://api.github.com/repos/session-foundation/session-desktop/actions/runs/$RUN_ID/artifacts")
68+
echo "response: $response"
9869
99-
# Note: caching is breaking things up (app doesn't start)
100-
# - name: Calculate desktop cache key
101-
# run: |
102-
# echo "CACHE_KEY=${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('desktop/package.json', 'desktop/yarn.lock', 'desktop/patches/**') }}" >> $GITHUB_ENV
10370
104-
- name: Install node
105-
uses: actions/setup-node@v3
106-
with:
107-
node-version-file: 'desktop/.nvmrc'
71+
artifact_url=$(echo "$response" | jq -r \
72+
--arg name "$ARTIFACT_NAME" \
73+
'.artifacts[] | select(.name == $name) | .archive_download_url')
10874
109-
- uses: actions/setup-python@v4
110-
with:
111-
python-version: '3.12'
11275
113-
- name: Install setuptools for python 3.12
114-
shell: bash
115-
run: python -m pip install --upgrade pip setuptools
11676
117-
# Note: caching is breaking things up (app doesn't start)
118-
# - uses: actions/cache/restore@v4
119-
# id: cache-desktop-modules
120-
# with:
121-
# path: ${{ env.DESKTOP_CACHED_FOLDER }}
122-
# key: ${{ env.CACHE_KEY }}
77+
echo "Session desktop Artifact URL: $artifact_url"
12378
124-
- name: Install yarn
125-
run: |
126-
npm install -g yarn
79+
curl -L \
80+
-H "Authorization: token $PAT_TOKEN" \
81+
-H "Accept: application/vnd.github+json" \
82+
-o artifact.zip \
83+
$artifact_url
12784
128-
- name: List desktop folder
129-
run: |
130-
pwd
131-
ls -la desktop
85+
unzip artifact.zip
13286
133-
- name: List playwright folder
87+
- name: 'print files'
13488
run: |
135-
pwd
136-
ls -la playwright
89+
ls -l
13790
138-
- name: Install desktop dependencies
139-
shell: bash
140-
# if: steps.cache-desktop-modules.outputs.cache-hit != 'true'
141-
run: cd $GITHUB_WORKSPACE/desktop && yarn install --frozen-lockfile --network-timeout 600000
91+
- name: 'Extract deb package'
92+
run: |
93+
dpkg-deb -x *.deb extracted-deb
94+
ls ./extracted-deb
95+
ls -l ./extracted-deb/opt/Session/session-desktop
14296
143-
# Note: caching is breaking things up (app doesn't start)
144-
# - uses: actions/cache/save@v4
145-
# if: always()
146-
# with:
147-
# path: ${{ env.DESKTOP_CACHED_FOLDER }}
148-
# key: ${{ env.CACHE_KEY }}
97+
- name: Install node
98+
uses: actions/setup-node@v4
99+
with:
100+
node-version-file: '.nvmrc'
149101

150-
- name: Build desktop
151-
shell: bash
152-
run: cd $GITHUB_WORKSPACE/desktop && yarn build-everything
102+
- name: Install yarn
103+
run: |
104+
npm install -g yarn
153105
154-
- name: Install playwright dependencies
106+
- name: Install dependencies
155107
run: |
156-
cd $GITHUB_WORKSPACE/playwright && yarn install --frozen-lockfile
108+
yarn install --frozen-lockfile
157109
158110
- name: Build the Desktop tests
159111
run: |
160-
cd $GITHUB_WORKSPACE/playwright
161-
yarn tsc
112+
cd $GITHUB_WORKSPACE
113+
yarn tsc
162114
163115
- name: Run the Desktop tests
164116
run: |
165-
cd $GITHUB_WORKSPACE/playwright
166-
SESSION_DESKTOP_ROOT=$GITHUB_WORKSPACE/desktop nice ionice xvfb-run --auto-servernum --server-num=1 --server-args='-screen 0, 1920x1080x24' yarn test
167-
# DEBUG="pw:*"
117+
PRINT_ONGOING_TEST_LOGS= nice ionice xvfb-run --auto-servernum --server-num=1 --server-args='-screen 0, 1920x1080x24' yarn test
118+
# DEBUG="pw:*"
119+
#
168120

169121
- name: Kill all running electron app
170122
if: always()
171-
continue-on-error: true # just so we don't fail
123+
continue-on-error: true
172124
shell: bash
173125
run: |
174126
killall electron;

tests/automation/setup/open.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
11
import { _electron as electron } from '@playwright/test';
22

33
import chalk from 'chalk';
4-
import { isEmpty } from 'lodash';
5-
import { join } from 'path';
64
import { v4 } from 'uuid';
75

86
export const NODE_ENV = 'production';
97
export const MULTI_PREFIX = 'test-integration-';
108
const multisAvailable = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
119

12-
export function getAppRootPath() {
13-
if (isEmpty(process.env.SESSION_DESKTOP_ROOT)) {
14-
throw new Error(
15-
"You need to set the 'config.SESSION_DESKTOP_ROOT' in your .env file",
16-
);
17-
}
18-
return process.env.SESSION_DESKTOP_ROOT as string;
19-
}
20-
2110
const openElectronAppOnly = async (multi: string) => {
2211
process.env.MULTI = `${multi}`;
2312
// using a v4 uuid, as timestamps to the ms are sometimes the same (when a bunch of workers are started)
@@ -26,19 +15,18 @@ const openElectronAppOnly = async (multi: string) => {
2615
process.env.NODE_ENV = NODE_ENV;
2716
process.env.SESSION_DEBUG = '1';
2817
process.env.LOCAL_DEVNET_SEED_URL = 'http://sesh-net.local:1280';
18+
const sessionBinPath = './extracted-deb/opt/Session/session-desktop';
2919

3020
console.info(` NON CI RUN`);
3121
console.info(' NODE_ENV', process.env.NODE_ENV);
3222
console.info(' NODE_APP_INSTANCE', process.env.NODE_APP_INSTANCE);
3323

3424
try {
35-
const electronApp = await electron.launch({
36-
args: [
37-
join(getAppRootPath(), 'ts', 'mains', 'main_node.js'),
38-
'--disable-gpu',
39-
],
25+
return await electron.launch({
26+
executablePath: sessionBinPath,
27+
args: ['--no-sandbox', '--disable-gpu'],
4028
});
41-
return electronApp;
29+
4230
} catch (e) {
4331
console.info(
4432
chalk.redBright(

0 commit comments

Comments
 (0)