Running Cypress e2e tests on Dev #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: run-e2e-dev | |
run-name: Running Cypress e2e tests on Dev | |
on: | |
workflow_dispatch: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
cypress-run: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Launch NucliaDB in docker | |
- run: | | |
docker pull nuclia/nucliadb:latest | |
docker build -t nucliadb-server . | |
docker run -p 8080:8080 \ | |
-v nucliadb-standalone:/data \ | |
-e NUCLIA_PUBLIC_URL="https://{zone}.gcp-global-dev-1.nuclia.io" \ | |
-e NUA_API_KEY=${{ secrets.NUA_KEY_DEV }} \ | |
-e NUA_ZONE=gcp-dev-1 \ | |
nucliadb-server & | |
# Install npm dependencies, cache them correctly and run all Cypress tests | |
- name: Cypress run | |
id: cypress | |
uses: cypress-io/github-action@v6 | |
with: | |
install-command: yarn install | |
env: | |
CYPRESS_BASE_URL: https://gcp-global-dev-1.nuclia.io | |
CYPRESS_BEARER_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN_DEV }} | |
CYPRESS_NUA_KEY: ${{ secrets.NUA_KEY_DEV }} | |
CYPRESS_USER_NAME: ${{ secrets.USER_NAME_DEV }} | |
CYPRESS_USER_PWD: ${{ secrets.USER_PWD_DEV }} | |
CYPRESS_RUNNING_ENV: dev | |
# after the test run completes store reports and any screenshots | |
- name: Cypress reports | |
id: report | |
uses: actions/upload-artifact@v4 | |
if: ${{ failure() && steps.cypress.conclusion == 'failure' }} | |
with: | |
name: cypress-reports | |
path: cypress/reports | |
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn` | |
- name: Slack notification | |
id: slack | |
uses: slackapi/[email protected] | |
if: ${{ failure() && steps.cypress.conclusion == 'failure' && github.ref_name == 'main' }} | |
with: | |
payload: | | |
{ | |
"text": "⚠️ Cypress E2E failed on Dev\nTriggered by ${{ github.triggering_actor }} \nRun #${{ github.run_number }}: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\nCypress report: ${{ steps.report.outputs.artifact-url }}" | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_HOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |