Skip to content

Commit 94e793a

Browse files
committed
move gui tests to github action
1 parent b0d2607 commit 94e793a

File tree

6 files changed

+274
-28
lines changed

6 files changed

+274
-28
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: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
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+
services:
61+
ocis:
62+
image: owncloud/ocis-rolling:latest
63+
env:
64+
OCIS_URL: https://ocis:9200
65+
IDM_ADMIN_PASSWORD: admin
66+
STORAGE_HOME_DRIVER: ocis
67+
STORAGE_USERS_DRIVER: ocis
68+
OCIS_INSECURE: true
69+
PROXY_ENABLE_BASIC_AUTH: true
70+
OCIS_LOG_LEVEL: error
71+
OCIS_LOG_PRETTY: true
72+
OCIS_LOG_COLOR: true
73+
ports:
74+
- 9200:9200
75+
steps:
76+
- name: Checkout
77+
uses: actions/checkout@v4
78+
79+
- name: Build client
80+
run: |
81+
mkdir -p build
82+
cd build
83+
cmake -G"Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DBUILD_TESTING=OFF -S ..
84+
ninja
85+
86+
- name: Install Python Modules
87+
env:
88+
PLAYWRIGHT_BROWSERS_PATH: .playwright
89+
run: |
90+
export PATH=$PATH:/github/home/.local/bin
91+
make -C test/gui install
92+
python3.10 -m pip list -v
93+
94+
- name: Create GUI test report directory
95+
run: |
96+
mkdir test/gui/guiReportUpload/screenshots -p
97+
chmod 777 test/gui -R
98+
99+
- name: Wait for OCIS to be ready
100+
run: |
101+
echo "Waiting for OCIS..."
102+
for i in {1..30}; do
103+
curl -sk https://ocis:9200/ || true
104+
if curl -sk https://ocis:9200/ | grep -q "ownCloud"; then
105+
echo "OCIS is up!"
106+
break
107+
fi
108+
sleep 3
109+
done
110+
111+
- name: Run GUI test
112+
env:
113+
LICENSEKEY: ${{ secrets.SQUISH_LICENSEKEY }}
114+
GUI_TEST_REPORT_DIR: test/gui/guiReportUpload
115+
CLIENT_REPO: .
116+
BACKEND_HOST: https://ocis:9200
117+
SECURE_BACKEND_HOST: https://ocis:9200
118+
OCIS: true
119+
SERVER_INI: test/gui/drone/server.ini
120+
SQUISH_PARAMETERS: "--testsuite test/gui --reportgen html,test/gui/guiReportUpload --envvar QT_LOGGING_RULES=sync.httplogger=true;gui.socketapi=false --tags ~@skip --tags ~@skipOnLinux"
121+
STACKTRACE_FILE: test/gui/guiReportUpload/stacktrace.log
122+
PLAYWRIGHT_BROWSERS_PATH: .playwright
123+
OWNCLOUD_CORE_DUMP: 1
124+
RECORD_VIDEO_ON_FAILURE: false
125+
# allow to use any available pnpm version
126+
COREPACK_ENABLE_STRICT: 0
127+
HOME: /home/headless
128+
run: |
129+
curl -kv https://ocis:9200
130+
echo "HOME: $HOME"
131+
echo "Current Working Directory: $(pwd)"
132+
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

0 commit comments

Comments
 (0)