Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: cache cypress, playwright, puppeteer (#2676)
- Loading branch information
1 parent
26f915a
commit 3d8ef76
Showing
2 changed files
with
70 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Setup and cache | ||
description: Setup for node, pnpm and cache for browser testing binaries | ||
inputs: | ||
node-version: | ||
required: false | ||
description: Node version for setup-node | ||
default: 18.x | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
|
||
- name: Set node version to ${{ inputs.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
|
||
- name: Resolve package versions | ||
id: resolve-package-versions | ||
shell: bash | ||
run: > | ||
echo "$( | ||
node -e " | ||
const fs = require('fs'); | ||
const lockfile = fs.readFileSync('./pnpm-lock.yaml', 'utf8'); | ||
const cypressVersion = lockfile.match(/cypress: (\d+\.\d+\.\d+)/)[1]; | ||
const playwrightVersion = lockfile.match(/playwright: (\d+\.\d+\.\d+)/)[1]; | ||
const puppeteerVersion = lockfile.match(/puppeteer: (\d+\.\d+\.\d+)/)[1]; | ||
console.log('CYPRESS_VERSION=' + cypressVersion); | ||
console.log('PLAYWRIGHT_VERSION=' + playwrightVersion); | ||
console.log('PUPPETEER_VERSION=' + puppeteerVersion); | ||
" | ||
)" >> $GITHUB_OUTPUT | ||
- name: Cache Cypress v${{ steps.resolve-package-versions.outputs.CYPRESS_VERSION }} | ||
uses: actions/cache@v3 | ||
id: cypress-cache | ||
with: | ||
path: ${{ env.CYPRESS_CACHE_FOLDER }} | ||
key: ${{ runner.os }}-cypress-${{ steps.resolve-package-versions.outputs.CYPRESS_VERSION }} | ||
restore-keys: | | ||
${{ runner.os }}-cypress- | ||
- name: Cache Playwright v${{ steps.resolve-package-versions.outputs.PLAYWRIGHT_VERSION }} | ||
uses: actions/cache@v3 | ||
id: playwright-cache | ||
with: | ||
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} | ||
key: ${{ runner.os }}-playwright-${{ steps.resolve-package-versions.outputs.PLAYWRIGHT_VERSION }} | ||
restore-keys: | | ||
${{ runner.os }}-playwright- | ||
- name: Cache Puppeteer v${{ steps.resolve-package-versions.outputs.PUPPETEER_VERSION }} | ||
uses: actions/cache@v3 | ||
id: puppeteer-cache | ||
with: | ||
path: ${{ env.PUPPETEER_DOWNLOAD_PATH }} | ||
key: ${{ runner.os }}-puppeteer-${{ steps.resolve-package-versions.outputs.PUPPETEER_VERSION }} | ||
restore-keys: | | ||
${{ runner.os }}-puppeteer- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters