forked from podkrepi-bg/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (114 loc) · 3.79 KB
/
playwright.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Playwright tests
on:
workflow_call:
workflow_dispatch:
env:
STRIPE_DEV_PUBLISHABLE_KEY: ${{ vars.STRIPE_DEV_PUBLISHABLE_KEY }}
jobs:
run-playwright:
name: Run Playwright
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: './frontend'
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout
uses: actions/checkout@v4
with:
repository: podkrepi-bg/api
ref: master
path: './api'
- name: Set yarn version
run: yarn set version berry
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
**/.next/cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run db and keycloak
working-directory: ./api
run: docker compose up -d pg-db keycloak
- name: Run stripe webhook
working-directory: ./api
env:
STRIPE_WEBHOOK_SECRET: ${{ secrets.STRIPE_WEBHOOK_SECRET }}
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }}
run: docker compose up -d stripe-webhook
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install backend dependencies
working-directory: ./api
run: yarn
- name: Seed database
working-directory: ./api
run: yarn prisma generate && yarn prisma migrate deploy && yarn prisma db seed
- name: Run backend
working-directory: ./api
env:
STRIPE_WEBHOOK_SECRET: ${{ secrets.STRIPE_WEBHOOK_SECRET }}
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }}
run: yarn start &> api.log &
- name: Install Frontend Dependencies
working-directory: ./frontend
run: yarn install --immutable
- name: Install e2e Dependencies
working-directory: ./frontend/e2e
run: yarn install --immutable
- name: Setup env
working-directory: ./frontend
run: cp .env.local.example .env.local
- name: Build frontend
working-directory: ./frontend
run: yarn run next build
- name: Wait on backend
uses: iFaxity/wait-on-action@v1
with:
resource: http-get://localhost:5010/api/v1/campaign/list
timeout: 120000
- name: Test Backend is ready
working-directory: ./frontend
run: curl http://localhost:5010/api/v1/campaign/list
- name: Start frontend
working-directory: ./frontend
run: yarn start &> frontend.log &
env:
STRIPE_PUBLISHABLE_KEY: ${{ env.STRIPE_DEV_PUBLISHABLE_KEY }}
- name: Install Playwright Browsers
working-directory: ./frontend/e2e
run: yarn run playwright:install
- name: Wait on frontend
uses: iFaxity/wait-on-action@v1
with:
resource: http-get://localhost:3040
timeout: 120000
- name: Run Frontend Tests
working-directory: ./frontend
run: yarn run test:e2e
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: ./frontend/e2e/test-results/
retention-days: 14
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: ./frontend/e2e/e2e-reports/
retention-days: 14
- uses: actions/upload-artifact@v4
if: failure()
with:
name: logs
path: |
./frontend/frontend.log
./api/api.log
retention-days: 14