Skip to content

dhis2: e2e tests triggered by core #36

dhis2: e2e tests triggered by core

dhis2: e2e tests triggered by core #36

name: 'dhis2: e2e tests triggered by core'
on:
workflow_dispatch:
inputs:
dhis2_version:
description: 'DHIS2 core version'
required: true
instance_url:
description: 'Instance URL'
required: true
jobs:
setup-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.specs }}
steps:
- uses: actions/checkout@v3
- name: Generate Test Matrix
id: set-matrix
run: |
echo "Generating Test Matrix"
echo "::set-output name=specs::$(node cypress/support/generateTestMatrix.js)"
- name: Debug spec-group
run: |
echo "Matrix output: ${{ steps.set-matrix.outputs.specs }}"
e2e-tests:
runs-on: ubuntu-latest
if: "!github.event.push.repository.fork && github.actor != 'dependabot[bot]'"
needs: setup-matrix
strategy:
fail-fast: false
matrix:
spec-group: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
env:
SHOULD_RECORD: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record') }}
CI_BUILD_ID: ${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 14.x
cache: 'yarn'
- name: Set Cypress Record Environment Variables
if: env.SHOULD_RECORD == 'true'
run: |
echo "CYPRESS_GROUP=e2e-${{ matrix.spec-group.id }}" >> $GITHUB_ENV
echo "CYPRESS_TAG=${{ github.event_name }}" >> $GITHUB_ENV
echo "CYPRESS_CI_BUILD_ID=${{ github.run_id }}" >> $GITHUB_ENV
- name: Debug Environment Variables
run: |
echo "SHOULD_RECORD=${{ env.SHOULD_RECORD }}"
echo "CI Build ID=${{ env.CI_BUILD_ID }}"
echo "Computed Group=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_GROUP || '' }}"
echo "Computed Tag=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_TAG || '' }}"
echo "Computed CI Build ID=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_CI_BUILD_ID || '' }}"
echo "Spec=${{ join(matrix.spec-group.tests, ',') }}"
- name: End-to-End tests
uses: cypress-io/github-action@v6
with:
config: baseUrl=${{ github.event.inputs.instance_url }}/dhis-web-dataentry/index.action
browser: chrome
wait-on: ${{ github.event.inputs.instance_url }}
wait-on-timeout: 300
record: ${{ env.SHOULD_RECORD }}
parallel: ${{ env.SHOULD_RECORD }}
group: ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_GROUP || '' }}
tag: ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_TAG || '' }}
ci-build-id: ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_CI_BUILD_ID || '' }}
spec: ${{ join(matrix.spec-group.tests, ',') }}
env:
BROWSER: none
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_dhis2BaseUrl: ${{ github.event.inputs.instance_url }}/dhis-web-dataentry/index.action
CYPRESS_dhis2ApiVersion: ${{ github.event.inputs.dhis2_version }}
REPORTPORTAL_API_KEY: ${{ secrets.REPORTPORTAL_API_KEY }}
REPORTPORTAL_ENDPOINT: ${{ vars.REPORTPORTAL_ENDPOINT }}
REPORTPORTAL_PROJECT: ${{ vars.REPORTPORTAL_PROJECT }}