Spin server when Tests start (#3316)
This commit is contained in:
229
.github/workflows/e2e-functional.yml
vendored
229
.github/workflows/e2e-functional.yml
vendored
@@ -2,126 +2,159 @@ name: Electron Playwright Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
branches: [master]
|
||||
pull_request:
|
||||
types:
|
||||
- labeled
|
||||
types: [labeled]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version_name:
|
||||
type: string
|
||||
description: "Desktop Version name eg: 5.6"
|
||||
required: true
|
||||
job_name:
|
||||
platform:
|
||||
type: choice
|
||||
description: "Job name"
|
||||
description: "Choose platform to run tests"
|
||||
required: true
|
||||
default: "All"
|
||||
options:
|
||||
- "e2e-linux"
|
||||
- "e2e-macos"
|
||||
- "e2e-windows"
|
||||
- "All"
|
||||
default: "all"
|
||||
options: [linux, macos, windows, all]
|
||||
|
||||
jobs:
|
||||
e2e-linux:
|
||||
if: ${{
|
||||
(
|
||||
(inputs.job_name == 'e2e-linux' || inputs.job_name == 'All')
|
||||
&&
|
||||
github.event_name == 'workflow_dispatch'
|
||||
) ||
|
||||
(
|
||||
github.event_name == 'push'
|
||||
) ||
|
||||
(
|
||||
github.event_name == 'pull_request' &&
|
||||
github.event.pull_request.labels &&
|
||||
contains(github.event.pull_request.labels.*.name, 'Run Desktop E2E Tests')
|
||||
)
|
||||
}}
|
||||
update-initial-status-linux:
|
||||
runs-on: ubuntu-22.04
|
||||
if: contains(github.event.label.name, 'Run Desktop E2E Tests')
|
||||
steps:
|
||||
- uses: mattermost/actions/delivery/update-commit-status@main
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
repository_full_name: ${{ github.repository }}
|
||||
commit_sha: ${{ github.event.pull_request.head.sha }}
|
||||
context: e2e/linux
|
||||
description: E2E tests for Mattermost desktop app on Linux have started...
|
||||
status: pending
|
||||
|
||||
update-initial-status-macos:
|
||||
runs-on: ubuntu-22.04
|
||||
if: contains(github.event.label.name, 'Run Desktop E2E Tests')
|
||||
steps:
|
||||
- uses: mattermost/actions/delivery/update-commit-status@main
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
repository_full_name: ${{ github.repository }}
|
||||
commit_sha: ${{ github.event.pull_request.head.sha }}
|
||||
context: e2e/macOS
|
||||
description: E2E tests for Mattermost desktop app on macOS have started...
|
||||
status: pending
|
||||
|
||||
# TODO: uncomment when https://mattermost.atlassian.net/browse/MM-63397 is fixed
|
||||
# update-initial-status-windows:
|
||||
# runs-on: ubuntu-22.04
|
||||
# if: contains(github.event.label.name, 'Run Desktop E2E Tests')
|
||||
# steps:
|
||||
# - uses: mattermost/actions/delivery/update-commit-status@main
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ github.token }}
|
||||
# with:
|
||||
# repository_full_name: ${{ github.repository }}
|
||||
# commit_sha: ${{ github.event.pull_request.head.sha }}
|
||||
# context: e2e/windows
|
||||
# description: E2E tests for Mattermost desktop app on Windows have started...
|
||||
# status: pending
|
||||
|
||||
determine-platforms:
|
||||
if: contains(github.event.label.name, 'Run Desktop E2E Tests')
|
||||
needs: [update-initial-status-linux, update-initial-status-macos] #, update-initial-status-windows]
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
platforms: ${{ steps.set-matrix.outputs.platforms }}
|
||||
steps:
|
||||
- id: set-matrix
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||
if [[ "${{ inputs.platform }}" == "all" ]]; then
|
||||
echo "platforms=['ubuntu-22.04', 'macos-13', 'windows-2022']" >> $GITHUB_OUTPUT
|
||||
else
|
||||
case "${{ inputs.platform }}" in
|
||||
linux) echo "platforms=['ubuntu-22.04']" ;;
|
||||
macos) echo "platforms=['macos-13']" ;;
|
||||
# windows) echo "platforms=['windows-2022']" ;; TODO: uncomment when https://mattermost.atlassian.net/browse/MM-63397 is fixed
|
||||
esac >> $GITHUB_OUTPUT
|
||||
fi
|
||||
elif [[ "${{ github.event_name }}" == "push" ]] || [[ "${{ contains(github.event.pull_request.labels.*.name, 'Run Desktop E2E Tests') }}" == "true" ]]; then
|
||||
echo "platforms=['ubuntu-22.04', 'macos-13']" >> $GITHUB_OUTPUT
|
||||
# echo "platforms=['ubuntu-22.04', 'macos-13', 'windows-2022']" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "platforms=[]" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
e2e-tests:
|
||||
needs: determine-platforms
|
||||
strategy:
|
||||
matrix:
|
||||
os: ${{ fromJson(needs.determine-platforms.outputs.platforms) }}
|
||||
fail-fast: false
|
||||
uses: ./.github/workflows/e2e-functional-template.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ${{ matrix.os }}
|
||||
DESKTOP_VERSION: ${{ inputs.version_name || github.head_ref || github.ref }}
|
||||
|
||||
e2e-macos:
|
||||
if: ${{
|
||||
(
|
||||
(inputs.job_name == 'e2e-macos' || inputs.job_name == 'All')
|
||||
&&
|
||||
github.event_name == 'workflow_dispatch'
|
||||
) ||
|
||||
(
|
||||
github.event_name == 'push'
|
||||
) ||
|
||||
(
|
||||
github.event_name == 'pull_request' &&
|
||||
github.event.pull_request.labels &&
|
||||
contains(github.event.pull_request.labels.*.name, 'Run Desktop E2E Tests')
|
||||
)
|
||||
}}
|
||||
uses: ./.github/workflows/e2e-functional-template.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: macos-13
|
||||
DESKTOP_VERSION: ${{ inputs.version_name || github.head_ref || github.ref }}
|
||||
update-final-status-linux:
|
||||
runs-on: ubuntu-22.04
|
||||
needs:
|
||||
- e2e-tests
|
||||
steps:
|
||||
- uses: mattermost/actions/delivery/update-commit-status@main
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
repository_full_name: ${{ github.repository }}
|
||||
commit_sha: ${{ github.event.pull_request.head.sha }}
|
||||
context: e2e/linux
|
||||
description: Completed with ${{ needs.e2e-tests.outputs.NEW_FAILURES_LINUX }} failures
|
||||
status: ${{ needs.e2e-tests.outputs.STATUS_LINUX }}
|
||||
target_url: ${{ needs.e2e-tests.outputs.REPORT_LINK_LINUX }}
|
||||
|
||||
# TODO: Uncomment when https://mattermost.atlassian.net/browse/MM-63397 is resolved
|
||||
# e2e-windows:
|
||||
# if: ${{
|
||||
# (
|
||||
# (inputs.job_name == 'e2e-windows' || inputs.job_name == 'All')
|
||||
# &&
|
||||
# github.event_name == 'workflow_dispatch'
|
||||
# ) ||
|
||||
# (
|
||||
# github.event_name == 'push'
|
||||
# ) ||
|
||||
# (
|
||||
# github.event_name == 'pull_request' &&
|
||||
# github.event.pull_request.labels &&
|
||||
# contains(github.event.pull_request.labels.*.name, 'Run Desktop E2E Tests')
|
||||
# )
|
||||
# }}
|
||||
# uses: ./.github/workflows/e2e-functional-template.yml
|
||||
# secrets: inherit
|
||||
# with:
|
||||
# runs-on: windows-2022
|
||||
# DESKTOP_VERSION: ${{ inputs.version_name || github.head_ref || github.ref }}
|
||||
update-final-status-macos:
|
||||
runs-on: ubuntu-22.04
|
||||
needs:
|
||||
- e2e-tests
|
||||
steps:
|
||||
- uses: mattermost/actions/delivery/update-commit-status@main
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
repository_full_name: ${{ github.repository }}
|
||||
commit_sha: ${{ github.event.pull_request.head.sha }}
|
||||
context: e2e/macOS
|
||||
description: Completed with ${{ needs.e2e-tests.outputs.NEW_FAILURES_MACOS }} failures
|
||||
status: ${{ needs.e2e-tests.outputs.STATUS_MACOS }}
|
||||
target_url: ${{ needs.e2e-tests.outputs.REPORT_LINK_MACOS }}
|
||||
|
||||
# TODO: uncomment when https://mattermost.atlassian.net/browse/MM-63397 is fixed
|
||||
# update-final-status-windows:
|
||||
# runs-on: ubuntu-22.04
|
||||
# needs:
|
||||
# - e2e-tests
|
||||
# steps:
|
||||
# - uses: mattermost/actions/delivery/update-commit-status@main
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ github.token }}
|
||||
# with:
|
||||
# repository_full_name: ${{ github.repository }}
|
||||
# commit_sha: ${{ github.event.pull_request.head.sha }}
|
||||
# context: e2e/windows
|
||||
# description: Completed with ${{ needs.e2e-tests.outputs.NEW_FAILURES_WINDOWS }} failures
|
||||
# status: ${{ needs.e2e-tests.outputs.STATUS_WINDOWS }}
|
||||
# target_url: ${{ needs.e2e-tests.outputs.REPORT_LINK_WINDOWS }}
|
||||
|
||||
e2e-remove-label:
|
||||
if: ${{ always() && contains(github.event.pull_request.labels.*.name, 'Run Desktop E2E Tests') }}
|
||||
needs: [e2e-linux, e2e-macos] #, e2e-windows] TODO: Uncomment when https://mattermost.atlassian.net/browse/MM-63397 is resolved
|
||||
needs: e2e-tests
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
COMMENT_BODY_LINUX: "${{ needs.e2e-linux.outputs.COMMENT_BODY }}"
|
||||
COMMENT_BODY_MACOS: "${{ needs.e2e-macos.outputs.COMMENT_BODY }}"
|
||||
# COMMENT_BODY_WINDOWS: "${{ needs.e2e-windows.outputs.COMMENT_BODY }}"
|
||||
steps:
|
||||
- name: e2e/unify-comments-in-single-comment
|
||||
run: |
|
||||
echo "PR_COMMENT<<EOF" >> "${GITHUB_ENV}"
|
||||
echo "Here are the test results below:" >> "${GITHUB_ENV}"
|
||||
echo "$COMMENT_BODY_LINUX" >> "${GITHUB_ENV}"
|
||||
echo "$COMMENT_BODY_MACOS" >> "${GITHUB_ENV}"
|
||||
echo "$COMMENT_BODY_WINDOWS" >> "${GITHUB_ENV}"
|
||||
echo "EOF" >> "${GITHUB_ENV}"
|
||||
|
||||
- name: e2e/send-comment-results-in-pr
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: process.env.PR_COMMENT,
|
||||
});
|
||||
|
||||
- name: e2e/remove-label-from-pr
|
||||
- name: Remove E2E test label
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
continue-on-error: true # Label might have been removed manually
|
||||
with:
|
||||
|
Reference in New Issue
Block a user