Skip to content

Commit 57116ee

Browse files
committed
move gui tests to github action
1 parent 378ab08 commit 57116ee

File tree

7 files changed

+310
-29
lines changed

7 files changed

+310
-29
lines changed

.drone.star renamed to .drone.example.star

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,16 @@ config = {
9191
},
9292
}
9393

94-
def main(ctx):
95-
pipelines = check_starlark() + \
96-
lint_gui_test() + \
97-
changelog(ctx)
98-
gui_tests = gui_test_pipeline(ctx)
99-
100-
return pipelines + \
101-
gui_tests + \
102-
pipelinesDependsOn(notification(), gui_tests)
94+
# def main(ctx):
95+
# pipelines = check_starlark() + \
96+
# lint_gui_test() + \
97+
# changelog(ctx)
98+
# gui_tests = gui_test_pipeline(ctx)
99+
#
100+
# # return pipelines + \
101+
# # gui_tests + \
102+
# # pipelinesDependsOn(notification(), gui_tests)
103+
# return []
103104

104105
def from_secret(name):
105106
return {
@@ -116,14 +117,14 @@ def check_starlark():
116117
"name": "format-check-starlark",
117118
"image": OC_CI_BAZEL_BUILDIFIER,
118119
"commands": [
119-
"buildifier --mode=check .drone.star",
120+
"buildifier --mode=check .drone.example.star",
120121
],
121122
},
122123
{
123124
"name": "show-diff",
124125
"image": OC_CI_BAZEL_BUILDIFIER,
125126
"commands": [
126-
"buildifier --mode=fix .drone.star",
127+
"buildifier --mode=fix .drone.example.star",
127128
"git diff",
128129
],
129130
"when": {

.github/entrypoint.sh

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#!/bin/bash
2+
3+
export SQUISH_INSTALL_DIR=${HOME}/squish
4+
echo "$SQUISH_INSTALL_DIR"
5+
6+
. "${STARTUPDIR}"/common.sh
7+
8+
export USER=headless
9+
10+
function wait_for_vnc() {
11+
check_vnc="vncserver -list | grep ${DISPLAY} | awk '{print \$1}'"
12+
echo "[INFO] Waiting for vnc server..."
13+
# wait until dbus file is available
14+
while [[ ! -f $DBUS_ENV_FILE ]]; do
15+
sleep 5
16+
done
17+
# wait until vnserver has started
18+
while [[ $(eval $check_vnc) != "$DISPLAY" ]]; do
19+
sleep 5
20+
done
21+
}
22+
23+
function wait_for_keyring() {
24+
timeout=30
25+
starttime=$SECONDS
26+
unlock_cmd="gnome-keyring-daemon -r --unlock"
27+
check_cmd="busctl --user get-property org.freedesktop.secrets /org/freedesktop/secrets/collection/login org.freedesktop.Secret.Collection Locked"
28+
echo "[INFO] Locked:" $($check_cmd)
29+
# wait for keyring to unlock
30+
while [[ $($check_cmd) != *"false" ]]; do
31+
if ((SECONDS - starttime >= timeout)); then
32+
echo "[ERROR] Timeout waiting for keyring. Exiting..."
33+
exit 1
34+
fi
35+
echo "[INFO] Waiting for keyring to unlock..."
36+
37+
set -e
38+
# try to unlock keyring again
39+
echo -n "${VNC_PW}" | $unlock_cmd
40+
sleep 1
41+
set +e
42+
done
43+
echo "[INFO] Keyring is ready and unlocked"
44+
}
45+
46+
"${STARTUPDIR}"/vnc_startup.sh &
47+
48+
# install squish
49+
if ! install_squish;then
50+
exit 1
51+
fi
52+
53+
mkdir -p "${HOME}"/.squish/ver1/
54+
if [ -z "${SERVER_INI}" ]; then
55+
echo "[SQUISH] SERVER_INI is not set. Tests might fail due to AUT misconfiguration."
56+
fi
57+
if [ -f "${SERVER_INI}" ]; then
58+
cp "${SERVER_INI}" "${HOME}"/.squish/ver1/server.ini
59+
else
60+
echo "[SQUISH] File ${SERVER_INI} not found. Tests might fail due to AUT misconfiguration."
61+
fi
62+
63+
# Set allowed core dump size to an unlimited value, needed for backtracing
64+
ulimit -c unlimited
65+
66+
# Turn off the Squish crash handler by setting this environment variable
67+
export SQUISH_NO_CRASHHANDLER=1
68+
69+
wait_for_vnc
70+
71+
# set DBUS_SESSION_BUS_ADDRESS for squishrunner terminal session
72+
if [ -f "$DBUS_ENV_FILE" ]; then
73+
source $DBUS_ENV_FILE
74+
else
75+
timeout=10 # seconds
76+
echo "[ERROR] 'DBUS_SESSION_BUS_ADDRESS' not set. Waiting for $timeout seconds..."
77+
sleep $timeout
78+
if [ -f "$DBUS_ENV_FILE" ]; then
79+
echo "[TIMEOUT] 'DBUS_SESSION_BUS_ADDRESS' still not set after $timeout seconds. Exiting..."
80+
exit 1
81+
fi
82+
source $DBUS_ENV_FILE
83+
fi
84+
85+
# after dbus session is set, wait for keyring to unlock
86+
wait_for_keyring
87+
88+
runtime="30 minute"
89+
endtime=$(date -ud "$runtime" +%s)
90+
91+
# start squishserver
92+
(${HOME}/squish/bin/squishserver >>"${GUI_TEST_REPORT_DIR}"/serverlog.log 2>&1) &
93+
94+
# squishrunner waits itself for a license to become available, but fails with error 37 if it cannot connect to the license server
95+
LICENSE_ERROR_RESULT_CODE=37
96+
result=0
97+
cat /etc/hosts
98+
echo "[SQUISH] Starting tests..."
99+
while true; do
100+
if [[ $(date -u +%s) -gt $endtime ]]; then
101+
echo "[SQUISH] Timeout waiting for license server"
102+
exit 1
103+
fi
104+
105+
${HOME}/squish/bin/squishrunner ${SQUISH_PARAMETERS} --reportgen stdout --exitCodeOnFail 1
106+
result=$?
107+
if [[ $result -eq $LICENSE_ERROR_RESULT_CODE ]]; then
108+
echo "[SQUISH] Waiting for license server"
109+
sleep $((1 + $RANDOM % 30))
110+
else
111+
exit $result
112+
fi
113+
done

.github/workflows/gui-tests.yml

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
name: GUI Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [ master ]
7+
tags: [ "*" ]
8+
9+
env:
10+
DEFAULT_PHP_VERSION: "7.4"
11+
MYSQL: "mysql:8.0"
12+
OC_CI_ALPINE: "owncloudci/alpine:latest"
13+
OC_CI_CLIENT: "owncloudci/client:latest"
14+
OC_CI_DRONE_SKIP_PIPELINE: "owncloudci/drone-skip-pipeline"
15+
# OC_CI_NODEJS: "owncloudci/nodejs:18"
16+
OC_CI_PHP: "owncloudci/php:%s"
17+
OC_CI_WAIT_FOR: "owncloudci/wait-for:latest"
18+
# OC_OCIS: "owncloud/ocis-rolling:%s"
19+
OC_UBUNTU: "owncloud/ubuntu:20.04"
20+
# OC_CI_SQUISH: "owncloudci/squish:fedora-42-8.1.0-qt68x-linux64"
21+
PLUGINS_GIT_ACTION: "plugins/git-action:1"
22+
PLUGINS_S3: "plugins/s3:1.4.0"
23+
TOOLHIPPIE_CALENS: "toolhippie/calens:0.4.0"
24+
# npm packages to install
25+
NPM_GHERLINT: "@gherlint/gherlint@1.1.0"
26+
S3_PUBLIC_CACHE_SERVER: "https://cache.owncloud.com"
27+
S3_PUBLIC_CACHE_BUCKET: "public"
28+
29+
jobs:
30+
lint-gui-test:
31+
runs-on: ubuntu-latest
32+
container:
33+
# image: owncloudci/squish:fedora-42-8.1.0-qt68x-linux64
34+
image: prajwolamatya11/squish_fedora:latest
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
39+
- name: Setup NodeJs
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: 18
43+
44+
- name: Python lint
45+
run: |
46+
export PATH=$PATH:/github/home/.local/bin
47+
make -C test/gui install
48+
make -C test/gui python-lint
49+
50+
- name: Gherkin lint
51+
run: |
52+
npm install -g ${{ env.NPM_GHERLINT }}
53+
make -C test/gui gherkin-lint
54+
55+
gui-tests:
56+
runs-on: ubuntu-latest
57+
container:
58+
# image: owncloudci/squish:fedora-42-8.1.0-qt68x-linux64
59+
image: prajwolamatya11/squish_fedora:latest
60+
env:
61+
OCIS_URL: https://ocis:9200
62+
IDM_ADMIN_PASSWORD: admin
63+
STORAGE_HOME_DRIVER: ocis
64+
STORAGE_USERS_DRIVER: ocis
65+
OCIS_INSECURE: true
66+
PROXY_ENABLE_BASIC_AUTH: true
67+
OCIS_LOG_LEVEL: error
68+
OCIS_LOG_PRETTY: true
69+
OCIS_LOG_COLOR: true
70+
services:
71+
ocis:
72+
image: owncloud/ocis-rolling:latest
73+
ports:
74+
- 9200:9200
75+
env:
76+
OCIS_LOG_LEVEL: "debug"
77+
OCIS_LOG_PRETTY: "true"
78+
OCIS_LOG_COLOR: "true"
79+
OCIS_INSECURE: "true"
80+
PROXY_ENABLE_BASIC_AUTH: "true"
81+
IDM_CREATE_DEMO_USERS: "true"
82+
OCIS_ADMIN_USER_ID: "some-admin-user-id-0000-000000000000"
83+
IDM_ADMIN_PASSWORD: "admin"
84+
OCIS_SYSTEM_USER_ID: "some-system-user-id-000-000000000000"
85+
OCIS_SYSTEM_USER_API_KEY: "some-system-user-machine-auth-api-key"
86+
OCIS_JWT_SECRET: "some-ocis-jwt-secret"
87+
OCIS_MACHINE_AUTH_API_KEY: "some-ocis-machine-auth-api-key"
88+
OCIS_TRANSFER_SECRET: "some-ocis-transfer-secret"
89+
COLLABORATION_WOPIAPP_SECRET: "some-wopi-secret"
90+
IDM_SVC_PASSWORD: "some-ldap-idm-password"
91+
GRAPH_LDAP_BIND_PASSWORD: "some-ldap-idm-password"
92+
IDM_REVASVC_PASSWORD: "some-ldap-reva-password"
93+
GROUPS_LDAP_BIND_PASSWORD: "some-ldap-reva-password"
94+
USERS_LDAP_BIND_PASSWORD: "some-ldap-reva-password"
95+
AUTH_BASIC_LDAP_BIND_PASSWORD: "some-ldap-reva-password"
96+
IDM_IDPSVC_PASSWORD: "some-ldap-idp-password"
97+
IDP_LDAP_BIND_PASSWORD: "some-ldap-idp-password"
98+
GATEWAY_STORAGE_USERS_MOUNT_ID: "storage-users-1"
99+
STORAGE_USERS_MOUNT_ID: "storage-users-1"
100+
GRAPH_APPLICATION_ID: "application-1"
101+
OCIS_SERVICE_ACCOUNT_ID: "service-account-id"
102+
OCIS_SERVICE_ACCOUNT_SECRET: "service-account-secret"
103+
# options: >-
104+
# --health-cmd "curl -kfsSL https://localhost:9200/metrics || exit 1"
105+
# --health-interval 10s
106+
# --health-timeout 5s
107+
# --health-retries 15
108+
109+
steps:
110+
- name: Checkout
111+
uses: actions/checkout@v4
112+
113+
- name: Build client
114+
run: |
115+
mkdir -p build
116+
cd build
117+
cmake -G"Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DBUILD_TESTING=OFF -S ..
118+
ninja
119+
120+
- name: Install Python Modules
121+
env:
122+
PLAYWRIGHT_BROWSERS_PATH: .playwright
123+
run: |
124+
export PATH=$PATH:/github/home/.local/bin
125+
make -C test/gui install
126+
python3.10 -m pip list -v
127+
128+
- name: Create GUI test report directory
129+
run: |
130+
mkdir test/gui/guiReportUpload/screenshots -p
131+
chmod 777 test/gui -R
132+
133+
# - name: Wait for oCIS service
134+
# run: |
135+
# docker run --rm --network host ${{ env.OC_CI_WAIT_FOR }} https://ocis:9200 -t 300
136+
# echo "Waiting for oCIS at https://ocis:9200..."
137+
# for i in {1..30}; do
138+
# if curl -kfsSL https://ocis:9200 > /dev/null; then
139+
# echo "oCIS is up ✅"
140+
# exit 0
141+
# fi
142+
# echo "Retrying in 5s..."
143+
# sleep 5
144+
# done
145+
# echo "❌ oCIS did not start in time" && exit 1
146+
147+
- name: Run GUI test
148+
env:
149+
LICENSEKEY: ${{ secrets.SQUISH_LICENSEKEY }}
150+
GUI_TEST_REPORT_DIR: test/gui/guiReportUpload
151+
CLIENT_REPO: .
152+
BACKEND_HOST: https://ocis:9200
153+
SECURE_BACKEND_HOST: https://ocis:9200
154+
OCIS: true
155+
SERVER_INI: test/gui/drone/server.ini
156+
SQUISH_PARAMETERS: "--testsuite test/gui --reportgen html,test/gui/guiReportUpload --envvar QT_LOGGING_RULES=sync.httplogger=true;gui.socketapi=false --tags ~@skip --tags ~@skipOnLinux"
157+
STACKTRACE_FILE: test/gui/guiReportUpload/stacktrace.log
158+
PLAYWRIGHT_BROWSERS_PATH: .playwright
159+
OWNCLOUD_CORE_DUMP: 1
160+
RECORD_VIDEO_ON_FAILURE: false
161+
# allow to use any available pnpm version
162+
COREPACK_ENABLE_STRICT: 0
163+
HOME: /home/headless
164+
run: |
165+
echo "HOME: $HOME"
166+
echo "Current Working Directory: $(pwd)"
167+
bash .github/entrypoint.sh

.github/workflows/main.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name: ownCloud CI
22

3-
on:
4-
push:
5-
branches:
6-
- master
7-
- '[0-9]+'
8-
pull_request:
9-
workflow_dispatch:
10-
11-
concurrency:
3+
#on:
4+
# push:
5+
# branches:
6+
# - master
7+
# - '[0-9]+'
8+
# pull_request:
9+
# workflow_dispatch:
10+
11+
concurrency:
1212
group: ${{ github.head_ref || github.run_id }}
1313
cancel-in-progress: true
1414

.github/workflows/stale.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: "Close stale issues"
2-
on:
3-
schedule:
4-
- cron: "0 0 * * *"
5-
workflow_dispatch:
2+
#on:
3+
# schedule:
4+
# - cron: "0 0 * * *"
5+
# workflow_dispatch:
66

77
permissions: {}
88

.github/workflows/translate.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: "Update translations"
22

3-
on:
4-
workflow_dispatch:
5-
#schedule:
6-
# - cron: "0 3 * * *"
3+
#on:
4+
# workflow_dispatch:
5+
# #schedule:
6+
# # - cron: "0 3 * * *"
77

88
permissions: {}
99

test/gui/shared/scripts/helpers/SetupClientHelper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def start_client():
9595
check_keyring()
9696

9797
squish.startApplication(
98-
f'{get_config("client_name").lower()} -s'
98+
f'build/bin/{get_config("client_name").lower()} -s'
9999
+ f' --logfile {get_config("clientLogFile")}'
100100
+ ' --logdebug'
101101
+ ' --logflush'

0 commit comments

Comments
 (0)