-
-
Notifications
You must be signed in to change notification settings - Fork 694
118 lines (102 loc) · 3.27 KB
/
Copy pathe2e.yml
File metadata and controls
118 lines (102 loc) · 3.27 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
name: E2E Tests
on:
push:
branches: [main, develop]
paths:
- 'backend/**'
- 'frontend/**'
- 'e2e/**'
- 'docker/e2e/**'
- '.github/workflows/e2e.yml'
pull_request:
types: [opened, synchronize, reopened, labeled]
paths:
- 'backend/**'
- 'frontend/**'
- 'e2e/**'
- 'docker/e2e/**'
- '.github/workflows/e2e.yml'
schedule:
- cron: '0 3 * * *'
concurrency:
group: e2e-${{ github.ref }}
cancel-in-progress: true
jobs:
plan:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set.outputs.matrix }}
steps:
- id: set
env:
FULL: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'full-e2e') }}
run: |
if [ "$FULL" = "true" ]; then
echo 'matrix={"include":[{"name":"full-1","pw_args":"--shard=1/2"},{"name":"full-2","pw_args":"--shard=2/2"}]}' >> "$GITHUB_OUTPUT"
else
echo 'matrix={"include":[{"name":"smoke","pw_args":"--grep @smoke"}]}' >> "$GITHUB_OUTPUT"
fi
e2e:
needs: plan
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
env:
COMPOSE_FILE: docker/e2e/docker-compose.e2e.yml
E2E_IMAGE_TAG: ci
STRIPE_PUBLIC_KEY: ${{ secrets.STRIPE_TEST_PUBLIC_KEY }}
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_TEST_SECRET_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build backend image
uses: docker/build-push-action@v6
with:
context: ./backend
file: ./backend/Dockerfile
load: true
tags: hievents-e2e-backend:ci
cache-from: type=gha,scope=e2e-backend
cache-to: type=gha,scope=e2e-backend,mode=max
- name: Build frontend image
uses: docker/build-push-action@v6
with:
context: ./frontend
file: ./frontend/Dockerfile.ssr
load: true
tags: hievents-e2e-frontend:ci
cache-from: type=gha,scope=e2e-frontend
cache-to: type=gha,scope=e2e-frontend,mode=max
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: e2e/package-lock.json
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('e2e/package-lock.json') }}
- name: Run E2E suite
run: ./e2e/run-e2e.sh -- ${{ matrix.pw_args }}
- name: Collect stack logs on failure
if: failure()
run: docker compose -f "$COMPOSE_FILE" logs --no-color > e2e/compose-logs.txt
- name: Upload report and artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report-${{ matrix.name }}
path: |
e2e/playwright-report/
e2e/test-results/
e2e/compose-logs.txt
retention-days: 14
- name: Tear down the stack
if: always()
run: docker compose -f "$COMPOSE_FILE" down -v