mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-28 04:35:04 -04:00
Workers no longer run `npm ci` — `node_modules` and framework binaries are restored from actions/cache populated once by a new `prep-deps` job. This closes the intermittent EEXIST/ENOENT failure inside npm's own cacache writer that occasionally fails `npm ci` on a runner. Removing `npm ci` from workers also cuts ~5 min of duplicated install work per worker. dispatch-begin now runs as its own job after prep-deps so it fires once the per-worker test-server setup is the only remaining work before dispatch-run.
594 lines
24 KiB
YAML
594 lines
24 KiB
YAML
---
|
|
name: E2E Tests - Playwright Template
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
# Test configuration
|
|
test_type:
|
|
description: "Type of test run (smoke or full)"
|
|
type: string
|
|
required: true
|
|
test_filter:
|
|
description: "Test filter arguments (e.g., --grep @smoke)"
|
|
type: string
|
|
required: true
|
|
workers:
|
|
description: "Number of parallel shards"
|
|
type: number
|
|
required: false
|
|
default: 2
|
|
enabled_docker_services:
|
|
description: "Space-separated list of docker services to enable"
|
|
type: string
|
|
required: false
|
|
default: "postgres inbucket"
|
|
|
|
# Common build variables
|
|
commit_sha:
|
|
type: string
|
|
required: true
|
|
branch:
|
|
type: string
|
|
required: true
|
|
build_id:
|
|
type: string
|
|
required: true
|
|
server_image_tag:
|
|
description: "Server image tag (e.g., master or short SHA)"
|
|
type: string
|
|
required: true
|
|
server:
|
|
type: string
|
|
required: false
|
|
default: onprem
|
|
server_edition:
|
|
description: "Server edition: enterprise (default), fips, or team"
|
|
type: string
|
|
required: false
|
|
default: enterprise
|
|
server_image_repo:
|
|
description: "Docker registry: mattermostdevelopment (default) or mattermost"
|
|
type: string
|
|
required: false
|
|
default: mattermostdevelopment
|
|
server_image_aliases:
|
|
description: "Comma-separated alias tags for description (e.g., 'release-11.4, release-11')"
|
|
type: string
|
|
required: false
|
|
|
|
# Reporting options
|
|
enable_reporting:
|
|
type: boolean
|
|
required: false
|
|
default: false
|
|
report_type:
|
|
type: string
|
|
required: false
|
|
ref_branch:
|
|
description: "Source branch name for webhook messages (e.g., 'master' or 'release-11.4')"
|
|
type: string
|
|
required: false
|
|
pr_number:
|
|
type: string
|
|
required: false
|
|
|
|
# Commit status configuration
|
|
context_name:
|
|
description: "GitHub commit status context name"
|
|
type: string
|
|
required: true
|
|
|
|
outputs:
|
|
passed:
|
|
description: "Number of passed tests"
|
|
value: ${{ jobs.report.outputs.passed }}
|
|
failed:
|
|
description: "Number of failed tests"
|
|
value: ${{ jobs.report.outputs.failed }}
|
|
report_url:
|
|
description: "URL to test report on S3"
|
|
value: ${{ jobs.report.outputs.report_url }}
|
|
|
|
secrets:
|
|
MM_LICENSE:
|
|
required: false
|
|
REPORT_WEBHOOK_URL:
|
|
required: false
|
|
AWS_ACCESS_KEY_ID:
|
|
required: true
|
|
AWS_SECRET_ACCESS_KEY:
|
|
required: true
|
|
|
|
# Callers must grant at least these scopes on the job that uses this workflow
|
|
permissions:
|
|
contents: read
|
|
statuses: write
|
|
|
|
env:
|
|
SERVER_IMAGE: "${{ inputs.server_image_repo }}/${{ inputs.server_edition == 'fips' && 'mattermost-enterprise-fips-edition' || inputs.server_edition == 'team' && 'mattermost-team-edition' || 'mattermost-enterprise-edition' }}:${{ inputs.server_image_tag }}"
|
|
|
|
jobs:
|
|
update-initial-status:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: ci/set-initial-status
|
|
uses: mattermost/actions/delivery/update-commit-status@f324ac89b05cc3511cb06e60642ac2fb829f0a63
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
with:
|
|
repository_full_name: ${{ github.repository }}
|
|
commit_sha: ${{ inputs.commit_sha }}
|
|
context: ${{ inputs.context_name }}
|
|
description: "tests running, image_tag:${{ inputs.server_image_tag }}${{ inputs.server_image_aliases && format(' ({0})', inputs.server_image_aliases) || '' }}"
|
|
status: pending
|
|
|
|
generate-test-variables:
|
|
runs-on: ubuntu-24.04
|
|
outputs:
|
|
workers: "${{ steps.generate-workers.outputs.workers }}"
|
|
start_time: "${{ steps.generate-workers.outputs.start_time }}"
|
|
steps:
|
|
- name: ci/generate-workers
|
|
id: generate-workers
|
|
run: |
|
|
echo "workers=$(jq -nc '[range(1; ${{ inputs.workers }} + 1)]')" >> $GITHUB_OUTPUT
|
|
echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT
|
|
|
|
run-tests:
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 60
|
|
continue-on-error: true
|
|
needs:
|
|
- generate-test-variables
|
|
if: needs.generate-test-variables.result == 'success'
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
worker_index: ${{ fromJSON(needs.generate-test-variables.outputs.workers) }}
|
|
defaults:
|
|
run:
|
|
working-directory: e2e-tests
|
|
env:
|
|
SERVER: "${{ inputs.server }}"
|
|
MM_LICENSE: "${{ secrets.MM_LICENSE }}"
|
|
ENABLED_DOCKER_SERVICES: "${{ inputs.enabled_docker_services }}"
|
|
TEST: playwright
|
|
TEST_FILTER: "${{ inputs.test_filter }}"
|
|
PW_SHARD: "${{ format('--shard={0}/{1}', matrix.worker_index, inputs.workers) }}"
|
|
BRANCH: "${{ inputs.branch }}-${{ inputs.test_type }}"
|
|
BUILD_ID: "${{ inputs.build_id }}"
|
|
CI_BASE_URL: "${{ inputs.test_type }}-test-${{ matrix.worker_index }}"
|
|
steps:
|
|
- name: ci/checkout-actions
|
|
# Sparse-checkout just .github/actions from the triggering ref (master)
|
|
# so the composite action below is available before the full checkout
|
|
# overwrites the workspace with inputs.commit_sha.
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
sparse-checkout: .github/actions
|
|
sparse-checkout-cone-mode: true
|
|
- name: ci/runner-prep-for-openldap
|
|
uses: ./.github/actions/runner-prep-openldap
|
|
- name: ci/checkout-repo
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
ref: ${{ inputs.commit_sha }}
|
|
fetch-depth: 0
|
|
- name: ci/setup-node
|
|
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
|
with:
|
|
node-version-file: ".nvmrc"
|
|
cache: npm
|
|
cache-dependency-path: |
|
|
e2e-tests/playwright/package-lock.json
|
|
webapp/package-lock.json
|
|
- name: ci/npm-cache-verify
|
|
# Heal any partial/dangling entries left in the restored ~/.npm cache
|
|
# before running `npm ci`. Avoids the intermittent EEXIST/ENOENT
|
|
# failures in npm's cacache writer.
|
|
run: npm cache verify
|
|
- name: ci/get-webapp-node-modules
|
|
working-directory: webapp
|
|
run: make node_modules
|
|
- name: ci/restore-playwright-image-cache
|
|
# Cache the Playwright Docker image tar by the SHA of the files that pin
|
|
# its version. Cache busts automatically when either file is edited to bump
|
|
# the version. Avoids repeated MCR pulls which are frequently blocked by
|
|
# Microsoft's CDN ("The request is blocked").
|
|
id: playwright-image-cache
|
|
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
|
with:
|
|
path: /tmp/playwright-docker-image.tar
|
|
key: playwright-docker-image-${{ hashFiles('e2e-tests/.ci/server.generate.sh', '.github/workflows/e2e-tests-playwright-template.yml') }}-${{ runner.os }}
|
|
- name: ci/pre-pull-playwright-image
|
|
# Load from cache when available; pull from MCR only on cache miss.
|
|
# A single pull attempt is enough because the image is saved to the cache
|
|
# tar for all future runs — no need for a retry loop.
|
|
run: |
|
|
set -euo pipefail
|
|
IMAGE="mcr.microsoft.com/playwright:v1.59.1-noble"
|
|
TAR="/tmp/playwright-docker-image.tar"
|
|
if [ -f "${TAR}" ]; then
|
|
echo "Loading Playwright image from GitHub Actions cache"
|
|
docker load --input "${TAR}"
|
|
else
|
|
echo "Cache miss — pulling from MCR"
|
|
docker pull "${IMAGE}"
|
|
echo "Saving image to cache for future runs"
|
|
docker save "${IMAGE}" --output "${TAR}"
|
|
fi
|
|
- name: ci/run-tests
|
|
run: |
|
|
make cloud-init
|
|
make
|
|
- name: ci/cloud-teardown
|
|
if: always()
|
|
run: make cloud-teardown
|
|
- name: ci/dump-docker-state-on-failure
|
|
# Always run a final docker-state capture so failures unrelated to
|
|
# openldap startup (e.g. server container later crashes) still produce
|
|
# logs we can inspect. The script's own retry loop dumps openldap
|
|
# state per-attempt; this step is a backstop covering the whole job.
|
|
if: failure()
|
|
run: |
|
|
set +e
|
|
DIAG="e2e-tests/docker-diagnostics/job-failure"
|
|
mkdir -p "$DIAG"
|
|
docker ps -a >"$DIAG/docker.ps.txt" 2>&1
|
|
docker version >"$DIAG/docker.version.txt" 2>&1
|
|
docker info >"$DIAG/docker.info.txt" 2>&1
|
|
for c in $(docker ps -a --format '{{.Names}}'); do
|
|
docker inspect "$c" >"$DIAG/$c.inspect.json" 2>&1
|
|
docker logs "$c" >"$DIAG/$c.log" 2>&1
|
|
done
|
|
uname -a >"$DIAG/host.uname.txt" 2>&1
|
|
free -m >"$DIAG/host.free.txt" 2>&1
|
|
df -h >"$DIAG/host.df.txt" 2>&1
|
|
sudo dmesg | tail -500 >"$DIAG/host.dmesg.tail.txt" 2>&1
|
|
sudo dmesg | grep -iE 'apparmor|denied|oom|killed|openldap|slapd' >"$DIAG/host.dmesg.relevant.txt" 2>&1
|
|
- name: ci/upload-docker-diagnostics
|
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
if: always()
|
|
with:
|
|
name: docker-diagnostics-playwright-${{ inputs.test_type }}-${{ inputs.server_edition }}-${{ matrix.worker_index }}
|
|
path: e2e-tests/docker-diagnostics/
|
|
retention-days: 7
|
|
if-no-files-found: ignore
|
|
- name: ci/upload-results
|
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
if: always()
|
|
with:
|
|
name: playwright-${{ inputs.test_type }}-${{ inputs.server_edition }}-results-${{ matrix.worker_index }}
|
|
path: |
|
|
e2e-tests/playwright/logs/
|
|
e2e-tests/playwright/results/
|
|
retention-days: 5
|
|
|
|
calculate-results:
|
|
runs-on: ubuntu-24.04
|
|
needs:
|
|
- generate-test-variables
|
|
- run-tests
|
|
if: always() && needs.generate-test-variables.result == 'success'
|
|
outputs:
|
|
passed: ${{ steps.calculate.outputs.passed }}
|
|
failed: ${{ steps.calculate.outputs.failed }}
|
|
flaky: ${{ steps.calculate.outputs.flaky }}
|
|
skipped: ${{ steps.calculate.outputs.skipped }}
|
|
total_specs: ${{ steps.calculate.outputs.total_specs }}
|
|
failed_specs: ${{ steps.calculate.outputs.failed_specs }}
|
|
failed_specs_count: ${{ steps.calculate.outputs.failed_specs_count }}
|
|
failed_tests: ${{ steps.calculate.outputs.failed_tests }}
|
|
commit_status_message: ${{ steps.calculate.outputs.commit_status_message }}
|
|
total: ${{ steps.calculate.outputs.total }}
|
|
pass_rate: ${{ steps.calculate.outputs.pass_rate }}
|
|
passing: ${{ steps.calculate.outputs.passing }}
|
|
color: ${{ steps.calculate.outputs.color }}
|
|
test_duration: ${{ steps.calculate.outputs.test_duration }}
|
|
end_time: ${{ steps.record-end-time.outputs.end_time }}
|
|
steps:
|
|
- name: ci/checkout-repo
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- name: ci/setup-node
|
|
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
|
with:
|
|
node-version-file: ".nvmrc"
|
|
cache: npm
|
|
cache-dependency-path: "e2e-tests/playwright/package-lock.json"
|
|
- name: ci/download-shard-results
|
|
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
|
|
with:
|
|
pattern: playwright-${{ inputs.test_type }}-${{ inputs.server_edition }}-results-*
|
|
path: e2e-tests/playwright/shard-results/
|
|
merge-multiple: true
|
|
- name: ci/merge-shard-results
|
|
working-directory: e2e-tests/playwright
|
|
run: |
|
|
mkdir -p results/reporter
|
|
|
|
# Merge blob reports using Playwright merge-reports (per docs)
|
|
npm install --no-save @playwright/test
|
|
npx playwright merge-reports --config merge.config.mjs ./shard-results/results/blob-report/
|
|
- name: ci/calculate
|
|
id: calculate
|
|
uses: ./.github/actions/calculate-playwright-results
|
|
with:
|
|
original-results-path: e2e-tests/playwright/results/reporter/results.json
|
|
- name: ci/upload-merged-results
|
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
with:
|
|
name: playwright-${{ inputs.test_type }}-${{ inputs.server_edition }}-results
|
|
path: e2e-tests/playwright/results/
|
|
retention-days: 5
|
|
- name: ci/record-end-time
|
|
id: record-end-time
|
|
run: echo "end_time=$(date +%s)" >> $GITHUB_OUTPUT
|
|
|
|
# NB: retries for failing specs happen INLINE inside each shard's
|
|
# `ci/run-tests` step (see e2e-tests/.ci/server.run_playwright.sh).
|
|
# That reuses the already-running server+docker stack instead of
|
|
# paying ~4-7 min to provision a fresh one here, and it correctly
|
|
# handles the chrome + chrome-serial project split. The old
|
|
# standalone `run-failed-tests` job was removed because it was
|
|
# invoking `--project=chrome` against specs that only exist in
|
|
# chrome-serial, causing the retest to run zero tests.
|
|
|
|
report:
|
|
runs-on: ubuntu-24.04
|
|
needs:
|
|
- generate-test-variables
|
|
- run-tests
|
|
- calculate-results
|
|
if: always() && needs.calculate-results.result == 'success'
|
|
outputs:
|
|
passed: "${{ steps.final-results.outputs.passed }}"
|
|
failed: "${{ steps.final-results.outputs.failed }}"
|
|
commit_status_message: "${{ steps.final-results.outputs.commit_status_message }}"
|
|
report_url: "${{ steps.upload-to-s3.outputs.report_url }}"
|
|
duration: "${{ steps.duration.outputs.duration }}"
|
|
duration_display: "${{ steps.duration.outputs.duration_display }}"
|
|
retest_display: "${{ steps.duration.outputs.retest_display }}"
|
|
defaults:
|
|
run:
|
|
working-directory: e2e-tests
|
|
steps:
|
|
- name: ci/checkout-repo
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- name: ci/setup-node
|
|
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
|
with:
|
|
node-version-file: ".nvmrc"
|
|
cache: npm
|
|
cache-dependency-path: "e2e-tests/playwright/package-lock.json"
|
|
|
|
# Download merged results (uploaded by calculate-results). These blob
|
|
# reports already include the inline per-shard retry results, so no
|
|
# separate retest download/merge is needed here.
|
|
- name: ci/download-results
|
|
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
|
|
with:
|
|
name: playwright-${{ inputs.test_type }}-${{ inputs.server_edition }}-results
|
|
path: e2e-tests/playwright/results/
|
|
|
|
# Calculate final results. Tests that failed in the first pass but
|
|
# passed on inline retry are reported as `flaky`, not `failed`, so
|
|
# no retest-results-path is needed.
|
|
- name: ci/calculate-results
|
|
id: final-results
|
|
uses: ./.github/actions/calculate-playwright-results
|
|
with:
|
|
original-results-path: e2e-tests/playwright/results/reporter/results.json
|
|
|
|
- name: ci/aws-configure
|
|
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0
|
|
with:
|
|
aws-region: us-east-1
|
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
- name: ci/upload-to-s3
|
|
id: upload-to-s3
|
|
env:
|
|
AWS_REGION: us-east-1
|
|
AWS_S3_BUCKET: mattermost-cypress-report
|
|
PR_NUMBER: "${{ inputs.pr_number }}"
|
|
RUN_ID: "${{ github.run_id }}"
|
|
COMMIT_SHA: "${{ inputs.commit_sha }}"
|
|
TEST_TYPE: "${{ inputs.test_type }}"
|
|
run: |
|
|
LOCAL_RESULTS_PATH="playwright/results/"
|
|
|
|
# Use PR number if available, otherwise use commit SHA prefix
|
|
if [ -n "$PR_NUMBER" ]; then
|
|
S3_PATH="server-pr-${PR_NUMBER}/e2e-reports/playwright-${TEST_TYPE}/${RUN_ID}"
|
|
else
|
|
S3_PATH="server-commit-${COMMIT_SHA::7}/e2e-reports/playwright-${TEST_TYPE}/${RUN_ID}"
|
|
fi
|
|
|
|
if [[ -d "$LOCAL_RESULTS_PATH" ]]; then
|
|
aws s3 sync "$LOCAL_RESULTS_PATH" "s3://${AWS_S3_BUCKET}/${S3_PATH}/results/" \
|
|
--acl public-read --cache-control "no-cache"
|
|
fi
|
|
|
|
REPORT_URL="https://${AWS_S3_BUCKET}.s3.amazonaws.com/${S3_PATH}/results/reporter/index.html"
|
|
echo "report_url=$REPORT_URL" >> "$GITHUB_OUTPUT"
|
|
- name: ci/compute-duration
|
|
id: duration
|
|
env:
|
|
START_TIME: ${{ needs.generate-test-variables.outputs.start_time }}
|
|
FLAKY_COUNT: ${{ steps.final-results.outputs.flaky }}
|
|
TEST_DURATION: ${{ steps.final-results.outputs.test_duration }}
|
|
run: |
|
|
NOW=$(date +%s)
|
|
ELAPSED=$((NOW - START_TIME))
|
|
MINUTES=$((ELAPSED / 60))
|
|
SECONDS=$((ELAPSED % 60))
|
|
DURATION="${MINUTES}m ${SECONDS}s"
|
|
|
|
# Duration icons: >20m high alert, >15m warning, otherwise clock.
|
|
# Retries now happen inline per-shard, so there's no separate
|
|
# first-pass/re-run breakdown — the shard wall-clock already
|
|
# includes any retries it needed.
|
|
if [ "$MINUTES" -ge 20 ]; then
|
|
DURATION_DISPLAY=":rotating_light: ${DURATION} | test: ${TEST_DURATION}"
|
|
elif [ "$MINUTES" -ge 15 ]; then
|
|
DURATION_DISPLAY=":warning: ${DURATION} | test: ${TEST_DURATION}"
|
|
else
|
|
DURATION_DISPLAY=":clock3: ${DURATION} | test: ${TEST_DURATION}"
|
|
fi
|
|
|
|
# Flaky indicator: tests that failed first pass but passed on
|
|
# inline retry. Signals retries did run.
|
|
if [ -n "$FLAKY_COUNT" ] && [ "$FLAKY_COUNT" -gt 0 ] 2>/dev/null; then
|
|
RETEST_DISPLAY=":repeat: ${FLAKY_COUNT} flaky"
|
|
else
|
|
RETEST_DISPLAY=""
|
|
fi
|
|
|
|
echo "duration=${DURATION}" >> $GITHUB_OUTPUT
|
|
echo "duration_display=${DURATION_DISPLAY}" >> $GITHUB_OUTPUT
|
|
echo "retest_display=${RETEST_DISPLAY}" >> $GITHUB_OUTPUT
|
|
|
|
- name: ci/publish-report
|
|
if: inputs.enable_reporting && env.REPORT_WEBHOOK_URL != ''
|
|
env:
|
|
REPORT_WEBHOOK_URL: ${{ secrets.REPORT_WEBHOOK_URL }}
|
|
COMMIT_STATUS_MESSAGE: ${{ steps.final-results.outputs.commit_status_message }}
|
|
COLOR: ${{ steps.final-results.outputs.color }}
|
|
REPORT_URL: ${{ steps.upload-to-s3.outputs.report_url }}
|
|
TEST_TYPE: ${{ inputs.test_type }}
|
|
REPORT_TYPE: ${{ inputs.report_type }}
|
|
COMMIT_SHA: ${{ inputs.commit_sha }}
|
|
REF_BRANCH: ${{ inputs.ref_branch }}
|
|
PR_NUMBER: ${{ inputs.pr_number }}
|
|
DURATION_DISPLAY: ${{ steps.duration.outputs.duration_display }}
|
|
RETEST_DISPLAY: ${{ steps.duration.outputs.retest_display }}
|
|
run: |
|
|
# Capitalize test type
|
|
TEST_TYPE_CAP=$(echo "$TEST_TYPE" | sed 's/.*/\u&/')
|
|
|
|
# Build source line based on report type
|
|
COMMIT_SHORT="${COMMIT_SHA::7}"
|
|
COMMIT_URL="https://github.com/${{ github.repository }}/commit/${COMMIT_SHA}"
|
|
if [ "$REPORT_TYPE" = "RELEASE_CUT" ]; then
|
|
SOURCE_LINE=":github_round: [${COMMIT_SHORT}](${COMMIT_URL}) on \`${REF_BRANCH}\`"
|
|
elif [ "$REPORT_TYPE" = "MASTER" ] || [ "$REPORT_TYPE" = "RELEASE" ]; then
|
|
SOURCE_LINE=":git_merge: [${COMMIT_SHORT}](${COMMIT_URL}) on \`${REF_BRANCH}\`"
|
|
else
|
|
SOURCE_LINE=":open-pull-request: [mattermost-pr-${PR_NUMBER}](https://github.com/${{ github.repository }}/pull/${PR_NUMBER})"
|
|
fi
|
|
|
|
# Build retest part for message
|
|
RETEST_PART=""
|
|
if [ -n "$RETEST_DISPLAY" ]; then
|
|
RETEST_PART=" | ${RETEST_DISPLAY}"
|
|
fi
|
|
|
|
# Build payload with attachments
|
|
PAYLOAD=$(cat <<EOF
|
|
{
|
|
"username": "E2E Test",
|
|
"icon_url": "https://mattermost.com/wp-content/uploads/2022/02/icon_WS.png",
|
|
"attachments": [{
|
|
"color": "${COLOR}",
|
|
"text": "**Results - Playwright ${TEST_TYPE_CAP} Tests**\n\n${SOURCE_LINE}\n:docker: \`${{ env.SERVER_IMAGE }}\`\n${COMMIT_STATUS_MESSAGE}${RETEST_PART} | [full report](${REPORT_URL})\n${DURATION_DISPLAY}"
|
|
}]
|
|
}
|
|
EOF
|
|
)
|
|
|
|
# Send to webhook
|
|
curl -X POST -H "Content-Type: application/json" -d "$PAYLOAD" "$REPORT_WEBHOOK_URL"
|
|
- name: ci/write-job-summary
|
|
if: always()
|
|
env:
|
|
REPORT_URL: ${{ steps.upload-to-s3.outputs.report_url }}
|
|
TEST_TYPE: ${{ inputs.test_type }}
|
|
PASSED: ${{ steps.final-results.outputs.passed }}
|
|
FAILED: ${{ steps.final-results.outputs.failed }}
|
|
FLAKY: ${{ steps.final-results.outputs.flaky }}
|
|
SKIPPED: ${{ steps.final-results.outputs.skipped }}
|
|
TOTAL_SPECS: ${{ steps.final-results.outputs.total_specs }}
|
|
FAILED_SPECS_COUNT: ${{ steps.final-results.outputs.failed_specs_count }}
|
|
FAILED_SPECS: ${{ steps.final-results.outputs.failed_specs }}
|
|
COMMIT_STATUS_MESSAGE: ${{ steps.final-results.outputs.commit_status_message }}
|
|
FAILED_TESTS: ${{ steps.final-results.outputs.failed_tests }}
|
|
DURATION_DISPLAY: ${{ steps.duration.outputs.duration_display }}
|
|
run: |
|
|
{
|
|
echo "## E2E Test Results - Playwright ${TEST_TYPE}"
|
|
echo ""
|
|
|
|
if [ "$FAILED" = "0" ]; then
|
|
echo "All tests passed: **${PASSED} passed**"
|
|
else
|
|
echo "<details>"
|
|
echo "<summary>${FAILED} failed, ${PASSED} passed</summary>"
|
|
echo ""
|
|
echo "| Test | File |"
|
|
echo "|------|------|"
|
|
echo "${FAILED_TESTS}"
|
|
echo "</details>"
|
|
fi
|
|
|
|
echo ""
|
|
echo "### Calculation Outputs"
|
|
echo ""
|
|
echo "| Output | Value |"
|
|
echo "|--------|-------|"
|
|
echo "| passed | ${PASSED} |"
|
|
echo "| failed | ${FAILED} |"
|
|
echo "| flaky | ${FLAKY} |"
|
|
echo "| skipped | ${SKIPPED} |"
|
|
echo "| total_specs | ${TOTAL_SPECS} |"
|
|
echo "| failed_specs_count | ${FAILED_SPECS_COUNT} |"
|
|
echo "| commit_status_message | ${COMMIT_STATUS_MESSAGE} |"
|
|
echo "| failed_specs | ${FAILED_SPECS:-none} |"
|
|
echo "| duration | ${DURATION_DISPLAY} |"
|
|
# Flaky > 0 means some tests needed the inline retry to pass.
|
|
if [ -n "$FLAKY" ] && [ "$FLAKY" -gt 0 ] 2>/dev/null; then
|
|
echo "| retried (flaky) | ${FLAKY} |"
|
|
fi
|
|
|
|
echo ""
|
|
echo "---"
|
|
echo "[View Full Report](${REPORT_URL})"
|
|
} >> $GITHUB_STEP_SUMMARY
|
|
- name: ci/assert-results
|
|
run: |
|
|
[ "${{ steps.final-results.outputs.failed }}" = "0" ]
|
|
|
|
update-success-status:
|
|
runs-on: ubuntu-24.04
|
|
if: always() && needs.report.result == 'success' && needs.calculate-results.result == 'success'
|
|
needs:
|
|
- calculate-results
|
|
- report
|
|
steps:
|
|
- uses: mattermost/actions/delivery/update-commit-status@f324ac89b05cc3511cb06e60642ac2fb829f0a63
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
with:
|
|
repository_full_name: ${{ github.repository }}
|
|
commit_sha: ${{ inputs.commit_sha }}
|
|
context: ${{ inputs.context_name }}
|
|
description: "${{ needs.report.outputs.commit_status_message }}, ${{ needs.report.outputs.duration }}, image_tag:${{ inputs.server_image_tag }}${{ inputs.server_image_aliases && format(' ({0})', inputs.server_image_aliases) || '' }}"
|
|
status: success
|
|
target_url: ${{ needs.report.outputs.report_url }}
|
|
|
|
update-failure-status:
|
|
runs-on: ubuntu-24.04
|
|
if: always() && (needs.report.result != 'success' || needs.calculate-results.result != 'success')
|
|
needs:
|
|
- calculate-results
|
|
- report
|
|
steps:
|
|
- uses: mattermost/actions/delivery/update-commit-status@f324ac89b05cc3511cb06e60642ac2fb829f0a63
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
with:
|
|
repository_full_name: ${{ github.repository }}
|
|
commit_sha: ${{ inputs.commit_sha }}
|
|
context: ${{ inputs.context_name }}
|
|
description: "${{ needs.report.outputs.commit_status_message }}, ${{ needs.report.outputs.duration }}, image_tag:${{ inputs.server_image_tag }}${{ inputs.server_image_aliases && format(' ({0})', inputs.server_image_aliases) || '' }}"
|
|
status: failure
|
|
target_url: ${{ needs.report.outputs.report_url }}
|