Skip to content

Commit

Permalink
zip chromium cache
Browse files Browse the repository at this point in the history
  • Loading branch information
amrita-shrestha committed Nov 28, 2024
1 parent 3bb587f commit 76178bc
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 26 deletions.
63 changes: 38 additions & 25 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dir = {
"ocisRevaDataRoot": "/srv/app/tmp/ocis/owncloud/data/",
"federatedOcisConfig": "/var/www/owncloud/web/tests/drone/config-ocis-federated.json",
"ocmProviders": "/var/www/owncloud/web/tests/drone/providers.json",
"chromiumZip": "/var/www/owncloud/web/playwright-chromium.tar.gz",
}

config = {
Expand Down Expand Up @@ -604,7 +605,7 @@ def e2eTests(ctx):
"REPORT_TRACING": params["reportTracing"],
"BASE_URL_OCIS": "ocis:9200",
"FAIL_ON_UNCAUGHT_CONSOLE_ERR": "true",
"PLAYWRIGHT_BROWSERS_PATH": ".playwright",
"PLAYWRIGHT_BROWSERS_PATH": ".chromium",
"BROWSER": "chromium",
}

Expand Down Expand Up @@ -724,13 +725,14 @@ def installPnpm():

def installChromium():
return [{
"name": "playwright-install",
"name": "chromium-install",
"image": OC_CI_NODEJS,
"environment": {
"PLAYWRIGHT_BROWSERS_PATH": ".playwright",
"PLAYWRIGHT_BROWSERS_PATH": ".chromium",
},
"commands": [
"pnpm exec playwright install chromium --with-deps",
"tar -czvf %s .chromium" % dir["chromiumZip"],
],
}]

Expand Down Expand Up @@ -1864,7 +1866,7 @@ def e2eTestsOnKeycloak(ctx):
"REPORT_TRACING": "with-tracing" in ctx.build.title.lower(),
"KEYCLOAK": "true",
"KEYCLOAK_HOST": "keycloak:8443",
"PLAYWRIGHT_BROWSERS_PATH": ".playwright",
"PLAYWRIGHT_BROWSERS_PATH": ".chromium",
"BROWSER": "chromium",
},
"commands": [
Expand Down Expand Up @@ -1910,17 +1912,19 @@ def getOcislatestCommitId(ctx):
]

def cacheChromium():
return [{
"name": "upload-chromium-cache",
"image": MINIO_MC,
"environment": minio_mc_environment,
"commands": [
"playwright_version=$(bash tests/drone/script.sh get_playwright_version)",
"mc alias set s3 $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY",
"mc cp -r -a %s/.playwright s3/$CACHE_BUCKET/web/$playwright_version/" % dir["web"],
"mc ls --recursive s3/$CACHE_BUCKET/web",
],
}]
return [
{
"name": "upload-chromium-cache",
"image": MINIO_MC,
"environment": minio_mc_environment,
"commands": [
"playwright_version=$(bash tests/drone/script.sh get_playwright_version)",
"mc alias set s3 $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY",
"mc cp -r -a %s s3/$CACHE_BUCKET/web/$playwright_version/" % dir["chromiumZip"],
"mc ls --recursive s3/$CACHE_BUCKET/web",
],
},
]

def checkChromiumCache():
return [{
Expand All @@ -1935,13 +1939,22 @@ def checkChromiumCache():
}]

def restoreChromiumCache():
return [{
"name": "restore-chromium-cache",
"image": MINIO_MC,
"environment": minio_mc_environment,
"commands": [
"playwright_version=$(bash tests/drone/script.sh get_playwright_version)",
"mc alias set s3 $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY",
"mc cp -r -a s3/$CACHE_BUCKET/web/$playwright_version/.playwright %s" % dir["web"],
],
}]
return [
{
"name": "restore-chromium-cache",
"image": MINIO_MC,
"environment": minio_mc_environment,
"commands": [
"playwright_version=$(bash tests/drone/script.sh get_playwright_version)",
"mc alias set s3 $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY",
"mc cp -r -a s3/$CACHE_BUCKET/web/$playwright_version/playwright-chromium.tar.gz %s" % dir["web"],
],
},
{
"name": "unzip-chromium-cache",
"image": OC_UBUNTU,
"commands": [
"tar -xvf %s -C ." % dir["chromiumZip"],
],
},
]
2 changes: 1 addition & 1 deletion tests/drone/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ get_playwright_version() {
check_chromium_cache() {
get_playwright_version

playwright_cache=$(mc find s3/$CACHE_BUCKET/web/$playwright_version/.playwright 2>&1 | grep 'Object does not exist')
playwright_cache=$(mc find s3/$CACHE_BUCKET/web/$playwright_version/playwright-chromium.tar.gz 2>&1 | grep 'Object does not exist')

if [[ "$playwright_cache" != "" ]]
then
Expand Down

0 comments on commit 76178bc

Please sign in to comment.