From 966a7758fc70f95bccc8afe1995cf4af09144e6a Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Mon, 24 Oct 2022 15:15:53 +0200 Subject: [PATCH] Use pnpm for running tests for oC Web --- .drone.env | 2 +- .drone.star | 108 +++++++----------------------- .gitignore | 1 + docs/ocis/deployment/ocis_wopi.md | 2 +- services/web/Makefile | 2 +- 5 files changed, 28 insertions(+), 87 deletions(-) diff --git a/.drone.env b/.drone.env index ffa1f8304..95e4879eb 100644 --- a/.drone.env +++ b/.drone.env @@ -3,5 +3,5 @@ CORE_COMMITID=7e9d9b585332d609ec47383be9588b98b57b8dd1 CORE_BRANCH=master # The test runner source for UI tests -WEB_COMMITID=c8c69113bc7987d6f14e32e5f1e7bd1b5491b1d9 +WEB_COMMITID=5550841f55e20f6c90b93fc98295b9ae8aff3e45 WEB_BRANCH=master diff --git a/.drone.star b/.drone.star index 68f39c0c5..71fa4d714 100644 --- a/.drone.star +++ b/.drone.star @@ -45,8 +45,7 @@ dirs = { "web": "/drone/src/webTestRunner", "zip": "/drone/src/zip", "webZip": "/drone/src/zip/web.tar.gz", - "e2eYarnZip": "/drone/src/zip/e2e.tar.gz", - "acceptanceYarnZip": "/drone/src/zip/acceptance.tar.gz", + "webPnpmZip": "/drone/src/zip/pnpm-store.tar.gz", "ocisConfig": "tests/config/drone/ocis-config.json", "ocis": "/srv/app/tmp/ocis", "ocisRevaDataRoot": "/srv/app/tmp/ocis/owncloud/data", @@ -299,8 +298,7 @@ def cachePipeline(name, steps): def buildWebCache(ctx): return [ cachePipeline("web", generateWebCache(ctx)), - cachePipeline("web-acceptance", generateWebAcceptanceCache(ctx)), - cachePipeline("web-e2e", generateWebE2ECache(ctx)), + cachePipeline("web-pnpm", generateWebPnpmCache(ctx)), ] def testOcisModules(ctx): @@ -880,7 +878,7 @@ def uiTestPipeline(ctx, filterTags, early_fail, runPart = 1, numberOfParts = 1, "steps": skipIfUnchanged(ctx, "acceptance-tests") + restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin") + restoreWebCache() + - restoreWebAcceptanceYarnCache() + + restoreWebPnpmCache() + ocisServer(storage, accounts_hash_difficulty) + waitForSeleniumService() + waitForMiddlewareService() + @@ -955,7 +953,7 @@ def e2eTests(ctx): }, "commands": [ "cd %s" % dirs["web"], - "sleep 10 && yarn test:e2e:cucumber tests/e2e/cucumber/**/*[!.oc10].feature", + "sleep 10 && pnpm test:e2e:cucumber tests/e2e/cucumber/**/*[!.oc10].feature", ], }] @@ -963,7 +961,7 @@ def e2eTests(ctx): skipIfUnchanged(ctx, "e2e-tests") + \ restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin/ocis") + \ restoreWebCache() + \ - restoreWebE2EYarnCache() + \ + restoreWebPnpmCache() + \ ocisServer("ocis", 4, []) + \ e2e_test_ocis + \ uploadTracingResult(ctx) + \ @@ -1069,7 +1067,7 @@ def settingsUITests(ctx, storage = "ocis", accounts_hash_difficulty = 4): waitForSeleniumService() + waitForMiddlewareService() + restoreWebCache() + - restoreWebAcceptanceYarnCache() + + restoreWebPnpmCache() + [ { "name": "WebUIAcceptanceTests", @@ -2920,76 +2918,39 @@ def cloneWeb(): ], } -def generateWebAcceptanceCache(ctx): +def generateWebPnpmCache(ctx): return [ getDroneEnvAndCheckScript(ctx), - checkForWebCache("acceptance"), + checkForWebCache("web-pnpm"), cloneWeb(), { - "name": "install-yarn", + "name": "install-pnpm", "image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION, "commands": [ "cd %s" % dirs["web"], - "cd tests/acceptance", - "retry -t 3 'yarn install --immutable --frozen-lockfile'", + "pnpm config set store-dir ./.pnpm-store", + "retry -t 3 'pnpm install'", ], }, { - "name": "zip-yarn", + "name": "zip-pnpm", "image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION, "commands": [ - # zip the yarn deps before caching + # zip the pnpm deps before caching "if [ ! -d '%s' ]; then mkdir -p %s; fi" % (dirs["zip"], dirs["zip"]), "cd %s" % dirs["web"], - "cd tests/acceptance", - "tar -czvf %s .yarn" % dirs["acceptanceYarnZip"], + "tar -czvf %s .pnpm-store" % dirs["webPnpmZip"], ], }, { - "name": "cache-yarn", + "name": "cache-pnpm", "image": MINIO_MC, "environment": MINIO_MC_ENV, "commands": [ "source ./.drone.env", # cache using the minio/mc client to the public bucket (long term bucket) "mc alias set s3 $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY", - "mc cp -r -a %s s3/$CACHE_BUCKET/ocis/web-test-runner/$WEB_COMMITID" % dirs["acceptanceYarnZip"], - ], - }, - ] - -def generateWebE2ECache(ctx): - return [ - getDroneEnvAndCheckScript(ctx), - checkForWebCache("e2e"), - cloneWeb(), - { - "name": "install-yarn", - "image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION, - "commands": [ - "cd %s" % dirs["web"], - "retry -t 3 'yarn install --immutable --frozen-lockfile'", - ], - }, - { - "name": "zip-yarn", - "image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION, - "commands": [ - # zip the yarn deps before caching - "if [ ! -d '%s' ]; then mkdir -p %s; fi" % (dirs["zip"], dirs["zip"]), - "cd %s" % dirs["web"], - "tar -czvf %s .yarn" % dirs["e2eYarnZip"], - ], - }, - { - "name": "cache-yarn", - "image": MINIO_MC, - "environment": MINIO_MC_ENV, - "commands": [ - "source ./.drone.env", - # cache using the minio/mc client to the public bucket (long term bucket) - "mc alias set s3 $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY", - "mc cp -r -a %s s3/$CACHE_BUCKET/ocis/web-test-runner/$WEB_COMMITID" % dirs["e2eYarnZip"], + "mc cp -r -a %s s3/$CACHE_BUCKET/ocis/web-test-runner/$WEB_COMMITID" % dirs["webPnpmZip"], ], }, ] @@ -3040,46 +3001,25 @@ def restoreWebCache(): ], }] -def restoreWebE2EYarnCache(): +def restoreWebPnpmCache(): return [{ - "name": "restore-web-e2e-yarn-cache", + "name": "restore-web-pnpm-cache", "image": MINIO_MC, "environment": MINIO_MC_ENV, "commands": [ "source ./.drone.env", "mc alias set s3 $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY", - "mc cp -r -a s3/$CACHE_BUCKET/ocis/web-test-runner/$WEB_COMMITID/e2e.tar.gz %s" % dirs["zip"], + "mc cp -r -a s3/$CACHE_BUCKET/ocis/web-test-runner/$WEB_COMMITID/pnpm-store.tar.gz %s" % dirs["zip"], ], }, { # we need to install again because the node_modules are not cached - "name": "unzip-and-install-yarn-e2e", + "name": "unzip-and-install-pnpm", "image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION, "commands": [ "cd %s" % dirs["web"], - "rm -rf .yarn", - "tar -xvf %s" % dirs["e2eYarnZip"], - "retry -t 3 'yarn install --immutable'", - ], - }] - -def restoreWebAcceptanceYarnCache(): - return [{ - "name": "restore-web-acceptance-yarn-cache", - "image": MINIO_MC, - "environment": MINIO_MC_ENV, - "commands": [ - "source ./.drone.env", - "mc alias set s3 $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY", - "mc cp -r -a s3/$CACHE_BUCKET/ocis/web-test-runner/$WEB_COMMITID/acceptance.tar.gz %s" % dirs["zip"], - ], - }, { - # we need to install again because the node_modules are not cached - "name": "unzip-and-install-yarn-acceptance", - "image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION, - "commands": [ - "cd %s/tests/acceptance" % dirs["web"], - "rm -rf .yarn", - "tar -xvf %s -C ." % dirs["acceptanceYarnZip"], - "retry -t 3 'yarn install --immutable'", + "rm -rf .pnpm-store", + "tar -xvf %s" % dirs["webPnpmZip"], + "pnpm config set store-dir ./.pnpm-store", + "retry -t 3 'pnpm install'", ], }] diff --git a/.gitignore b/.gitignore index ec289b446..68c73746e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ services/*/checkstyle.xml node_modules/ yarn-error.log yarn.lock +.pnpm-store/ # build artifacts */bin diff --git a/docs/ocis/deployment/ocis_wopi.md b/docs/ocis/deployment/ocis_wopi.md index 658cd56f7..7d5cbc3d7 100644 --- a/docs/ocis/deployment/ocis_wopi.md +++ b/docs/ocis/deployment/ocis_wopi.md @@ -162,7 +162,7 @@ Open https://ocis.owncloud.test in your browser and accept the invalid certifica In case you want to run ownCloud Web from a development branch together with this deployment example (e.g. for feature development for the app provider frontend) you can use this deployment example with the local setup and some additional steps as described below. 1. Clone the [ownCloud Web repository](https://github.com/owncloud/web) on your development machine. -2. Run `yarn && yarn build:w` for `web`, so that it creates and continuously updates the `dist` folder for web. +2. Run `pnpm && pnpm build:w` for `web`, so that it creates and continuously updates the `dist` folder for web. 3. Add the dist folder as read only volume to `volumes` section of the `ocis` service in the `docker-compose.yml` file: ```yaml - /your/local/path/to/web/dist/:/web/dist:ro diff --git a/services/web/Makefile b/services/web/Makefile index df2a41bff..b662b30b8 100644 --- a/services/web/Makefile +++ b/services/web/Makefile @@ -1,6 +1,6 @@ SHELL := bash NAME := web -WEB_ASSETS_VERSION = v6.0.0-rc.2 +WEB_ASSETS_VERSION = v6.0.0-rc.4 include ../../.make/recursion.mk