Skip to content

Commit

Permalink
restore-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
amrita-shrestha committed Nov 26, 2024
1 parent f7ab949 commit 2583a32
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def main(ctx):

after = pipelinesDependsOn(afterPipelines(ctx), stages)

pipelines = before
pipelines = before + stages + after

deploys = example_deploys(ctx)
if ctx.build.event != "cron":
Expand All @@ -210,7 +210,13 @@ def main(ctx):

def beforePipelines(ctx):
return checkStarlark() + \
pnpmCache(ctx)
licenseCheck(ctx) + \
documentation(ctx) + \
changelog(ctx) + \
pnpmCache(ctx) + \
cacheOcisPipeline(ctx) + \
pipelinesDependsOn(buildCacheWeb(ctx), pnpmCache(ctx)) + \
pipelinesDependsOn(pnpmlint(ctx), pnpmCache(ctx))

def stagePipelines(ctx):
unit_test_pipelines = unitTests(ctx)
Expand Down Expand Up @@ -603,6 +609,7 @@ def e2eTests(ctx):
steps = skipIfUnchanged(ctx, "e2e-tests") + \
restoreBuildArtifactCache(ctx, "pnpm", ".pnpm-store") + \
installPnpm() + \
restorePlaywrightChromiumCache() + \
restoreBuildArtifactCache(ctx, "web-dist", "dist")

if ctx.build.event == "cron":
Expand Down Expand Up @@ -1715,7 +1722,6 @@ def buildAndTestDesignSystem(ctx):
}

steps = restoreBuildArtifactCache(ctx, "pnpm", ".pnpm-store") + \
restoreBuildArtifactCache(ctx, "playwright", ".playwright") + \
installPnpm() + \
buildDesignSystemDocs() + \
runDesignSystemDocsE2eTests()
Expand Down Expand Up @@ -1937,3 +1943,17 @@ def checkPlaywrightChromiumCache():
"bash tests/drone/script.sh check_playwright_cache",
],
}]

def restorePlaywrightChromiumCache():
return [{
"name": "restore-playwright-chromium-cache",
"image": MINIO_MC,
"environment": minio_mc_environment,
"commands": [
"ls -al",
"playwright_version=$(grep '\"@playwright/test\":' \"package.json\" | cut -d':' -f2 | tr -d '\", ')",
"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"],
"ls -al",
],
}]

0 comments on commit 2583a32

Please sign in to comment.