-
Notifications
You must be signed in to change notification settings - Fork 175
115 lines (95 loc) · 3.24 KB
/
Copy pathe2e.yml
File metadata and controls
115 lines (95 loc) · 3.24 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
name: E2E Tests
permissions:
contents: read
issues: write
pull-requests: write
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
jobs:
e2e:
runs-on: ubuntu-latest
strategy:
matrix:
suite: [vitest, cypress]
env:
BUILDX_CACHE_SCOPE: ${{ matrix.suite }}-build
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c
with:
install: true
- name: Expose GitHub Runtime for Docker Cache
uses: crazy-max/ghaction-github-runtime@04d248b84655b509d8c44dc1d6f990c879747487 # v4.0.0
- name: Set up Docker Compose
uses: docker/setup-compose-action@3408803818f5b5065308cdf3293ecbddf1ab2fac
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Configure Git for CI
run: |
git config --global user.name "CI Runner"
git config --global user.email "ci@example.com"
git config --global init.defaultBranch main
- name: Build and start services with Docker Compose
run: docker compose -f docker-compose.yml -f docker-compose.ci.yml up -d --build --wait
- name: Debug service state
if: failure()
run: |
docker compose ps
docker compose logs
- name: Run vitest E2E tests
if: matrix.suite == 'vitest'
run: npm run test:e2e
- name: Run Cypress E2E tests
if: matrix.suite == 'cypress'
run: npm run cypress:run:docker
timeout-minutes: 10
env:
CYPRESS_BASE_URL: http://localhost:8081
CYPRESS_API_BASE_URL: http://localhost:8081
CYPRESS_GIT_PROXY_URL: http://localhost:8000
CYPRESS_GIT_SERVER_TARGET: git-server:8443
- name: Dump git-proxy logs on failure
if: failure()
run: docker compose logs git-proxy --tail=100
- name: Upload Cypress screenshots on failure
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
if: failure() && matrix.suite == 'cypress'
with:
name: cypress-screenshots
path: cypress/screenshots
retention-days: 7
- name: Stop services
if: always()
run: docker compose down -v
results:
if: ${{ always() }}
runs-on: ubuntu-latest
name: e2e
needs: [e2e]
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
with:
egress-policy: audit
- name: Check e2e results
run: |
result="${{ needs.e2e.result }}"
if [[ "$result" == "success" || "$result" == "skipped" ]]; then
exit 0
else
exit 1
fi