--- name: E2E Tests on: # For PRs, this workflow gets triggered from the Argo Events platform. # Check the following repo for details: https://github.com/mattermost/delivery-platform workflow_dispatch: inputs: ref: type: string description: Git ref to test. Must be a full commit SHA for PR testing, and a tag for release testing. Ignored for daily tests. required: false PR_NUMBER: type: string description: PR number (if applicable) required: false ROLLING_RELEASE_FROM_TAG: type: string description: Mattermost release git tag for RollingRelease tests. Optional. required: false MM_ENV: type: string required: false description: A comma-separated list of environment variables to set for the server. Spaces are not supported. MM_SERVICE_OVERRIDES: type: string required: false description: A comma-separated list of service overrides. E.g. "-elasticsearch,+opensearch" REPORT_TYPE: type: choice description: The context this report is being generated in options: - PR - RELEASE - RELEASE_CLOUD - MASTER - MASTER_UNSTABLE - CLOUD - CLOUD_UNSTABLE - NONE default: NONE RUN_CYPRESS: type: string description: Enable Cypress run default: "true" RUN_PLAYWRIGHT: type: string description: Enable Playwright run default: "true" concurrency: group: "${{ github.workflow }}-${{ inputs.REPORT_TYPE }}-${{ inputs.PR_NUMBER || inputs.ref }}-${{ inputs.MM_ENV }}" cancel-in-progress: true jobs: generate-test-variables: runs-on: ubuntu-latest permissions: issues: write pull-requests: write defaults: run: shell: bash outputs: commit_sha: "${{ steps.generate.outputs.commit_sha }}" BRANCH: "${{ steps.generate.outputs.BRANCH }}" SERVER_IMAGE: "${{ steps.generate.outputs.SERVER_IMAGE }}" status_check_context: "${{ steps.generate.outputs.status_check_context }}" workers_number: "${{ steps.generate.outputs.workers_number }}" server_uppercase: "${{ steps.generate.outputs.server_uppercase }}" # Required for license selection SERVER: "${{ steps.generate.outputs.SERVER }}" ENABLED_DOCKER_SERVICES: "${{ steps.generate.outputs.ENABLED_DOCKER_SERVICES }}" TEST_FILTER_CYPRESS: "${{ steps.generate.outputs.TEST_FILTER_CYPRESS }}" TEST_FILTER_PLAYWRIGHT: "tests/ --project=chrome" # Note: Run on chrome but eventually will enable to all projects which include firefox and ipad. BUILD_ID: "${{ steps.generate.outputs.BUILD_ID }}" TM4J_ENABLE: "${{ steps.generate.outputs.TM4J_ENABLE }}" REPORT_TYPE: "${{ steps.generate.outputs.REPORT_TYPE }}" TESTCASE_FAILURE_FATAL: "${{ steps.generate.outputs.TESTCASE_FAILURE_FATAL }}" ROLLING_RELEASE_commit_sha: "${{ steps.generate.outputs.ROLLING_RELEASE_commit_sha }}" ROLLING_RELEASE_SERVER_IMAGE: "${{ steps.generate.outputs.ROLLING_RELEASE_SERVER_IMAGE }}" WORKFLOW_RUN_URL: "${{steps.generate.outputs.WORKFLOW_RUN_URL}}" CYCLE_URL: "${{steps.generate.outputs.CYCLE_URL}}" env: GH_TOKEN: "${{ github.token }}" REF: "${{ inputs.ref || github.sha }}" PR_NUMBER: "${{ inputs.PR_NUMBER || '' }}" REPORT_TYPE: "${{ inputs.REPORT_TYPE }}" ROLLING_RELEASE_FROM_TAG: "${{ inputs.ROLLING_RELEASE_FROM_TAG }}" AUTOMATION_DASHBOARD_URL: "${{ secrets.MM_E2E_AUTOMATION_DASHBOARD_URL }}" # We could exclude the @smoke group for PRs, but then we wouldn't have it in the report TEST_FILTER_CYPRESS_PR: >- --stage="@prod" --excludeGroup="@te_only,@cloud_only,@high_availability" --sortFirst="@compliance_export,@elasticsearch,@ldap_group,@ldap" --sortLast="@saml,@keycloak,@plugin,@plugins_uninstall,@mfa,@license_removal" TEST_FILTER_CYPRESS_PROD_ONPREM: >- --stage="@prod" --excludeGroup="@te_only,@cloud_only,@high_availability" --sortFirst="@compliance_export,@elasticsearch,@ldap_group,@ldap,@playbooks" --sortLast="@saml,@keycloak,@plugin,@plugins_uninstall,@mfa,@license_removal" TEST_FILTER_CYPRESS_PROD_CLOUD: >- --stage="@prod" --excludeGroup="@not_cloud,@cloud_trial,@e20_only,@te_only,@high_availability,@license_removal" --sortFirst="@compliance_export,@elasticsearch,@ldap_group,@ldap,@playbooks" --sortLast="@saml,@keycloak,@plugin,@plugins_uninstall,@mfa" MM_ENV: "${{ inputs.MM_ENV || '' }}" MM_SERVICE_OVERRIDES: "${{ inputs.MM_SERVICE_OVERRIDES }}" steps: - name: ci/checkout-repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: ref: "${{ inputs.ref || github.sha }}" fetch-depth: 0 - name: ci/generate-test-variables id: generate run: | MM_ENV_HASH=$(md5sum -z <<<"$MM_ENV" | cut -c-8) TESTCASE_FAILURE_FATAL="true" if grep -q CLOUD <<<"$REPORT_TYPE"; then SERVER=cloud else SERVER=onprem fi case "$REPORT_TYPE" in NONE | PR) ### Populate support variables _COMMIT_SHA_COMPUTED=$(git rev-parse --verify "$REF") # NB: not actually used for resolving the commit; it's only to double check the value of 'inputs.ref' ### For image tag generation: utilize 'inputs.ref', assume that it is a full commit SHA COMMIT_SHA="${REF}" BRANCH="server-pr-${PR_NUMBER}" # For reference, the real branch name may be retrievable with command: 'jq -r .head.ref > $GITHUB_OUTPUT echo "BRANCH=${BRANCH}" >> $GITHUB_OUTPUT echo "SERVER_IMAGE=${SERVER_IMAGE_ORG}/mattermost-enterprise-edition:${SERVER_IMAGE_TAG}" >> $GITHUB_OUTPUT echo "SERVER=${SERVER}" >> $GITHUB_OUTPUT echo "server_uppercase=${SERVER@U}" >> $GITHUB_OUTPUT echo "ENABLED_DOCKER_SERVICES=${ENABLED_DOCKER_SERVICES}" >> $GITHUB_OUTPUT echo "status_check_context=E2E Tests/test${BUILD_ID_SUFFIX_IN_STATUS_CHECK:+-$BUILD_ID_SUFFIX}${MM_ENV:+/$MM_ENV_HASH}" >> $GITHUB_OUTPUT echo "workers_number=${WORKERS_NUMBER}" >> $GITHUB_OUTPUT echo "TEST_FILTER_CYPRESS=${TEST_FILTER_CYPRESS}" >> $GITHUB_OUTPUT echo "TESTCASE_FAILURE_FATAL=${TESTCASE_FAILURE_FATAL}" >> $GITHUB_OUTPUT echo "TM4J_ENABLE=${TM4J_ENABLE:-}" >> $GITHUB_OUTPUT echo "REPORT_TYPE=${COMPUTED_REPORT_TYPE}" >> $GITHUB_OUTPUT echo "ROLLING_RELEASE_commit_sha=${ROLLING_RELEASE_COMMIT_SHA}" >> $GITHUB_OUTPUT echo "ROLLING_RELEASE_SERVER_IMAGE=${ROLLING_RELEASE_SERVER_IMAGE}" >> $GITHUB_OUTPUT echo "BUILD_ID=${BUILD_ID}" >> $GITHUB_OUTPUT # User notification variables echo "WORKFLOW_RUN_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{github.run_id}}" >> $GITHUB_OUTPUT echo "CYCLE_URL=${AUTOMATION_DASHBOARD_URL%%/api}/cycle/${BUILD_ID}" >> $GITHUB_OUTPUT - name: ci/notify-user env: COMMIT_SHA: "${{steps.generate.outputs.commit_sha}}" STATUS_CHECK_CONTEXT: "${{steps.generate.outputs.status_check_context}}" WORKFLOW_RUN_URL: "${{steps.generate.outputs.WORKFLOW_RUN_URL}}" CYCLE_URL: "${{steps.generate.outputs.CYCLE_URL}}" RUN_CYPRESS: "${{inputs.RUN_CYPRESS == 'true' || ''}}" RUN_PLAYWRIGHT: "${{inputs.RUN_PLAYWRIGHT == 'true' || ''}}" run: | if [ -n "$PR_NUMBER" ]; then gh issue -R "${{ github.repository }}" comment "$PR_NUMBER" --body-file - <