forked from Tampere/vuorovaikutusalusta
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (71 loc) · 2.05 KB
/
pr-test.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
##
# Runs builds and e2e tests
##
name: Test builds
on:
pull_request:
jobs:
test-client:
runs-on: ubuntu-latest
defaults:
run:
working-directory: client
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
test-server:
runs-on: ubuntu-latest
defaults:
run:
working-directory: server
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
test-e2e:
name: Test E2E
runs-on: ubuntu-latest
defaults:
run:
working-directory: e2e
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: ./e2e/package-lock.json
- run: npm i
- name: Get installed Playwright version
id: playwright-version
run: echo "version=$(npm ls @playwright/test --json | jq --raw-output '.dependencies["@playwright/test"].version')" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}
restore-keys: |
${{ runner.os }}-playwright-
# Install Playwright dependencies unless found from the cache
- name: Install Playwright's dependencies
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
# Start up the stack & wait for all services to be healthy
- run: CI=1 docker compose up -d --wait
timeout-minutes: 10
# Output container logs if any of the previous steps failed
- run: docker compose logs
if: failure()
# Execute the E2E tests
- run: npm test