-
Notifications
You must be signed in to change notification settings - Fork 5
127 lines (112 loc) · 3.85 KB
/
e2e-playwright.js.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
name: End-to-end Tests
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
- master
- develop
pull_request:
jobs:
playwright-e2e:
runs-on: ubuntu-latest
services:
mailhog:
image: mailhog/mailhog
ports:
- 1025:1025 # smtp server
- 8025:8025 # web ui
postgres:
image: postgres
env:
POSTGRES_DB: default
POSTGRES_USER: default
POSTGRES_PASSWORD: secret
TZ: Europe/Warsaw
ports:
- 5432:5432
redis:
image: redis
steps:
- name: Start API container
run: |
docker run -d --name api \
--network github_network_${{ job.container.network }} \
-p 80:80 \
escolalms/api:latest \
sh -c "rm -f /etc/supervisor/custom.d/horizon.conf && rm -f /etc/supervisor/custom.d/scheduler.conf && /usr/bin/supervisord -c /etc/supervisor/supervisord.conf"
- run: |
docker exec -u 1000 api echo "APP_NAME=Wellms Playwright Demo \
APP_ENV=local \
APP_KEY=base64:pveos6JL8iCwO3MbzoyQpNx6TETMYuUpfZ18CDKl6Cw= \
APP_DEBUG=true \
APP_LOG_LEVEL=debug \
APP_URL=http://localhost:1000 \
DB_CONNECTION=pgsql \
DB_HOST=postgres \
DB_PORT=5432 \
DB_DATABASE=default \
DB_USERNAME=default \
DB_PASSWORD=secret \
BROADCAST_DRIVER=log \
CACHE_DRIVER=redis \
SESSION_DRIVER=cookie \
QUEUE_DRIVER=redis \
QUEUE_CONNECTION=redis \
REDIS_HOST=redis \
REDIS_PASSWORD= \
REDIS_PORT=6379 \
MAIL_DRIVER=smtp \
MAIL_HOST=mailhog \
MAIL_PORT=1025 \
MAIL_USERNAME=null \
MAIL_PASSWORD=null \
MAIL_ENCRYPTION= \
MJML_BINARY_PATH=/usr/bin/mjml \
TRACKER_ENABLED=false" >> .env
- run: docker exec -u 1000 api cat .env
- run: docker exec -u 1000 api php artisan config:cache
- run: docker exec -u 1000 api composer dumpautoload
- run: docker exec -u 1000 api php artisan key:generate --force --no-interaction
- run: docker exec -u 1000 api php artisan passport:keys --force --no-interaction
- run: docker exec -u 1000 api php artisan migrate --force --no-interaction
- run: docker exec -u 1000 api php artisan passport:client --personal --no-interaction
- run: docker exec -u 1000 api php artisan db:seed --force --no-interaction
- uses: actions/checkout@v2
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list
- name: Node dependencies
run: npm i --legacy-peer-deps
- name: Build
run: cp .env.ci .env && REACT_APP_API_URL=http://localhost npm run --openssl-legacy-provider build
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run your tests
run: npm run test:e2e
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: test-results