-
Notifications
You must be signed in to change notification settings - Fork 0
258 lines (234 loc) · 8.28 KB
/
Copy pathe2e-isolated.yml
File metadata and controls
258 lines (234 loc) · 8.28 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
name: PR Isolated E2E Tests
on:
pull_request:
workflow_dispatch:
inputs:
api_branch:
description: "Branch of gateway-api to check out"
required: false
default: "dev"
env:
APP_ENV: "dev"
APP_DEBUG: "true"
APP_NAME: "gateway-api-2"
AUDIT_LOG_ENABLED: "true"
APP_URL: "http://localhost:8000"
ZURE_PROXY: "false"
BROADCAST_DRIVER: "log"
CORS_ACCESS_CONTROL_ALLOW_ORIGIN: "http://localhost:3000"
CACHE_DRIVER: "file"
DB_CONNECTION: "mysql"
DB_DATABASE: "hdrgatewaydev"
DB_HOST: "127.0.0.1"
DB_PORT: "3306"
DB_USERNAME: "root"
DB_PASSWORD: "root"
ELASTICSEARCH_VERIFY_SSL: "false"
ELASTIC_SERVICE_URL: ${{ secrets.ELASTIC_SERVICE_URL }}
ELASTICSEARCH_USER: ${{ secrets.ELASTICSEARCH_USER }}
ELASTICSEARCH_PASS: ${{ secrets.ELASTICSEARCH_PASS }}
FILESYSTEM_DISK: "local"
FORM_HYDRATION_SCHEMA_URL: "https://raw.githubusercontent.com/HDRUK/schemata-2/master/docs/%s/%s.form.json"
FORM_HYDRATION_SCHEMA_MODEL: "HDRUK"
FORM_HYDRATION_SCHEMA_LATEST_VERSION: "4.0.0"
GATEWAY_API_USER_ID: 2
GATEWAY_LOGOUT_URL: "http://localhost:3000"
GATEWAY_URL: "http://localhost:3000"
SCANNING_FILESYSTEM_DISK: "local_scan"
CLAMAV_API_URL: "https://hdr-gateway-scanning-dev-qmnkcg5qjq-ew.a.run.app"
SDEConciergeServiceEnquiry: "true"
GWDM: "GWDM"
GWDM_TRASER_IDENT: "gdmv1"
GWDM_CURRENT_VERSION: "2.0"
APP_KEY: ${{ secrets.APP_KEY }}
JWT_KID: ${{ secrets.JWT_KID }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
MAIL_MAILER: "smtp"
MAIL_HOST: "127.0.0.1"
MAIL_PORT: "1025"
MAIL_USERNAME:
MAIL_PASSWORD:
MAIL_ENCRYPTION: null
MAIL_FROM_ADDRESS: "noreply@healthdatagateway.org"
MAIL_FROM_NAME: "gateway-api-2"
MEMCACHED_HOST: "127.0.0.1"
MJML_RENDER_URL: "https://europe-west1-hdrukshareddev.cloudfunctions.net/hdr-shared-mjml-dev"
QUEUE_CONNECTION: "database"
REDIS_CLIENT: "phpredis"
REDIS_HOST: "localhost"
REDIS_PASSWORD: "mypassword"
REDIS_PORT: "6379"
SEARCH_SERVICE_URL: ${{ secrets.SEARCH_SERVICE_URL }}
TED_ENABLED: "true"
TED_SERVICE_URL: ${{ secrets.TED_SERVICE_URL }}
TRASER_ENABLED: "true"
TRASER_SERVICE_URL: ${{ secrets.TRASER_SERVICE_URL }}
MEDIA_URL: "https://media.dev.hdruk.cloud"
COHORT_DISCOVERY_ACCESS_URL: "http://localhost:3000/en/about/cohort-discovery"
COHORT_DISCOVERY_RENEW_URL: "http://localhost:3000/en/about/cohort-discovery"
AZURE_PROXY: "false"
CYPRESS_BASE_URL: "http://localhost:3000/en"
isTest: "true"
TEST_USER_PASSWORD: "3pFOx4a6D464"
NEXT_PUBLIC_API_V1_URL: "http://localhost:8000/api/v1"
NEXT_PUBLIC_API_V1_IP_URL: "http://localhost:8000/api/v1"
NEXT_PUBLIC_API_V2_URL: "http://localhost:8000/api/v2"
NEXT_PUBLIC_API_V2_IP_URL: "http://localhost:8000/api/v2"
NEXT_PUBLIC_API_V3_URL: "http://localhost:8000/api/v3"
NEXT_PUBLIC_API_V3_IP_URL: "http://localhost:8000/api/v3"
NEXT_PUBLIC_WORDPRESS_API_URL: ${{ secrets.NEXT_PUBLIC_WORDPRESS_API_URL }}
NEXT_PUBLIC_SERVICE_DESK_URL: ${{ secrets.NEXT_PUBLIC_SERVICE_DESK_URL }}
NEXT_PUBLIC_GATEWAY_URL: "http://localhost:3000"
NEXT_TELEMETRY_DISABLED: "1"
NEXT_PUBLIC_API_VERSION: "v1"
NEXT_PUBLIC_SCHEMA_NAME: "HDRUK"
NEXT_PUBLIC_SCHEMA_VERSION: "4.0.0"
NEXT_PUBLIC_MEDIA_URL: ${{ secrets.NEXT_PUBLIC_MEDIA_URL }}
NEXT_PUBLIC_INCLUDE_BANNERS: "false"
NEXT_PUBLIC_MEDIA_DOMAIN: "http://localhost/storage"
NEXT_PUBLIC_MEDIA_STATIC_URL: ${{ secrets.NEXT_PUBLIC_MEDIA_STATIC_URL }}
NEXT_PUBLIC_CMS_LINK_HOSTNAME: "www.healthdatagateway.org"
NEXT_PUBLIC_CONFLUENCE_URL: ${{ secrets.NEXT_PUBLIC_CONFLUENCE_URL }}
NEXT_PUBLIC_API_BASE_URL: "http://localhost:8000/api"
DEV_EMAIL: "CypressDevelopers@hdruk.ac.uk"
CUST_ADMIN_1_EMAIL: "CypressTeamAdmin@hdruk.ac.uk"
METADATA_MANAGER_EMAIL: "CypressMetaDataManager@hdruk.ac.uk"
DAR_MANAGER_AND_METADATA_MANAGER_EMAIL: "CypressDarMetadataManager@hdruk.ac.uk"
SUPERUSER_EMAIL: "CypressSuperUser@hdruk.ac.uk"
jobs:
e2e-tests:
if: github.event_name != 'pull_request' || github.event.pull_request.state == 'open' && github.event.pull_request.draft == false
runs-on: ubuntu-latest
environment: cypress_dev
services:
mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: hdrgatewaydev
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost"
--health-interval=5s
--health-timeout=2s
--health-retries=5
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd="redis-cli -a mypassword ping"
--health-interval=5s
--health-timeout=2s
--health-retries=5
env:
REDIS_PASSWORD: mypassword
steps:
- name: Install MailDev
run: npm install -g maildev
- name: Start MailDev
run: |
nohup maildev --smtp=1025 --web=8025 > maildev.log 2>&1 &
sleep 5
- name: Checkout web
uses: actions/checkout@v4
- name: Generate GitHub App token
if: ${{ !startsWith(github.actor, 'dependabot') }}
id: generate-deployment-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.DEPLOY_APP_ID }}
private-key: ${{ secrets.DEPLOY_APP_PRIVATE_KEY }}
owner: HDRUK
repositories: |
${{ github.event.repository.name }}
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Checkout api
uses: actions/checkout@v4
with:
repository: HDRUK/gateway-api
path: gateway-api
token: ${{ steps.generate-deployment-token.outputs.token }}
ref: ${{ github.event.inputs.api_branch || 'dev' }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
- name: Cache Composer deps
uses: actions/cache@v4
with:
path: gateway-api/vendor
key: e2e-composer-${{ hashFiles('gateway-api/composer.lock') }}
restore-keys: e2e-composer-
- name: Install Composer deps
run: |
cd gateway-api
composer install --no-interaction --prefer-dist
- name: Configure Laravel .env + run migrations/seed
run: |
cd gateway-api
cp .env.example .env
sed -i 's/DB_HOST=.*/DB_HOST=127.0.0.1/' .env
sed -i 's/DB_PASSWORD=.*/DB_PASSWORD=root/' .env
php artisan key:generate
php artisan migrate --force
php artisan db:seed --force
php artisan db:seed --class=TestDevUsersSeeder
- name: Start Laravel API and wait for readiness
run: |
cd gateway-api
php artisan serve --host=0.0.0.0 --port=8000 > laravel.log 2>&1 &
echo "Waiting for Laravel to start..."
for i in {1..20}; do
if curl -s http://127.0.0.1:8000 >/dev/null; then
echo "✅ Laravel is up and running!"
break
fi
echo "Waiting for Laravel... attempt $i"
sleep 3
done
tail -n 20 laravel.log
php artisan queue:work --daemon > queue.log 2>&1 &
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache Node modules
uses: actions/cache@v4
with:
path: |
node_modules
~/.npm
key: e2e-node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
e2e-node-modules-${{ runner.os }}-
- name: Install Node deps
run: npm install
- name: Build Next.js
run: npm run build
- name: Start Next.js
run: |
nohup npm start > next.log 2>&1 &
sleep 10
- name: Cache Cypress
uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: e2e-cypress-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
e2e-cypress-${{ runner.os }}-
- name: Run Cypress Tests
uses: cypress-io/github-action@v6
with:
browser: chrome
headless: true
# - name: Upload Cypress video
# uses: actions/upload-artifact@v4
# if: always()
# with:
# name: cypress-video
# path: cypress/videos