forked from G-Research-Forks/git-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (87 loc) · 2.84 KB
/
e2e.yml
File metadata and controls
105 lines (87 loc) · 2.84 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
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: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d91f340399fb2345e3e45f5461e116862b08261d
with:
install: true
- name: Expose GitHub Runtime for Docker Cache
uses: crazy-max/ghaction-github-runtime@3cb05d89e1f492524af3d41a1c98c83bc3025124 # v3
- name: Set up Docker Compose
uses: docker/setup-compose-action@e29e0ecd235838be5f2e823f8f512a72dc55f662
- name: Set up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # 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@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # 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: Check e2e results
run: |
result="${{ needs.e2e.result }}"
if [[ "$result" == "success" || "$result" == "skipped" ]]; then
exit 0
else
exit 1
fi