Skip to content

Commit 8f6f16d

Browse files
Skiller installering og caching av Playwright ut i egen action (#6156)
* Skiller installering og caching av Playwright ut i egen action * Prøver å fikse action
1 parent 500ff14 commit 8f6f16d

File tree

3 files changed

+40
-20
lines changed

3 files changed

+40
-20
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: 'Install and cache Playwright'
2+
description: Run commands needed to install and cache Playwright.
3+
inputs:
4+
cacheOnly:
5+
description: Is this for caching purposes only?
6+
default: 'false'
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Finn Playwright versjon
12+
shell: bash
13+
run: |
14+
PLAYWRIGHT_VERSION=$(YARN_ENABLE_COLORS=false yarn info @playwright/test | grep @playwright | sed 's/.*://')
15+
echo "Playwright's Version: $PLAYWRIGHT_VERSION"
16+
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
17+
18+
- name: Cache Playwright Browsers for Playwright versjon
19+
id: cache-playwright-browsers
20+
uses: actions/cache@v4
21+
with:
22+
path: ~/.cache/ms-playwright
23+
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}
24+
25+
- name: Installer Playwright med avhengigheter
26+
shell: bash
27+
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
28+
run: npx playwright install --with-deps
29+
30+
- name: Installer Playwrights avhengigheter
31+
shell: bash
32+
if: inputs.cacheOnly == 'false' && steps.cache-playwright-browsers.outputs.cache-hit == 'true'
33+
run: npx playwright install-deps

.github/workflows/deploy-storybook-to-gh-pages.yml

+5
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,8 @@ jobs:
3434
build_command: yarn build-storybook
3535
path: .static_storybook
3636
checkout: false
37+
38+
- name: Oppdater Playwright install cache for Storybook-tester
39+
uses: ./.github/actions/setup-playwright
40+
with:
41+
cacheOnly: 'true'

.github/workflows/storybook-tests.yml

+2-20
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,8 @@ jobs:
1414
with:
1515
npmAuthToken: ${{ secrets.READER_TOKEN }}
1616

17-
- name: Finn Playwright versjon
18-
run: |
19-
PLAYWRIGHT_VERSION=$(YARN_ENABLE_COLORS=false yarn info @playwright/test | grep @playwright | sed 's/.*://')
20-
echo "Playwright's Version: $PLAYWRIGHT_VERSION"
21-
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
22-
23-
- name: Cache Playwright Browsers for Playwright versjon
24-
id: cache-playwright-browsers
25-
uses: actions/cache@v4
26-
with:
27-
path: ~/.cache/ms-playwright
28-
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}
29-
30-
- name: Installer Playwright med avhengigheter
31-
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
32-
run: npx playwright install --with-deps
33-
34-
- name: Installer Playwrights avhengigheter
35-
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true'
36-
run: npx playwright install-deps
17+
- name: Installer Playwright
18+
uses: ./.github/actions/setup-playwright
3719

3820
- name: Build Storybook
3921
run: yarn build-storybook-test --quiet

0 commit comments

Comments
 (0)