-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca9b405
commit 2a322e9
Showing
4 changed files
with
71 additions
and
3 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,65 @@ | ||
name: Setup and cache | ||
description: Setup for node, pnpm and cache for dependencies | ||
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 pnpm store | ||
id: resolve-pnpm-store | ||
shell: bash | ||
run: echo "PNPM_STORE=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
|
||
- name: Cache pnpm store ${{ steps.resolve-pnpm-store.outputs.PNPM_STORE }} | ||
uses: actions/cache@v3 | ||
id: pnpm-store-cache | ||
with: | ||
path: ${{ steps.resolve-pnpm-store.outputs.PNPM_STORE }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm- | ||
- 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 pattern = (name) => new RegExp(name + ':\\\s+specifier: [\\\s\\\w\\\.^]+version: (\\\d+\\\.\\\d+\\\.\\\d+)'); | ||
const playwrightVersion = lockfile.match(pattern('playwright'))[1]; | ||
console.log('PLAYWRIGHT_VERSION=' + playwrightVersion); | ||
" | ||
)" >> $GITHUB_OUTPUT | ||
- name: Print versions | ||
shell: bash | ||
run: echo "${{ toJson(steps.resolve-package-versions.outputs) }}" | ||
|
||
- name: Check resolved package versions | ||
shell: bash | ||
if: contains(fromJSON('[null, "", "undefined"]'), steps.resolve-package-versions.outputs.PLAYWRIGHT_VERSION) | ||
run: echo "Failed to resolve package versions. See log above." && exit 1 | ||
|
||
- 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- |
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
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
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