-
Notifications
You must be signed in to change notification settings - Fork 26
96 lines (83 loc) · 2.61 KB
/
pull_request.workflow.yml
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: Pull request checks
on: [pull_request]
env:
NODE_VERSION: '20'
jobs:
lint:
name: Lint
runs-on: ubuntu-24.04
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Run linter
uses: ./.github/actions/lint
e2e-tests:
name: E2E Tests - ${{ matrix.group.name }}
needs: ['lint']
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
group:
- name: 'auth'
spec: 'e2e/cypress/integration/single-backend/{login,resetpassword,users,roles,profiles}.spec.js'
- name: 'views'
spec: 'e2e/cypress/integration/single-backend/{JSONEditor,chartView,formView,treeview}.spec.js'
- name: 'core'
spec: 'e2e/cypress/integration/single-backend/{404,api-actions,collections,docs,environments,indexes,search,watch}.spec.js'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Start Kuzzle
run: docker compose up --wait
- name: Cypress run
uses: cypress-io/github-action@v6
with:
build: npm run build
start: npm run preview
browser: chrome
spec: ${{ matrix.group.spec }}
# Add some retry attempts for potentially flaky tests
config: retries=2
# We don't need to install again since we did it above
install: false
# Add this to cache the build folder between runs
working-directory: .
- name: Upload screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-snapshots-${{ matrix.group.name }}
path: test/e2e/failed-test
retention-days: 5 # Limit retention to save space
# Add a summary job that depends on all tests
test-summary:
name: Tests Summary
needs: [lint, e2e-tests]
if: always()
runs-on: ubuntu-24.04
steps:
- name: Check test results
run: |
if [ "${{ needs.e2e-tests.result }}" = "failure" ]; then
echo "E2E tests failed"
exit 1
elif [ "${{ needs.lint.result }}" = "failure" ]; then
echo "Lint failed"
exit 1
else
echo "All tests passed!"
fi