Skip to content

Commit 6900045

Browse files
authored
Merge pull request #1490 from fabiovincenzi/ci/e2e-optimization
ci: optimize e2e workflow
2 parents fc085d4 + 1c45104 commit 6900045

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

.github/workflows/e2e.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,23 @@ on:
1414
jobs:
1515
e2e:
1616
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
suite: [vitest, cypress]
20+
env:
21+
BUILDX_CACHE_SCOPE: ${{ matrix.suite }}-build
1722

1823
steps:
1924
- name: Checkout code
2025
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2126

2227
- name: Set up Docker Buildx
2328
uses: docker/setup-buildx-action@d91f340399fb2345e3e45f5461e116862b08261d
29+
with:
30+
install: true
31+
32+
- name: Expose GitHub Runtime for Docker Cache
33+
uses: crazy-max/ghaction-github-runtime@3cb05d89e1f492524af3d41a1c98c83bc3025124 # v3
2434

2535
- name: Set up Docker Compose
2636
uses: docker/setup-compose-action@e29e0ecd235838be5f2e823f8f512a72dc55f662
@@ -41,18 +51,20 @@ jobs:
4151
git config --global init.defaultBranch main
4252
4353
- name: Build and start services with Docker Compose
44-
run: docker compose up -d --build --wait || true
54+
run: docker compose -f docker-compose.yml -f docker-compose.ci.yml up -d --build --wait
4555

4656
- name: Debug service state
47-
if: always()
57+
if: failure()
4858
run: |
4959
docker compose ps
5060
docker compose logs
5161
52-
- name: Run E2E tests
62+
- name: Run vitest E2E tests
63+
if: matrix.suite == 'vitest'
5364
run: npm run test:e2e
5465

5566
- name: Run Cypress E2E tests
67+
if: matrix.suite == 'cypress'
5668
run: npm run cypress:run:docker
5769
timeout-minutes: 10
5870
env:
@@ -67,7 +79,7 @@ jobs:
6779

6880
- name: Upload Cypress screenshots on failure
6981
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
70-
if: failure()
82+
if: failure() && matrix.suite == 'cypress'
7183
with:
7284
name: cypress-screenshots
7385
path: cypress/screenshots
@@ -76,3 +88,18 @@ jobs:
7688
- name: Stop services
7789
if: always()
7890
run: docker compose down -v
91+
92+
results:
93+
if: ${{ always() }}
94+
runs-on: ubuntu-latest
95+
name: e2e
96+
needs: [e2e]
97+
steps:
98+
- name: Check e2e results
99+
run: |
100+
result="${{ needs.e2e.result }}"
101+
if [[ "$result" == "success" || "$result" == "skipped" ]]; then
102+
exit 0
103+
else
104+
exit 1
105+
fi

docker-compose.ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
services:
2+
git-proxy:
3+
build:
4+
context: .
5+
cache_from:
6+
- type=gha
7+
cache_to:
8+
- type=gha,mode=max
9+
10+
git-server:
11+
build:
12+
context: localgit/
13+
cache_from:
14+
- type=gha
15+
cache_to:
16+
- type=gha,mode=max

0 commit comments

Comments
 (0)