-
Notifications
You must be signed in to change notification settings - Fork 624
72 lines (57 loc) · 2.16 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Build, TypeScripts, tests
on: deployment_status
concurrency:
group: tests-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build_and_test:
if: ${{ github.event.deployment_status.state == 'success' }}
runs-on: ubuntu-latest
env:
NEXT_PUBLIC_SALEOR_API_URL: https://storefront1.saleor.cloud/graphql/
steps:
- uses: actions/checkout@v4
- name: Get PNPM version from package.json
id: pnpm-version
run: echo "pnpm_version=$(cat package.json | jq '.engines.pnpm' | sed -E 's/[^0-9.]//g')" >> $GITHUB_OUTPUT
- name: Install PNPM
uses: pnpm/action-setup@v2
with:
version: ${{ steps.pnpm-version.outputs.pnpm_version }}
- uses: actions/setup-node@v3
with:
node-version-file: package.json
cache: "pnpm"
- name: Install dependencies
run: pnpm --version && pnpm install --frozen-lockfile
- name: Get Playwright version
id: playwright-version
run: echo "playwright_version=$(pnpm playwright --version | sed -E 's/[^0-9.]//g')" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Playwright Cache
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.playwright_version }}
- run: pnpm exec playwright install chromium --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- run: pnpm exec playwright install-deps chromium
if: steps.playwright-cache.outputs.cache-hit == 'true'
- name: Wait for Vercel Preview
uses: patrickedqvist/wait-for-vercel-preview@v1.3.1
id: waitForVercel
with:
token: ${{ secrets.GITHUB_TOKEN }}
max_timeout: 240
check_interval: 5
- name: Run Playwright tests
run: pnpm exec playwright test
env:
BASE_URL: ${{ steps.waitForVercel.outputs.url }}
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30