-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (87 loc) · 2.96 KB
/
Copy pathe2e.yml
File metadata and controls
96 lines (87 loc) · 2.96 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
name: End-to-end Tests
on: [push]
jobs:
tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./website
steps:
- uses: actions/checkout@v7.0.0
- uses: actions/setup-node@v6.4.0
with:
node-version: lts/*
- name: Cache .npm
uses: actions/cache@v6
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('lapis-e2e/**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Docker metadata
id: dockerMetadata
uses: docker/metadata-action@v6.2.0
with:
images: "dummyImageName"
tags: |
type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
- name: Get Branch Tag
id: branchTag
env:
TAG: ${{ steps.dockerMetadata.outputs.tags }}
run: echo "branchTag=${TAG##*:}" >> $GITHUB_OUTPUT
- name: Wait for website Docker image
uses: lewagon/wait-on-check-action@v1.8.1
with:
ref: ${{ github.sha }}
check-name: Build Website Docker Image
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
- name: Wait for backend Docker image
uses: lewagon/wait-on-check-action@v1.8.1
with:
ref: ${{ github.sha }}
check-name: Build Backend Docker Image
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 5
- name: Start Docker Containers
run: docker compose -f ../docker-compose.yml up -d --wait
env:
WEBSITE_TAG: ${{ steps.branchTag.outputs.branchTag }}
BACKEND_TAG: ${{ steps.branchTag.outputs.branchTag }}
SEEDER_TAG: ${{ steps.branchTag.outputs.branchTag }}
- name: Run Playwright tests (all browsers)
if: github.ref == 'refs/heads/main'
run: npm run e2e
env:
BACKEND_URL: http://localhost:9021
- name: Run Playwright tests (chromium only)
if: github.ref != 'refs/heads/main'
run: npm run e2e:chromium
env:
BACKEND_URL: http://localhost:9021
- name: Collect container logs
if: ${{ always() && !cancelled() }}
run: |
mkdir -p /tmp/container-logs
services="$(docker compose -f ../docker-compose.yml config --services || true)"
for service in $services; do
docker compose -f ../docker-compose.yml logs --no-color "$service" > "/tmp/container-logs/${service}.log" || true
done
- name: Upload container logs
uses: actions/upload-artifact@v7
if: ${{ always() && !cancelled() }}
with:
name: container-logs
path: /tmp/container-logs/
retention-days: 7
- name: Upload Playwright report
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: playwright-report
path: website/playwright-report/
retention-days: 30