[MM-61122] Add diagnostics data to the Support Packet #690
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: E2E Testing | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
env: | |
COMPOSE_PROJECT_NAME: "${{ github.run_id }}_playwright_1" | |
# Control testing parallelism | |
PARALLELISM: 10 | |
jobs: | |
build-mattermost-plugin-calls: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: e2e/checkout-mattermost-plugin-calls-repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: e2e/setup-go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: e2e/setup-node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
cache-dependency-path: webapp/package-lock.json | |
- name: e2e/build-mattermost-plugin-calls | |
env: | |
MM_SERVICESETTINGS_ENABLEDEVELOPER: 1 | |
run: make dist | |
- name: e2e/persist-mattermost-plugin-calls-package | |
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 | |
with: | |
name: mattermost-plugin-calls-package | |
path: ${{ github.workspace }}/dist/*.tar.gz | |
if-no-files-found: error | |
compression-level: 0 | |
retention-days: 1 | |
generate-matrix: | |
runs-on: ubuntu-22.04 | |
outputs: | |
parallelism-matrix: ${{ steps.calculation.outputs.PARALLELISM }} | |
parallelism: ${{ env.PARALLELISM }} | |
steps: | |
- name: e2e/generate-e2e-matrix | |
id: calculation | |
run: | | |
RANGE=$(( ${{ env.PARALLELISM }}+1 )) | |
echo PARALLELISM=$(jq -n "{ run_id: [range(1;${RANGE})]}") > ${GITHUB_OUTPUT} | |
e2e-playwright-test: | |
runs-on: ubuntu-22.04 | |
needs: | |
- build-mattermost-plugin-calls | |
- generate-matrix | |
env: | |
COMPOSE_PROJECT_NAME: playwright_tests | |
DOCKER_NETWORK: playwright_tests | |
CONTAINER_SERVER: playwright_tests_server | |
IMAGE_CALLS_OFFLOADER: mattermost/calls-offloader:v0.8.0 | |
IMAGE_CALLS_RECORDER: mattermost/calls-recorder:v0.7.6 | |
IMAGE_CALLS_TRANSCRIBER: mattermost/calls-transcriber:v0.5.0 | |
IMAGE_SERVER: mattermostdevelopment/mattermost-enterprise-edition:master | |
IMAGE_CURL: curlimages/curl:8.7.1 | |
CI_NODE_INDEX: ${{ matrix.run_id }} | |
CI_NODE_TOTAL: ${{ needs.generate-matrix.outputs.parallelism }} | |
strategy: | |
matrix: ${{ fromJson(needs.generate-matrix.outputs.parallelism-matrix) }} | |
steps: | |
- name: e2e/checkout-mattermost-plugin-calls-repo | |
uses: actions/checkout@v4 | |
- name: e2e/checkout-mattermost-repo | |
uses: actions/checkout@v4 | |
with: | |
repository: mattermost/mattermost | |
path: mattermost | |
- name: e2e/setup-docker-buildx | |
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 | |
- name: e2e/setup-go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: mattermost/server/go.mod | |
- name: e2e/generate-configuration | |
working-directory: ./mattermost/server/scripts/config_generator | |
env: | |
OUTPUT_CONFIG: ${{ github.workspace }}/config/config.json | |
run: | | |
mkdir -p ${{ github.workspace }}/config | |
go run main.go | |
- name: e2e/patch-generated-configuration | |
env: | |
OUTPUT_CONFIG: ${{ github.workspace }}/config/config.json | |
run: | | |
cp ${OUTPUT_CONFIG} ${OUTPUT_CONFIG}.orig | |
jq -f ${{ github.workspace }}/e2e/overlay-config.jq ${OUTPUT_CONFIG}.orig > ${OUTPUT_CONFIG} | |
diff ${OUTPUT_CONFIG}.orig ${OUTPUT_CONFIG} || true | |
- name: e2e/download-mattermost-plugin-calls-package | |
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 | |
with: | |
name: mattermost-plugin-calls-package | |
path: dist | |
- name: e2e/docker-login | |
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 | |
# Do not authenticate on Forks | |
if: "! github.event.pull_request.head.repo.fork" | |
with: | |
username: ${{ secrets.DOCKERHUB_DEV_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_DEV_TOKEN }} | |
- name: e2e/prepare-server | |
env: | |
DOCKER_CLIENT_TIMEOUT: 120 | |
COMPOSE_HTTP_TIMEOUT: 120 | |
DOCKER_COMPOSE_FILE: ${{ github.workspace }}/e2e/docker/docker-compose.yaml | |
run: | | |
mkdir -p ${{ github.workspace }}/logs | |
mkdir -p ${{ github.workspace }}/config | |
mkdir -p ${{ github.workspace }}/dotenv | |
## Navigate to mattermost server build folder to spawn the environment | |
cd mattermost/server/build/ | |
${{ github.workspace }}/e2e/scripts/prepare-server.sh | |
cd - | |
## Add extra environment variables for mattermost server | |
echo "MM_LICENSE=${{ secrets.MM_PLUGIN_CALLS_TEST_LICENSE }}" >> dotenv/app.private.env | |
echo "MM_FEATUREFLAGS_BoardsProduct=true" >> dotenv/app.private.env | |
echo "MM_SERVICEENVIRONMENT=test" >> dotenv/app.private.env | |
echo "MM_CALLS_JOB_SERVICE_URL=http://calls-offloader:4545" >> dotenv/app.private.env | |
sudo chown -R 2000:2000 ${{ github.workspace }}/logs | |
sudo chown -R 2000:2000 ${{ github.workspace }}/config | |
# Spawn mattermost server | |
echo "Spawning mattermost server ... " | |
docker run -d --quiet --name ${CONTAINER_SERVER} \ | |
--net ${DOCKER_NETWORK} \ | |
--net-alias mm-server \ | |
--user mattermost:mattermost \ | |
--env-file="${{ github.workspace }}/dotenv/app.private.env" \ | |
-v ${{ github.workspace }}/config:/mattermost/config:rw \ | |
-v ${{ github.workspace }}/logs:/mattermost/logs:rw \ | |
${IMAGE_SERVER} \ | |
sh -c "/mattermost/bin/mattermost server" | |
- name: e2e/build-e2e-image | |
working-directory: e2e | |
run: | | |
echo "Building playwright test image ... " | |
cp ${{ github.workspace }}/plugin.json plugin.json | |
docker build --quiet -t mm-playwright -f Playwright.Dockerfile . | |
- name: e2e/test | |
id: test | |
run: | | |
mkdir -p ${{ github.workspace }}/results | |
${{ github.workspace }}/e2e/scripts/run.sh | |
## Check if we have an early failures in order to upload logs | |
NUM_FAILURES=0 | |
NUM_FAILURES=$((NUM_FAILURES + $(jq '.suites[].suites[].specs[].tests[] | last(.results[]) | select(.status != "passed").status' < ${{ github.workspace }}/results/pw-results-${{ matrix.run_id }}.json | wc -l))) | |
echo "FAILURES=${NUM_FAILURES}" >> ${GITHUB_OUTPUT} | |
sudo chown -R 1001:1001 ${{ github.workspace }}/logs | |
- name: e2e/persist-report-results | |
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 | |
with: | |
name: e2e-playwright-results-${{ matrix.run_id }} | |
path: ${{ github.workspace }}/results | |
compression-level: 0 | |
retention-days: 1 | |
- name: e2e/persist-report-logs | |
if: ${{ fromJson(steps.test.outputs.FAILURES) > 0 }} | |
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 | |
with: | |
name: e2e-playwright-logs-${{ matrix.run_id }} | |
path: ${{ github.workspace }}/logs | |
compression-level: 0 | |
retention-days: 5 |