Skip to content

Commit

Permalink
Use pnpm for running tests for oC Web
Browse files Browse the repository at this point in the history
  • Loading branch information
dschmidt committed Oct 24, 2022
1 parent ff8b16f commit 20c8149
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .drone.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
102 changes: 33 additions & 69 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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() +
restoreWebAcceptancePnpmCache() +
ocisServer(storage, accounts_hash_difficulty) +
waitForSeleniumService() +
waitForMiddlewareService() +
Expand Down Expand Up @@ -955,15 +953,15 @@ 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",
],
}]

e2eTestsSteps = \
skipIfUnchanged(ctx, "e2e-tests") + \
restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin/ocis") + \
restoreWebCache() + \
restoreWebE2EYarnCache() + \
restoreWebE2EPnpmCache() + \
ocisServer("ocis", 4, []) + \
e2e_test_ocis + \
uploadTracingResult(ctx) + \
Expand Down Expand Up @@ -1069,7 +1067,7 @@ def settingsUITests(ctx, storage = "ocis", accounts_hash_difficulty = 4):
waitForSeleniumService() +
waitForMiddlewareService() +
restoreWebCache() +
restoreWebAcceptanceYarnCache() +
restoreWebAcceptancePnpmCache() +
[
{
"name": "WebUIAcceptanceTests",
Expand Down Expand Up @@ -2920,76 +2918,39 @@ def cloneWeb():
],
}

def generateWebAcceptanceCache(ctx):
def generateWebPnpmCache(ctx):
return [
getDroneEnvAndCheckScript(ctx),
checkForWebCache("acceptance"),
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"],
],
},
]
Expand Down Expand Up @@ -3040,46 +3001,49 @@ def restoreWebCache():
],
}]

def restoreWebE2EYarnCache():
def restoreWebE2EPnpmCache():
return [{
"name": "restore-web-e2e-yarn-cache",
"name": "restore-web-e2e-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-e2e",
"image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION,
"pull": "always",
"commands": [
"cd %s" % dirs["web"],
"rm -rf .yarn",
"tar -xvf %s" % dirs["e2eYarnZip"],
"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'",
],
}]

def restoreWebAcceptanceYarnCache():
def restoreWebAcceptancePnpmCache():
return [{
"name": "restore-web-acceptance-yarn-cache",
"name": "restore-web-acceptance-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/acceptance.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-acceptance",
"name": "unzip-and-install-pnpm-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'",
"cd %s" % dirs["web"],
"rm -rf .pnpm-store",
"tar -xvf %s -C ." % dirs["webPnpmZip"],
"pnpm config set store-dir ./.pnpm-store",
"retry -t 3 'pnpm install'",
],
}]
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services/*/checkstyle.xml
node_modules/
yarn-error.log
yarn.lock
.pnpm-store/

# build artifacts
*/bin
Expand Down
2 changes: 1 addition & 1 deletion docs/ocis/deployment/ocis_wopi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion services/web/Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 20c8149

Please sign in to comment.