feat(e2e): add a job to run e2e on linux os #20
Workflow file for this run
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: Electron Playwright Tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
env: | |
AWS_S3_BUCKET: "mattermost-cypress-report" | |
BRANCH: ${{ github.ref }} | |
BUILD_SUFFIX: 'desktop-pr' | |
JIRA_PROJECT_KEY: 'MM' | |
MM_TEST_SERVER_URL: "https://localhost:8065" | |
PULL_REQUEST_BASE_URL: "https://github.com/mattermost/desktop/pull/" | |
TYPE: ${{ github.event_name == 'pull_request' && 'PR' || '' }} | |
ZEPHYR_ENVIRONMENT_NAME: 'Desktop app' | |
ZEPHYR_FOLDER_ID: "3256491" | |
jobs: | |
e2e-linux: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node-version: [18.x] | |
steps: | |
- name: Check out code | |
uses: actions/[email protected] | |
- name: Set up Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Desktop Install nodejs dependencies | |
run: npm ci | |
- name: Set Environment Variables | |
run: | | |
if [ "${{ github.event_name }}" == "pull_request" ]; then | |
echo "BRANCH=${{ github.event.pull_request.title }}" >> $GITHUB_ENV | |
echo "BUILD_SUFFIX=desktop-pr" >> $GITHUB_ENV | |
elif [ "${{ github.event_name }}" == "release" ]; then | |
echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV | |
echo "BUILD_SUFFIX=desktop-release" >> $GITHUB_ENV | |
echo "ZEPHYR_ENABLE=true" >> $GITHUB_ENV | |
elif [ "${{ github.event_name }}" == "schedule" ]; then | |
echo "BRANCH=${{ github.ref }}" >> $GITHUB_ENV | |
echo "BUILD_SUFFIX=desktop-nightly" >> $GITHUB_ENV | |
fi | |
echo "BUILD_ID=${{ github.run_id }}-${BUILD_SUFFIX}-${{ runner.os }}" >> $GITHUB_ENV | |
echo "BUILD_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV | |
echo "PULL_REQUEST=${PULL_REQUEST_BASE_URL}${{ github.event.pull_request.number }}" >> $GITHUB_ENV | |
echo "TEST_CYCLE_LINK_PREFIX=${{ secrets.MM_DESKTOP_E2E_TEST_CYCLE_LINK_PREFIX }}" >> $GITHUB_ENV | |
echo "AWS_ACCESS_KEY_ID=${{ secrets.MM_DESKTOP_E2E_AWS_ACCESS_KEY_ID }}" >> $GITHUB_ENV | |
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.MM_DESKTOP_E2E_AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV | |
echo "WEBHOOK_URL=${{ secrets.MM_DESKTOP_E2E_WEBHOOK_URL }}" >> $GITHUB_ENV | |
echo "ZEPHYR_API_KEY=${{ secrets.MM_DESKTOP_E2E_ZEPHYR_API_KEY }}" >> $GITHUB_ENV | |
if [ -n "${ZEPHYR_ENABLE}" ]; then | |
echo "ZEPHYR_ENABLE=${ZEPHYR_ENABLE}" >> $GITHUB_ENV | |
fi | |
# Linux | |
- name: Install packages (Ubuntu OS) | |
run: | | |
sudo apt-get install libxtst-dev libpng++-dev | |
sudo apt-get update | |
sudo apt-get install -y xvfb | |
- name: Checkout mattermost | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
with: | |
repository: mattermost/mattermost | |
path: mattermost | |
- name: Run mattermsot server & Playwright tests (Ubuntu OS) | |
run: | | |
cd mattermost/e2e-tests | |
echo "SERVER_IMAGE=mattermost/mattermost-enterprise-edition:release-8.0" >.ci/env | |
make start-server && make prepare-server | |
cd ../.. | |
export DISPLAY=:99 | |
Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 & | |
npm run test:e2e || true # making job pass even if the tests fail due to flakyness | |
npm run test:e2e:send-report |