diff --git a/.drone.star b/.drone.star deleted file mode 100644 index bd32db2b66b..00000000000 --- a/.drone.star +++ /dev/null @@ -1,708 +0,0 @@ -# -# We are building GCC with make and Clang with ninja, the combinations are more -# or less arbitrarily chosen. We just want to check that both compilers and both -# CMake generators work. It's unlikely that a specific generator only breaks -# with a specific compiler. -# - -DEFAULT_PHP_VERSION = "7.4" - -MYSQL = "mysql:8.0" -OC_CI_ALPINE = "owncloudci/alpine:latest" -OC_CI_BAZEL_BUILDIFIER = "owncloudci/bazel-buildifier" -OC_CI_CLIENT = "owncloudci/client:latest" -OC_CI_CORE = "owncloudci/core" -OC_CI_DRONE_SKIP_PIPELINE = "owncloudci/drone-skip-pipeline" -OC_CI_NODEJS = "owncloudci/nodejs:18" -OC_CI_PHP = "owncloudci/php:%s" -OC_CI_WAIT_FOR = "owncloudci/wait-for:latest" -OC_OCIS = "owncloud/ocis-rolling:%s" -OC_UBUNTU = "owncloud/ubuntu:20.04" - -OC_CI_SQUISH = "owncloudci/squish:fedora-42-8.1.0-qt68x-linux64" - -PLUGINS_GIT_ACTION = "plugins/git-action:1" -PLUGINS_S3 = "plugins/s3:1.4.0" -TOOLHIPPIE_CALENS = "toolhippie/calens:0.4.0" - -# npm packages to install -NPM_GHERLINT = "@gherlint/gherlint@1.1.0" - -S3_PUBLIC_CACHE_SERVER = "https://cache.owncloud.com" -S3_PUBLIC_CACHE_BUCKET = "public" - -# secrets used in the pipeline -secrets = { - "SQUISH_LICENSEKEY": "squish_license_server", - "GITHUB_USERNAME": "github_username", - "GITHUB_TOKEN": "github_token", # not available for PRs - "AWS_ACCESS_KEY_ID": "cache_public_s3_access_key", - "AWS_SECRET_ACCESS_KEY": "cache_public_s3_secret_key", -} - -dir = { - "base": "/drone/src", - "server": "/drone/src/server", - "guiTest": "/drone/src/test/gui", - "guiTestReport": "/drone/src/test/gui/guiReportUpload", - "build": "/drone/src/build", - "pythonModules": "/home/headless/squish/python3/lib/python3.10/site-packages", -} - -branch_ref = [ - "refs/heads/master", - "refs/heads/6**", -] - -trigger_ref = branch_ref + [ - "refs/tags/**", - "refs/pull/**", -] - -build_config = { - "c_compiler": "clang", - "cxx_compiler": "clang++", - "build_type": "Debug", - "generator": "Ninja", - "command": "ninja", -} - -pip_pipeline_volume = [ - { - "name": "python-lib", - "temp": {}, - }, -] -pip_step_volume = [ - { - "name": "python-lib", - "path": dir["pythonModules"], - }, -] - -config = { - "gui-tests": { - "servers": { - "oc10": { - "version": "latest", - # comma separated list of tags to be used for filtering. E.g. "@tag1,@tag2" - "tags": "~@skipOnOC10", - "extra_apps": { - "oauth2": { - "enabled": False, - "command": "make dist", - }, - "activity": { - "enabled": True, - "command": "make dist", - }, - }, - "skip_in_pr": True, - "skip": False, - }, - "ocis": { - "version": "latest", - # comma separated list of tags to be used for filtering. E.g. "@tag1,@tag2" - "tags": "~@skipOnOCIS", - "skip": False, - }, - }, - }, -} - -def main(ctx): - pipelines = check_starlark() + \ - lint_gui_test() + \ - changelog(ctx) - gui_tests = gui_test_pipeline(ctx) - - return pipelines + \ - gui_tests + \ - pipelinesDependsOn(notification(), gui_tests) - -def from_secret(name): - return { - "from_secret": secrets[name], - } - -def check_starlark(): - return [{ - "kind": "pipeline", - "type": "docker", - "name": "check-starlark", - "steps": [ - { - "name": "format-check-starlark", - "image": OC_CI_BAZEL_BUILDIFIER, - "commands": [ - "buildifier --mode=check .drone.star", - ], - }, - { - "name": "show-diff", - "image": OC_CI_BAZEL_BUILDIFIER, - "commands": [ - "buildifier --mode=fix .drone.star", - "git diff", - ], - "when": { - "status": [ - "failure", - ], - }, - }, - ], - "trigger": { - "event": [ - "pull_request", - ], - }, - }] - -def gui_test_pipeline(ctx): - pipelines = [] - for server, params in config["gui-tests"]["servers"].items(): - squish_parameters = [ - "--testsuite %s" % dir["guiTest"], - "--reportgen html,%s" % dir["guiTestReport"], - "--envvar QT_LOGGING_RULES=sync.httplogger=true;gui.socketapi=false", - "--tags ~@skip", - "--tags ~@skipOnLinux", - ] - - if not "full-ci" in ctx.build.title.lower() and ctx.build.event == "pull_request": - squish_parameters.append("--abortOnFail") - - if params.get("skip", False): - continue - if ctx.build.event == "pull_request" and params.get("skip_in_pr", False) and not "full-ci" in ctx.build.title.lower(): - continue - - # also skip in commit push - if params.get("skip_in_pr", False) and ctx.build.event == "push": - continue - - pipeline_name = "GUI-tests-%s" % server - - if params["tags"]: - squish_parameters.append("--tags %s" % params["tags"]) - squish_parameters = " ".join(squish_parameters) - - steps = skipIfUnchanged(ctx, "gui-tests") + \ - build_client(OC_CI_SQUISH, False) - - services = [] - - if server == "oc10": - steps += installCore(params["version"]) + \ - setupServerAndApp() + \ - installExtraApps(params["extra_apps"]) + \ - fixPermissions() + \ - owncloudLog() - services += owncloudService() + \ - databaseService() - else: - steps += ocisService(params["version"]) + \ - waitForService("ocis", "ocis:9200") - - steps += install_python_modules() + \ - setGuiTestReportDir() + \ - gui_tests(ctx, squish_parameters, server) + \ - uploadGuiTestLogs(ctx, server) + \ - logGuiReports(ctx, server) - - pipelines.append({ - "kind": "pipeline", - "name": pipeline_name, - "platform": { - "os": "linux", - "arch": "amd64", - }, - "steps": steps, - "services": services, - "trigger": { - "ref": trigger_ref, - }, - "volumes": [ - { - "name": "uploads", - "temp": {}, - }, - ] + pip_pipeline_volume, - }) - return pipelines - -def build_client(image = OC_CI_CLIENT, ctest = True): - cmake_options = '-G"%s" -DCMAKE_BUILD_TYPE="%s"' % (build_config["generator"], build_config["build_type"]) - - if image != OC_CI_SQUISH: - cmake_options += ' -DCMAKE_C_COMPILER="%s" -DCMAKE_CXX_COMPILER="%s"' % (build_config["c_compiler"], build_config["cxx_compiler"]) - - if ctest: - cmake_options += " -DBUILD_TESTING=ON" - else: - cmake_options += " -DBUILD_TESTING=OFF" - - return [ - { - "name": "build-client", - "image": image, - "environment": { - "LC_ALL": "C.UTF-8", - }, - "user": "0:0", - "commands": [ - "mkdir -p %s" % dir["build"], - "cd %s" % dir["build"], - # generate build files - "cmake %s -S .." % cmake_options, - # build - build_config["command"], - ], - }, - ] - -def gui_tests(ctx, squish_parameters = "", server_type = "oc10"): - record_video = False - - # generate video reports on cron build - if ctx.build.event == "cron": - record_video = True - - return [{ - "name": "GUItests", - "image": OC_CI_SQUISH, - "environment": { - "LICENSEKEY": from_secret("SQUISH_LICENSEKEY"), - "GUI_TEST_REPORT_DIR": dir["guiTestReport"], - "CLIENT_REPO": dir["base"], - "BACKEND_HOST": "http://owncloud/" if server_type == "oc10" else "https://ocis:9200", - "SECURE_BACKEND_HOST": "https://owncloud/" if server_type == "oc10" else "https://ocis:9200", - "OCIS": "true" if server_type == "ocis" else "false", - "SERVER_INI": "%s/drone/server.ini" % dir["guiTest"], - "SQUISH_PARAMETERS": squish_parameters, - "STACKTRACE_FILE": "%s/stacktrace.log" % dir["guiTestReport"], - "PLAYWRIGHT_BROWSERS_PATH": "%s/.playwright" % dir["base"], - "OWNCLOUD_CORE_DUMP": 1, - "RECORD_VIDEO_ON_FAILURE": record_video, - # allow to use any available pnpm version - "COREPACK_ENABLE_STRICT": 0, - }, - "volumes": pip_step_volume, - }] - -def lint_gui_test(): - return [{ - "kind": "pipeline", - "type": "docker", - "name": "lint-gui-test", - "steps": python_lint() + gherkin_lint(), - "trigger": { - "event": [ - "pull_request", - ], - }, - }] - -def python_lint(): - return [{ - "name": "python-lint", - "image": OC_CI_SQUISH, - "commands": [ - "make -C %s install" % dir["guiTest"], - "make -C %s python-lint" % dir["guiTest"], - ], - }] - -def gherkin_lint(): - return [{ - "name": "gherkin-lint", - "image": OC_CI_NODEJS, - "commands": [ - "npm install -g %s" % NPM_GHERLINT, - "make -C %s gherkin-lint" % dir["guiTest"], - ], - }] - -def changelog(ctx): - return [{ - "kind": "pipeline", - "type": "docker", - "name": "changelog", - "steps": [ - { - "name": "generate", - "image": TOOLHIPPIE_CALENS, - "commands": [ - "calens >| CHANGELOG.md", - ], - }, - { - "name": "diff", - "image": OC_CI_ALPINE, - "commands": [ - "git diff", - ], - }, - { - "name": "output", - "image": TOOLHIPPIE_CALENS, - "commands": [ - "cat CHANGELOG.md", - ], - }, - { - "name": "publish", - "image": PLUGINS_GIT_ACTION, - "settings": { - "actions": [ - "commit", - "push", - ], - "message": "Automated changelog update [skip ci]", - "branch": "master", - "author_email": "devops@owncloud.com", - "author_name": "ownClouders", - "netrc_machine": "github.com", - "netrc_username": from_secret("GITHUB_USERNAME"), - "netrc_password": from_secret("GITHUB_TOKEN"), - }, - "when": { - "ref": { - "exclude": [ - "refs/pull/**", - "refs/tags/**", - ], - }, - "branch": [ - "master", - ], - }, - }, - ], - "trigger": { - "ref": branch_ref + [ - "refs/pull/**", - ], - "event": { - "exclude": [ - "cron", - ], - }, - }, - }] - -def notification(): - steps = [ - { - "name": "notify-matrix", - "image": OC_CI_ALPINE, - "environment": { - "CACHE_ENDPOINT": S3_PUBLIC_CACHE_SERVER, - "CACHE_BUCKET": S3_PUBLIC_CACHE_BUCKET, - "MATRIX_TOKEN": { - "from_secret": "matrix_token", - }, - }, - "commands": [ - "bash %s/drone/notification_template.sh %s" % (dir["guiTest"], dir["base"]), - ], - }, - ] - - return [{ - "kind": "pipeline", - "name": "notifications", - "platform": { - "os": "linux", - "arch": "amd64", - }, - "steps": steps, - "trigger": { - "event": [ - "cron", - "tag", - ], - "status": [ - "success", - "failure", - ], - }, - }] - -def databaseService(): - return [{ - "name": "mysql", - "image": MYSQL, - "environment": { - "MYSQL_USER": "owncloud", - "MYSQL_PASSWORD": "owncloud", - "MYSQL_DATABASE": "owncloud", - "MYSQL_ROOT_PASSWORD": "owncloud", - }, - "command": ["--default-authentication-plugin=mysql_native_password"], - }] - -def installCore(server_version = "latest"): - return [{ - "name": "install-core", - "image": OC_CI_CORE, - "settings": { - "version": server_version, - "core_path": dir["server"], - "db_type": "mysql", - "db_name": "owncloud", - "db_host": "mysql", - "db_username": "owncloud", - "db_password": "owncloud", - }, - }] - -def setupServerAndApp(logLevel = 2): - return [{ - "name": "setup-owncloud-server", - "image": OC_CI_PHP % DEFAULT_PHP_VERSION, - "commands": [ - "cd %s" % dir["server"], - "php occ a:e testing", - "php occ config:system:set trusted_domains 1 --value=owncloud", - "php occ log:manage --level %s" % logLevel, - "php occ config:list", - "php occ config:system:set skeletondirectory --value=/var/www/owncloud/server/apps/testing/data/tinySkeleton", - "php occ config:system:set sharing.federation.allowHttpFallback --value=true --type=bool", - ], - }] - -def installExtraApps(extra_apps = {}): - commands = [] - for app, param in extra_apps.items(): - commands.append("ls %s/apps/%s || git clone --depth 1 https://github.com/owncloud/%s.git %s/apps/%s" % (dir["server"], app, app, dir["server"], app)) - if (param["command"] != ""): - commands.append("cd %s/apps/%s" % (dir["server"], app)) - commands.append(param["command"]) - if param["enabled"]: - commands.append("cd %s" % dir["server"]) - commands.append("php occ a:e %s" % app) - - return [{ - "name": "install-extra-apps", - "image": OC_CI_PHP % DEFAULT_PHP_VERSION, - "commands": commands, - }] - -def owncloudService(): - return [{ - "name": "owncloud", - "image": OC_CI_PHP % DEFAULT_PHP_VERSION, - "environment": { - "APACHE_WEBROOT": dir["server"], - "APACHE_CONFIG_TEMPLATE": "ssl", - "APACHE_SSL_CERT_CN": "server", - "APACHE_SSL_CERT": "%s/server.crt" % dir["base"], - "APACHE_SSL_KEY": "%s/server.key" % dir["base"], - "APACHE_LOGGING_PATH": "/dev/null", - }, - "commands": [ - "cat /etc/apache2/templates/base >> /etc/apache2/templates/ssl", - "/usr/local/bin/apachectl -e debug -D FOREGROUND", - ], - }] - -def owncloudLog(): - return [{ - "name": "owncloud-log", - "image": OC_UBUNTU, - "detach": True, - "commands": [ - "tail -f %s/data/owncloud.log" % dir["server"], - ], - }] - -def fixPermissions(): - return [{ - "name": "fix-permissions", - "image": OC_CI_PHP % DEFAULT_PHP_VERSION, - "commands": [ - "cd %s" % dir["server"], - "chown www-data * -R", - ], - }] - -def ocisService(server_version = "latest"): - return [{ - "name": "ocis", - "image": OC_OCIS % server_version, - "detach": True, - "environment": { - "OCIS_URL": "https://ocis:9200", - "IDM_ADMIN_PASSWORD": "admin", - "STORAGE_HOME_DRIVER": "ocis", - "STORAGE_USERS_DRIVER": "ocis", - "OCIS_INSECURE": True, - "PROXY_ENABLE_BASIC_AUTH": True, - "OCIS_LOG_LEVEL": "error", - "OCIS_LOG_PRETTY": True, - "OCIS_LOG_COLOR": True, - }, - "commands": [ - "/usr/bin/ocis version || true", - "/usr/bin/ocis init", - "/usr/bin/ocis server", - ], - }] - -def waitForService(name, servers): - if type(servers) == "string": - servers = [servers] - return [{ - "name": "wait-for-%s" % name, - "image": OC_CI_WAIT_FOR, - "commands": [ - "wait-for -it %s -t 300" % ",".join(servers), - ], - }] - -def install_python_modules(): - return [{ - "name": "install-python-modules", - "image": OC_CI_SQUISH, - "environment": { - "PLAYWRIGHT_BROWSERS_PATH": "%s/.playwright" % dir["base"], - }, - "user": "0:0", - "commands": [ - "make -C %s install" % dir["guiTest"], - "python3.10 -m pip list -v", - ], - "volumes": pip_step_volume, - }] - -def setGuiTestReportDir(): - return [{ - "name": "create-gui-test-report-directory", - "image": OC_UBUNTU, - "commands": [ - "mkdir %s/screenshots -p" % dir["guiTestReport"], - "chmod 777 %s -R" % dir["guiTest"], - ], - }] - -def uploadGuiTestLogs(ctx, server_type = "oc10"): - trigger = { - "status": [ - "failure", - ], - "event": [ - "cron", - "tag", - "pull_request", - ], - } - if ctx.build.event == "tag": - trigger["status"].append("success") - - return [{ - "name": "upload-gui-test-result", - "image": PLUGINS_S3, - "settings": { - "bucket": S3_PUBLIC_CACHE_BUCKET, - "endpoint": S3_PUBLIC_CACHE_SERVER, - "path_style": True, - "source": "%s/**/*" % dir["guiTestReport"], - "strip_prefix": "%s" % dir["guiTestReport"], - "target": "/${DRONE_REPO}/${DRONE_BUILD_NUMBER}/%s/guiReportUpload" % server_type, - }, - "environment": { - "AWS_ACCESS_KEY_ID": from_secret("AWS_ACCESS_KEY_ID"), - "AWS_SECRET_ACCESS_KEY": from_secret("AWS_SECRET_ACCESS_KEY"), - }, - "when": trigger, - }] - -def logGuiReports(ctx, server_type): - trigger = { - "status": [ - "failure", - ], - "event": [ - "cron", - "tag", - "pull_request", - ], - } - if ctx.build.event == "tag": - trigger["status"].append("success") - - return [{ - "name": "log-GUI-reports", - "image": OC_UBUNTU, - "commands": [ - "bash %s/drone/log_reports.sh %s ${DRONE_REPO} ${DRONE_BUILD_NUMBER} %s" % (dir["guiTest"], dir["guiTestReport"], server_type), - ], - "when": trigger, - }] - -def skipIfUnchanged(ctx, type): - if ("full-ci" in ctx.build.title.lower()): - return [] - - base = [ - "^.github/.*", - "^.vscode/.*", - "^changelog/.*", - "README.md", - ".gitignore", - "CHANGELOG.md", - "CONTRIBUTING.md", - "COPYING", - "COPYING.documentation", - ] - - skip = [] - if type == "unit-tests": - skip = base + [ - "^test/gui/.*", - ] - - if type == "gui-tests": - skip = base + [ - "^test/([^g]|g[^u]|gu[^i]).*", - ] - - return [{ - "name": "skip-if-unchanged", - "image": OC_CI_DRONE_SKIP_PIPELINE, - "settings": { - "ALLOW_SKIP_CHANGED": skip, - }, - "when": { - "event": [ - "pull_request", - ], - }, - }] - -def stepDependsOn(steps = []): - if type(steps) == dict: - steps = [steps] - return getPipelineNames(steps) - -def getPipelineNames(pipelines = []): - names = [] - for pipeline in pipelines: - names.append(pipeline["name"]) - return names - -def pipelineDependsOn(pipeline, dependant_pipelines): - if "depends_on" in pipeline.keys(): - pipeline["depends_on"] = pipeline["depends_on"] + getPipelineNames(dependant_pipelines) - else: - pipeline["depends_on"] = getPipelineNames(dependant_pipelines) - return pipeline - -def pipelinesDependsOn(pipelines, dependant_pipelines): - pipes = [] - for pipeline in pipelines: - pipes.append(pipelineDependsOn(pipeline, dependant_pipelines)) - - return pipes diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 00000000000..64de2fd49c9 --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,49 @@ +name: Changelog + +on: + pull_request: + push: + branches: [ "6" ] + tags: [ "*" ] + +jobs: + changelog: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: read + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Generate changelog + uses: docker://toolhippie/calens:0.4.0 + with: + entrypoint: /bin/sh + args: -c "calens > CHANGELOG.md" + + - name: Show diff + run: git diff + + - name: Output + run: cat CHANGELOG.md + + - name: Publish + if: > + github.event_name == 'push' && + github.ref == 'refs/heads/master' && + !startsWith(github.ref, 'refs/tags/') && + !startsWith(github.ref, 'refs/pull/') + run: | + git config user.name "ownClouders" + git config user.email "devops@owncloud.com" + git add CHANGELOG.md + if git diff --staged --quiet; then + echo "No changes to commit" + exit 0 + fi + git commit -m "Automated changelog update [skip ci]" + git push origin master diff --git a/.github/workflows/gui-tests.yml b/.github/workflows/gui-tests.yml new file mode 100644 index 00000000000..450524a961a --- /dev/null +++ b/.github/workflows/gui-tests.yml @@ -0,0 +1,179 @@ +name: GUI Tests + +on: + pull_request: + push: + branches: [ "6" ] + tags: [ "*" ] + schedule: + - cron: "0 0 * * *" + +env: + NPM_GHERLINT: "@gherlint/gherlint@1.1.0" + S3_PUBLIC_CACHE_SERVER: "https://cache.owncloud.com" + S3_PUBLIC_CACHE_BUCKET: "public" + +jobs: + lint-gui-test: + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + container: + image: owncloudci/squish:fedora-42-8.1.0-qt68x-linux64 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup NodeJs + uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Python lint + run: | + export PATH=$PATH:/github/home/.local/bin + make -C test/gui install + make -C test/gui python-lint + + - name: Gherkin lint + run: | + npm install -g ${{ env.NPM_GHERLINT }} + make -C test/gui gherkin-lint + + gui-tests: + runs-on: ubuntu-latest + container: + image: owncloudci/squish:fedora-42-8.1.0-qt68x-linux64 + env: + PLAYWRIGHT_BROWSERS_PATH: /__w/client/client/test/gui/.playwright + GITHUB_REPO: ${{ github.repository }} + GITHUB_RUN_NUMBER: ${{ github.run_number }} + services: + ocis: + image: owncloud/ocis-rolling:latest + ports: + - 9200:9200 + env: + OCIS_URL: https://ocis:9200 + OCIS_LOG_LEVEL: "error" + OCIS_LOG_PRETTY: "true" + OCIS_LOG_COLOR: "true" + OCIS_INSECURE: "true" + PROXY_ENABLE_BASIC_AUTH: "true" + OCIS_ADMIN_USER_ID: "some-admin-user-id-0000-000000000000" + IDM_ADMIN_PASSWORD: "admin" + OCIS_SYSTEM_USER_ID: "some-system-user-id-000-000000000000" + OCIS_SYSTEM_USER_API_KEY: "some-system-user-machine-auth-api-key" + OCIS_JWT_SECRET: "some-ocis-jwt-secret" + OCIS_MACHINE_AUTH_API_KEY: "some-ocis-machine-auth-api-key" + OCIS_TRANSFER_SECRET: "some-ocis-transfer-secret" + COLLABORATION_WOPIAPP_SECRET: "some-wopi-secret" + IDM_SVC_PASSWORD: "some-ldap-idm-password" + GRAPH_LDAP_BIND_PASSWORD: "some-ldap-idm-password" + IDM_REVASVC_PASSWORD: "some-ldap-reva-password" + GROUPS_LDAP_BIND_PASSWORD: "some-ldap-reva-password" + USERS_LDAP_BIND_PASSWORD: "some-ldap-reva-password" + AUTH_BASIC_LDAP_BIND_PASSWORD: "some-ldap-reva-password" + IDM_IDPSVC_PASSWORD: "some-ldap-idp-password" + IDP_LDAP_BIND_PASSWORD: "some-ldap-idp-password" + GATEWAY_STORAGE_USERS_MOUNT_ID: "storage-users-1" + STORAGE_USERS_MOUNT_ID: "storage-users-1" + GRAPH_APPLICATION_ID: "application-1" + OCIS_SERVICE_ACCOUNT_ID: "service-account-id" + OCIS_SERVICE_ACCOUNT_SECRET: "service-account-secret" + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Build client + run: | + mkdir -p build + cd build + cmake -G"Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DBUILD_TESTING=OFF -S .. + ninja + + - name: Install Python Modules + run: | + export PATH=$PATH:/github/home/.local/bin + make -C test/gui install + python3.10 -m pip list -v + + - name: Create GUI test report directory + run: | + mkdir test/gui/guiReportUpload/screenshots -p + chmod 777 test/gui -R + + - name: Wait for ocis service + run: | + echo "Waiting for ocis" + # 150s timeout + for i in {1..30}; do + if curl -kfsSL https://ocis:9200 > /dev/null; then + echo "ocis is up ✅" + exit 0 + fi + echo "Retrying in 5s..." + sleep 5 + done + echo "❌ ocis failed to start" && exit 1 + + - name: Run GUI test + id: run_gui_test + env: + LICENSEKEY: ${{ secrets.SQUISH_LICENSEKEY }} + GUI_TEST_REPORT_DIR: /__w/client/client/test/gui/guiReportUpload + CLIENT_REPO: . + OCIS_URL: https://ocis:9200 + BACKEND_HOST: https://ocis:9200 + SECURE_BACKEND_HOST: https://ocis:9200 + OCIS: true + SERVER_INI: test/gui/ci/server.ini + SQUISH_PARAMETERS: > + --testsuite test/gui + --reportgen html,test/gui/guiReportUpload + --envvar QT_LOGGING_RULES=sync.httplogger=true;gui.socketapi=false + --tags ~@skip --tags ~@skipOnLinux --tags ~@skipOnOCIS + ${{ + !contains(github.event.pull_request.title, 'full-ci') + && '--abortOnFail' || '' + }} + STACKTRACE_FILE: test/gui/guiReportUpload/stacktrace.log + OWNCLOUD_CORE_DUMP: 1 + RECORD_VIDEO_ON_FAILURE: false + COREPACK_ENABLE_STRICT: 0 + HOME: /home/headless + run: bash /dockerstartup/entrypoint.sh + + - name: Upload GUI test result + if: ${{ failure() && steps.run_gui_test.outcome == 'failure' }} + run: | + curl -L https://dl.min.io/client/mc/release/linux-amd64/mc -o /tmp/mc + chmod +x /tmp/mc + /tmp/mc alias set cache ${{ env.S3_PUBLIC_CACHE_SERVER }} ${{ secrets.CACHE_PUBLIC_S3_ACCESS_KEY }} ${{ secrets.CACHE_PUBLIC_S3_SECRET_KEY }} + /tmp/mc cp --recursive test/gui/guiReportUpload cache/${{ env.S3_PUBLIC_CACHE_BUCKET }}/${{ github.repository }}/${{ github.run_number }}/ocis + + - name: Log GUI reports + if: ${{ failure() && steps.run_gui_test.outcome == 'failure' }} + env: + REPORT_DIR: /__w/client/client/test/gui/guiReportUpload + SERVER_TYPE: ocis + run: bash test/gui/ci/log_reports.sh ${REPORT_DIR} ${GITHUB_REPO} ${GITHUB_RUN_NUMBER} ${SERVER_TYPE} + + notification: + needs: gui-tests + if: github.event_name == 'schedule' + runs-on: ubuntu-latest + container: + image: owncloudci/alpine:latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: notify-matrix + env: + CACHE_ENDPOINT: ${{ env.S3_PUBLIC_CACHE_SERVER }} + CACHE_BUCKET: ${{ env.S3_PUBLIC_CACHE_BUCKET }} + MATRIX_TOKEN: ${{ secrets.MATRIX_TOKEN }} + GITHUB_BUILD_STATUS: ${{ needs.gui-tests.result }} + COMMIT_AUTHOR: ${{ github.event.head_commit.author.name }} + run: bash test/gui/ci/notification_template.sh . diff --git a/test/gui/drone/log_reports.sh b/test/gui/ci/log_reports.sh similarity index 100% rename from test/gui/drone/log_reports.sh rename to test/gui/ci/log_reports.sh diff --git a/test/gui/drone/notification_template.sh b/test/gui/ci/notification_template.sh similarity index 75% rename from test/gui/drone/notification_template.sh rename to test/gui/ci/notification_template.sh index 980db331cc6..f3935931991 100644 --- a/test/gui/drone/notification_template.sh +++ b/test/gui/ci/notification_template.sh @@ -4,19 +4,19 @@ # # Generates a template file for notification -COMMIT_SHA_SHORT=${DRONE_COMMIT:0:8} +COMMIT_SHA_SHORT=${GITHUB_SHA:0:8} SERVERS=("oc10" "ocis") BUILD_STATUS="✅ Success" TEST_LOGS="" -BRANCH_NAME="${DRONE_BRANCH}" +BRANCH_NAME="${GITHUB_REF_NAME}" ROOMID="!rnWsCVUmDHDJbiSPMM:matrix.org" -if [ "${DRONE_BUILD_STATUS}" == "failure" ]; then +if [ "${GITHUB_BUILD_STATUS}" == "failure" ]; then BUILD_STATUS="❌️ Failure" fi for server in "${SERVERS[@]}"; do - LOG_URL_PATH="${CACHE_ENDPOINT}/${CACHE_BUCKET}/${DRONE_REPO}/${DRONE_BUILD_NUMBER}/${server}/guiReportUpload" + LOG_URL_PATH="${CACHE_ENDPOINT}/${CACHE_BUCKET}/${GITHUB_REPOSITORY}/${GITHUB_RUN_NUMBER}/${server}/guiReportUpload" CURL="curl --write-out %{http_code} --silent --output /dev/null" LOGS="" @@ -28,7 +28,7 @@ for server in "${SERVERS[@]}"; do LOGS+=': Squish Report' fi - if [ "${DRONE_BUILD_STATUS}" == "failure" ]; then + if [ "${GITHUB_BUILD_STATUS}" == "failure" ]; then SERVER_LOG="${LOG_URL_PATH}/serverlog.log" STACKTRACE="${LOG_URL_PATH}/stacktrace.log" @@ -49,8 +49,8 @@ for server in "${SERVERS[@]}"; do fi done -if [ "${DRONE_BUILD_EVENT}" == "tag" ]; then - BRANCH_NAME="Tag: \`${DRONE_TAG}\`" +if [ "${GITHUB_EVENT_NAME}" == "tag" ]; then + BRANCH_NAME="Tag: \`${GITHUB_REF_NAME}\`" fi # helper functions @@ -66,7 +66,9 @@ log_success() { echo -e "\e[32m$1\e[0m" } -message_html=''$BUILD_STATUS' '${DRONE_REPO}'#'$COMMIT_SHA_SHORT' ('${BRANCH_NAME}') by '${DRONE_COMMIT_AUTHOR}'
'"${TEST_LOGS}"'' +GITHUB_BUILD_LINK="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" + +message_html=''$BUILD_STATUS' '${GITHUB_REPOSITORY}'#'$COMMIT_SHA_SHORT' ('${BRANCH_NAME}') by '${COMMIT_AUTHOR}'
'"${TEST_LOGS}"'' message_html=$(echo "$message_html" | sed 's/\\/\\\\/g' | sed 's/"/\\"/g') log_info "Sending report to the element chat..." diff --git a/test/gui/ci/server.ini b/test/gui/ci/server.ini new file mode 100644 index 00000000000..7cae07f8155 --- /dev/null +++ b/test/gui/ci/server.ini @@ -0,0 +1,3 @@ +[General] +AUT/owncloud = "/__w/client/client/build/bin" +AUTPMTimeout = "15000" diff --git a/test/gui/drone/server.ini b/test/gui/drone/server.ini deleted file mode 100644 index 8f8dbfce87c..00000000000 --- a/test/gui/drone/server.ini +++ /dev/null @@ -1,3 +0,0 @@ -[General] -AUT/owncloud = "/drone/src/build/bin" -AUTPMTimeout = "15000"