CLD-7074 Implement full E2E tests on Github Actions (#26093)

* Move license setting from env var to mmctl upload
* Extract common E2E steps
* Add E2E fulltests
* Fix plugin_startup_fail_spec.js, timeout runners, fix local dashboard run
* Implement reporting script and job
* Bump artifact related actions
* Fix E2E variable generator script
* Skip reporting steps if not required
* Get rid of deprecation warnings
* Fix inbucket hostname parameter
* Support arbitrary refs in test template
* Fix cycle BRANCH var for non-PR commits
---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Mario Vitale
2024-03-06 11:27:53 +01:00
коммит произвёл GitHub
родитель c82352c90c
Коммит d7a77d8c42
12 изменённых файлов: 624 добавлений и 203 удалений

160
.github/workflows/e2e-tests-ci.yml поставляемый
Просмотреть файл

@@ -1,4 +1,5 @@
name: E2E Tests
---
name: E2E Smoketests
on:
# For PRs, this workflow gets triggered from the Argo Events platform.
# Check the following repo for details: https://github.com/mattermost/delivery-platform
@@ -9,155 +10,8 @@ on:
required: false
jobs:
update-initial-status:
runs-on: ubuntu-22.04
steps:
- uses: mattermost/actions/delivery/update-commit-status@main
env:
GITHUB_TOKEN: ${{ github.token }}
with:
repository_full_name: ${{ github.repository }}
commit_sha: ${{ inputs.commit_sha || github.sha }}
context: E2E Tests/smoketests
description: E2E tests for mattermost server app
status: pending
cypress-check:
runs-on: ubuntu-22.04
needs:
- update-initial-status
defaults:
run:
working-directory: e2e-tests/cypress
steps:
- name: ci/checkout-repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ inputs.commit_sha || github.sha }}
- name: ci/setup-node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
id: setup_node
with:
node-version-file: ".nvmrc"
cache: npm
cache-dependency-path: "e2e-tests/cypress/package-lock.json"
- name: ci/cypress/npm-install
run: |
npm ci
- name: ci/cypress/npm-check
run: |
npm run check
playwright-check:
runs-on: ubuntu-22.04
needs:
- update-initial-status
defaults:
run:
working-directory: e2e-tests/playwright
steps:
- name: ci/checkout-repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ inputs.commit_sha || github.sha }}
- name: ci/setup-node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
id: setup_node
with:
node-version-file: ".nvmrc"
cache: npm
cache-dependency-path: "e2e-tests/playwright/package-lock.json"
- name: ci/get-webapp-node-modules
working-directory: webapp
# requires build of client and types
run: |
make node_modules
- name: ci/playwright/npm-install
run: |
npm ci
- name: ci/playwright/npm-check
run: |
npm run check
smoketests:
strategy:
matrix:
#
# Note that smoketests should be run only on ubuntu, for QA purposes.
# But it's useful to be able to run and debug the smoketests for different OSes.
# Notes:
# - For MacOS: works on developer machines, but uses too many resources to be able to run on Github Actions
# - for Windows: cannot currently run on Github Actions, since the runners do not support running linux containers, at the moment
#
#os: [ubuntu-latest-8-cores, windows-2022, macos-12-xl]
os: [ubuntu-latest-8-cores]
runs-on: "${{ matrix.os }}"
needs:
- cypress-check
- playwright-check
defaults:
run:
shell: bash
working-directory: e2e-tests
steps:
- name: ci/checkout-repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ inputs.commit_sha || github.sha }}
- name: ci/setup-macos-docker
if: runner.os == 'macos'
# https://github.com/actions/runner-images/issues/17#issuecomment-1537238473
run: |
brew install docker docker-compose
colima start
mkdir -p ~/.docker/cli-plugins
ln -sfn /usr/local/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
- name: ci/e2e-smoketests
run: |
make
- name: ci/e2e-smoketests-store-results
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: e2e-smoketests-results-${{ matrix.os }}
path: |
e2e-tests/cypress/logs/
e2e-tests/cypress/results/
- name: ci/e2e-smoketests-assert-results
run: |
# Assert that the run contained 0 failures
CYPRESS_FAILURES=$(find cypress/results -name '*.json' | xargs -l jq -r '.stats.failures' | jq -s add)
echo "Cypress run completed with $CYPRESS_FAILURES failures"
[ "$CYPRESS_FAILURES" = "0" ]
update-failure-final-status:
runs-on: ubuntu-22.04
if: failure() || cancelled()
needs:
- smoketests
steps:
- uses: mattermost/actions/delivery/update-commit-status@main
env:
GITHUB_TOKEN: ${{ github.token }}
with:
repository_full_name: ${{ github.repository }}
commit_sha: ${{ inputs.commit_sha || github.sha }}
context: E2E Tests/smoketests
description: E2E tests for mattermost server app
status: failure
update-success-final-status:
runs-on: ubuntu-22.04
if: success()
needs:
- smoketests
steps:
- uses: mattermost/actions/delivery/update-commit-status@main
env:
GITHUB_TOKEN: ${{ github.token }}
with:
repository_full_name: ${{ github.repository }}
commit_sha: ${{ inputs.commit_sha || github.sha }}
context: E2E Tests/smoketests
description: E2E tests for mattermost server app
status: success
e2e-smoketest:
uses: ./.github/workflows/e2e-tests-ci-template.yml
with:
ref: "${{ inputs.commit_sha || github.sha }}"
status_check_context: "E2E Tests/smoketests"