Upload E2E Test Results to Trunk (Hourly) #38561
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: Upload E2E Test Results to Trunk (Hourly) | |
on: | |
schedule: | |
- cron: "*/10 * * * *" | |
workflow_dispatch: {} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
e2e-matrix-builder: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 5 | |
outputs: | |
matrix: ${{ steps.e2e-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Generate matrix for E2E tests | |
id: e2e-matrix | |
uses: ./.github/actions/build-e2e-matrix | |
env: | |
MB_EDITION: oss | |
build: | |
needs: [e2e-matrix-builder] | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 25 | |
strategy: | |
matrix: | |
edition: [ee, oss] | |
env: | |
MB_EDITION: oss | |
INTERACTIVE: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Prepare front-end environment | |
uses: ./.github/actions/prepare-frontend | |
- name: Prepare back-end environment | |
uses: ./.github/actions/prepare-backend | |
with: | |
m2-cache-key: e2e-tests | |
- name: Build uberjar with ./bin/build.sh | |
run: ./bin/build.sh | |
- name: Prepare uberjar artifact | |
uses: ./.github/actions/prepare-uberjar-artifact | |
with: | |
name: metabase-${{ matrix.edition }}-${{ github.event.pull_request.head.sha || github.sha }}-uberjar | |
e2e-tests: | |
needs: [build, e2e-matrix-builder] | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 90 | |
name: e2e-tests-${{ matrix.name }}-${{ matrix.edition }} | |
env: | |
MB_EDITION: oss | |
DISPLAY: "" | |
QA_DB_ENABLED: true | |
# Any env starting with `CYPRESS_` will be available to all Cypress tests via `Cypress.env()` | |
# Example: you can get `CYPRESS_FOO` with `Cypress.env("FOO")` | |
# CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }} | |
# CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }} | |
# Record runs using Deploysentinel except for the release branch | |
CYPRESS_DEPLOYSENTINEL_KEY: ${{ !(startsWith(github.event.pull_request.base.ref, 'release')) && secrets.CYPRESS_DEPLOYSENTINEL_KEY || '' }} | |
MB_SNOWPLOW_AVAILABLE: true | |
MB_SNOWPLOW_URL: "http://localhost:9090" # Snowplow micro | |
ELECTRON_EXTRA_LAUNCH_ARGS: "--remote-debugging-port=40500" # deploysentinel | |
TERM: xterm | |
TZ: US/Pacific # to make node match the instance tz | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.e2e-matrix-builder.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Prepare Docker containers | |
uses: ./.github/actions/e2e-prepare-containers | |
with: | |
maildev: true | |
openldap: ${{ startsWith(matrix.name, 'admin') }} | |
postgres: ${{ matrix.name != 'mongo'}} | |
mysql: ${{ matrix.name != 'mongo'}} | |
mongo: ${{ matrix.name == 'mongo'}} | |
- name: Retrieve uberjar artifact for ${{ matrix.edition }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: metabase-${{ matrix.edition }}-${{ github.event.pull_request.head.sha || github.sha }}-uberjar | |
- name: Get the version info | |
run: | | |
jar xf target/uberjar/metabase.jar version.properties | |
mv version.properties resources/ | |
- name: Prepare front-end environment | |
uses: ./.github/actions/prepare-frontend | |
- name: Prepare JDK ${{ matrix.java-version }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java-version }} | |
distribution: "temurin" | |
- name: Prepare Cypress environment | |
id: cypress-prep | |
uses: ./.github/actions/prepare-cypress | |
- name: Run Snowplow micro | |
uses: ./.github/actions/run-snowplow-micro | |
- run: mkdir -p cypress/reports/mochareports | |
- name: Run OSS-specific Cypress tests | |
if: matrix.edition == 'oss' | |
run: | | |
yarn run test-cypress-run \ | |
--env grepTags=@OSS,grepOmitFiltered=true \ | |
--spec './e2e/test/scenarios/**/*.cy.spec.js' \ | |
--browser ${{ steps.cypress-prep.outputs.chrome-path }} | |
continue-on-error: true | |
- run: ls -l ./cypress/reports/mochareports/ | |
- name: Upload results | |
if: "!cancelled()" | |
uses: trunk-io/analytics-uploader@main | |
with: | |
junit-paths: cypress/reports/**/*junit*.xml | |
org-slug: trunk-staging-org | |
token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }} | |
env: | |
TRUNK_LOG: info | |
TRUNK_API_ADDRESS: https://api.trunk-staging.io:5022 | |
continue-on-error: true | |
- name: Run slow and resource-intensive Cypress tests | |
run: | | |
yarn run test-cypress-run \ | |
--env grepTags="@slow",grepOmitFiltered=true \ | |
--spec './e2e/test/scenarios/**/*.cy.spec.js' \ | |
--browser ${{ steps.cypress-prep.outputs.chrome-path }} | |
continue-on-error: true | |
- run: ls -l ./cypress/reports/mochareports/ | |
- name: Upload results | |
if: "!cancelled()" | |
uses: trunk-io/analytics-uploader@main | |
with: | |
junit-paths: cypress/reports/**/*junit*.xml | |
org-slug: trunk-staging-org | |
token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }} | |
env: | |
TRUNK_LOG: info | |
TRUNK_API_ADDRESS: https://api.trunk-staging.io:5022 | |
continue-on-error: true | |
- name: Run Flaky Cypress tests | |
run: | | |
yarn run test-cypress-run \ | |
--env grepTags="@flaky",grepOmitFiltered=true \ | |
--spec './e2e/test/scenarios/**/*.cy.spec.js' \ | |
--browser ${{ steps.cypress-prep.outputs.chrome-path }} | |
continue-on-error: true | |
- run: ls -l ./cypress/reports/mochareports/ | |
- name: Upload results | |
if: "!cancelled()" | |
uses: trunk-io/analytics-uploader@main | |
with: | |
junit-paths: cypress/reports/**/*junit*.xml | |
org-slug: trunk-staging-org | |
token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }} | |
env: | |
TRUNK_LOG: info | |
TRUNK_API_ADDRESS: https://api.trunk-staging.io:5022 | |
continue-on-error: true | |
- name: Run EE Cypress tests on ${{ matrix.name }} | |
if: matrix.context == 'folder' | |
run: | | |
yarn run test-cypress-run \ | |
--env grepTags="-@slow+-@mongo+-@flaky --@quarantine",grepOmitFiltered=true \ | |
--folder ${{ matrix.name }} \ | |
--browser ${{ steps.cypress-prep.outputs.chrome-path }} | |
continue-on-error: true | |
- run: ls -l ./cypress/reports/mochareports/ | |
- name: Upload results | |
if: "!cancelled()" | |
uses: trunk-io/analytics-uploader@main | |
with: | |
junit-paths: cypress/reports/**/*junit*.xml | |
org-slug: trunk-staging-org | |
token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }} | |
env: | |
TRUNK_LOG: info | |
TRUNK_API_ADDRESS: https://api.trunk-staging.io:5022 | |
continue-on-error: true | |
- name: Run E2E tests that depend on Mongo | |
if: matrix.name == 'mongo' | |
run: | | |
yarn run test-cypress-run \ | |
--env grepTags="@mongo --@quarantine",grepOmitFiltered=true \ | |
--spec './e2e/test/scenarios/**/*.cy.spec.js' \ | |
--browser ${{ steps.cypress-prep.outputs.chrome-path }} | |
env: | |
CYPRESS_QA_DB_MONGO: true | |
continue-on-error: true | |
- name: Upload results | |
if: "!cancelled()" | |
uses: trunk-io/analytics-uploader@main | |
with: | |
junit-paths: cypress/reports/**/*junit*.xml | |
org-slug: trunk-staging-org | |
token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }} | |
env: | |
TRUNK_LOG: info | |
TRUNK_API_ADDRESS: https://api.trunk-staging.io:5022 | |
continue-on-error: true | |
- name: Upload results | |
if: "!cancelled()" | |
uses: trunk-io/analytics-uploader@main | |
with: | |
junit-paths: cypress/reports/**/*junit*.xml | |
org-slug: trunk-staging-org | |
token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }} | |
tags: tests=e2e | |
env: | |
TRUNK_LOG: info | |
TRUNK_API_ADDRESS: https://api.trunk-staging.io:5022 | |
continue-on-error: true |