Skip to content
name: 'e2e-prod'
# Requirements:
#
# - Customize environment variables:
# BASE_URL_INSTANCES: Set the base url for the instances, e.g. https://test.e2e.dhis2.org
# NAME_PATTERN_PROD_INSTANCES: Set the name pattern for your instances. {version} will be replaced by "[majorVersion].[minorVersion]"
#
# - Other optional customizations:
# containers: Set the matrix containers array for the e2e-prod job. The number of parallel Cypress instances running for each backend version will equal the array length.
#
# - Set status check as required:
# We recommend setting "e2e-tests-success" as a required step in your workflow.
on:
workflow_call:
inputs:
should_record:
required: false
type: boolean
default: false
spec-group:
required: false
type: string
secrets:
username:
required: true
password:
required: true
recordkey:
required: true
reportportal_api_key:
required: false
reportportal_endpoint:
required: false
reportportal_project:
required: false
env:
BASE_URL_INSTANCES: https://test.e2e.dhis2.org
NAME_PATTERN_PROD_INSTANCES: 'analytics-{version}'
concurrency:
group: e2e-prod-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
compute-prod-versions:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.prod-versions.outputs.versions }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Output prod version urls
id: prod-versions
uses: dhis2/action-supported-legacy-versions@v1
with:
instance-url-latest: https://test.e2e.dhis2.org/analytics-dev # can be removed if maxDHIS2Version has been specified
username: ${{ secrets.username }}
password: ${{ secrets.password }}
e2e-prod:
needs: compute-prod-versions
runs-on: ubuntu-latest
env:
CI_BUILD_ID: ${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
PR_TITLE: ${{ github.event.pull_request.title }}
DHIS2_VERSION: ${{ matrix.versions }}
strategy:
fail-fast: false
matrix:
versions: ${{ fromJSON(needs.compute-prod-versions.outputs.versions) }}
spec-group: ${{ fromJson(inputs.spec-group) }}
steps:

Check failure on line 81 in .github/workflows/analytics-e2e-tests-prod.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/analytics-e2e-tests-prod.yml

Invalid workflow file

You have an error in your yaml syntax on line 81
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
- run: |
echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV
- name: Compute prod instance url
id: instance-url
run: |
url="${BASE_URL_INSTANCES}/${NAME_PATTERN_PROD_INSTANCES/'{version}'/${{ matrix.versions }}}}"
echo "url=$url" >> $GITHUB_ENV
- name: Set Cypress Record Environment Variables
if: inputs.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=${{ inputs.should_record }}"
echo "CI Build ID=${{ github.run_id }}"
echo "Computed Group=${{ inputs.should_record == 'true' && 'e2e-' + matrix.spec-group.id || '' }}"
echo "Computed Tag=${{ inputs.should_record == 'true' && github.event_name || '' }}"
echo "Computed CI Build ID=${{ inputs.should_record == 'true' && github.run_id || '' }}"
echo "Spec=${{ join(matrix.spec-group.tests, ',') }}"
- name: Run e2e tests
uses: cypress-io/github-action@v2
with:
start: 'yarn d2-app-scripts start'
wait-on: 'http://localhost:3000'
wait-on-timeout: 300
record: ${{ inputs.should_record }}
parallel: ${{ inputs.should_record }}
browser: chrome
spec: ${{ join(matrix.spec-group.tests, ',') }}
group: ${{ inputs.should_record == 'true' && 'e2e-' + matrix.versions + '-' + matrix.spec-group.id || '' }}
tag: ${{ inputs.should_record == 'true' && github.event_name || '' }}
ci-build-id: ${{ inputs.should_record == 'true' && github.run_id || '' }}
env:
CI: true
BROWSER: none
CYPRESS_RECORD_KEY: ${{ secrets.recordkey }}
CYPRESS_dhis2BaseUrl: ${{ steps.instance-url.outputs.url }}
CYPRESS_dhis2InstanceVersion: ${{ matrix.versions }}
CYPRESS_dhis2Username: ${{ secrets.username }}
CYPRESS_dhis2Password: ${{ secrets.password }}
CYPRESS_networkMode: live
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPORTPORTAL_API_KEY: ${{ secrets.reportportal_api_key }}
REPORTPORTAL_ENDPOINT: ${{ secrets.reportportal_endpoint }}
REPORTPORTAL_PROJECT: ${{ secrets.reportportal_project }}
e2e-tests-success:
needs: e2e-prod
if: ${{ success() || failure() }}
runs-on: ubuntu-latest
steps:
- run: if [ $result != 'success' ]; then exit 1; fi;
env:
result: ${{ needs.e2e-prod.result }}