-
Notifications
You must be signed in to change notification settings - Fork 1
106 lines (101 loc) · 3.45 KB
/
test.yaml
File metadata and controls
106 lines (101 loc) · 3.45 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
name: test
# Actions for any push (PR) onto (into) to master
# -----------------
# Control variables (GitHub Secrets)
# -----------------
#
# At the GitHub 'organisation' or 'project' level you must have the following
# GitHub 'Repository Secrets' defined (i.e. via 'Settings -> Secrets'): -
#
# AUTH0_CLIENT_ID
# AUTH0_CLIENT_SECRET
# DMIT_USER_A_PASSWORD
# DMIT_USER_A_PASSWORD
#
# -----------
# Environment (GitHub Environments)
# -----------
#
# Environment (n/a)
on:
push:
jobs:
# check that both APIs are responding normally before running tests
check-api:
runs-on: ubuntu-latest
steps:
- name: Get DM Version
run: |
curl -f -X 'GET' \
'https://data-manager-test.xchem-dev.diamond.ac.uk/data-manager-api/version' \
-H 'accept: application/json'
- name: Get AS Version
run: |
curl -f -X 'GET' \
'https://account-server-test.xchem-dev.diamond.ac.uk/account-server-api/version' \
-H 'accept: application/json'
test:
needs: check-api # tests are skipped if APIs are down to avoid false negatives
# Setup
runs-on: ubuntu-latest
environment: data-manager-ui/test
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10.24.0
run_install: false
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 22.21.1
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- run: node -v
- name: Setup Playwright
run: pnpm exec playwright install --with-deps
- name: Load cached build for speed
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{
hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
# Test WITH base path set
- name: Build with base path
run: pnpm build
env:
BASE_PATH: "/data-manager-ui"
# Ok for tests/dev but we don't do this on prod. This is to prevent some flakely tests from causing problems
- name: Disable strict SSL
run: npm config set strict-ssl=false
- name: Test with base path
env:
AUTH0_CLIENT_ID: "${{ secrets.AUTH0_CLIENT_ID }}"
AUTH0_CLIENT_SECRET: "${{ secrets.AUTH0_CLIENT_SECRET }}"
DMIT_USER_A_PASSWORD: "${{ secrets.DMIT_USER_A_PASSWORD }}"
AUTH0_SECRET: "LONG_RANDOM_VALUE"
BASE_URL: "http://localhost:3000"
BASE_PATH: "/data-manager-ui"
DONT_USE_STANDALONE_OUTPUT: true
DANGEROUS__DISABLE_SSL_CERT_CHECK_IN_API_PROXY: 1
DATA_MANAGER_API_SERVER: "https://data-manager-test.xchem-dev.diamond.ac.uk/data-manager-api"
ACCOUNT_SERVER_API_SERVER: "https://account-server-test.xchem-dev.diamond.ac.uk\
/account-server-api"
KEYCLOAK_URL: "https://keycloak-test.xchem-dev.diamond.ac.uk/auth/realms/squonk"
PW_USERNAME: "dmit-user-a"
PW_PASSWORD: "${{ secrets.DMIT_USER_A_PASSWORD }}"
TEST_PORT: 3000
run: pnpm test:ci
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results
path: test-results