Skip to content

Commit

Permalink
Trying a new way of doing cypress jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
rolljee committed Nov 6, 2024
1 parent 89cb21e commit 87f1bec
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 3 deletions.
51 changes: 49 additions & 2 deletions .github/workflows/pull_request.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,33 @@ jobs:
uses: ./.github/actions/lint

e2e-tests:
name: E2E Cypress 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

Expand All @@ -40,10 +60,37 @@ jobs:
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
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
2 changes: 1 addition & 1 deletion .github/workflows/push_dev.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:

deploy-staging:
name: Deploy Admin Console to staging - next-console.kuzzle.io
needs: ['lint']
needs: ['e2e-tests']
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
Expand Down

0 comments on commit 87f1bec

Please sign in to comment.