forked from isso-comments/isso
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (62 loc) · 2.37 KB
/
e2e-tests.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
name: E2E tests with docker
on:
pull_request:
paths:
- "isso/**"
- "package.json"
- "docker/**"
- "docker-compose.yml"
- "Dockerfile"
- ".github/workflows/e2e-tests.yml"
push:
paths:
- "isso/**"
- "package.json"
- "docker/**"
- "docker-compose.yml"
- "Dockerfile"
- ".github/workflows/e2e-tests.yml"
jobs:
test:
runs-on: ubuntu-latest
env:
TESTBED_IMAGE: "ghcr.io/isso-comments/isso-js-testbed:latest"
steps:
- uses: actions/checkout@v3
- name: Switch testbed image to ${{ env.TESTBED_IMAGE }}
# Just for faster CI runs, instead of re-building the image every time
# Especially useful to save the time+bandwidth to re-download puppeteer & chromium
run: |
sed -i "s|isso-js-testbed|${{ env.TESTBED_IMAGE }}|g" docker-compose.yml
# Also remove the `build`: section so image is pulled, not built
sed -i '/container_name: isso-client/{n;N;N;d}' docker-compose.yml
- name: Pull testbed from ${{ env.TESTBED_IMAGE }}
run: docker pull ${{ env.TESTBED_IMAGE }}
- name: Build the stack
run: docker compose build isso-server
- name: Bring up containers
run: docker compose up -d
- name: Client unit tests
run: make docker-js-unit
- name: Check if containers are up, sleep if not
shell: bash
run: '[ "$(docker inspect --format={{.State.Health.Status}} isso-server)" = "healthy" ] || sleep 5'
- name: Client integration tests
run: make docker-js-integration
- name: Compare screenshots
# Allow continuing to generate updated hashes in next step
id: compare-screenshots
continue-on-error: true
run: make docker-compare-screenshots
- name: Update screenshot hashes (if mismatched)
if: ${{ steps.compare-screenshots.outcome == 'failure' }}
run: make docker-update-screenshots
- name: Archive and upload updated screenshots & hashes
if: ${{ steps.compare-screenshots.outcome == 'failure' }}
uses: actions/upload-artifact@v3
with:
name: updated-screenshots-and-hashes
path: isso/js/tests/screenshots/reference/
- name: Fail if "Compare screenshots" step failed
if: ${{ steps.compare-screenshots.outcome == 'failure' }}
run: /bin/false