Skip to content

Merge pull request #10498 from rak-phillip/feature/10218-backport-act… #62

Merge pull request #10498 from rak-phillip/feature/10218-backport-act…

Merge pull request #10498 from rak-phillip/feature/10218-backport-act… #62

Workflow file for this run

name: Tests
on:
push:
branches:
- master
- 'release-*'
pull_request:
branches:
- master
- 'release-*'
workflow_dispatch:
environment:
description: 'Environment to run tests against'
type: environment
required: true
env:
TEST_USERNAME: admin
TEST_PASSWORD: password
CATTLE_BOOTSTRAP_PASSWORD: password
TEST_BASE_URL: https://127.0.0.1:8005
API: https://127.0.0.1
TEST_PROJECT_ID: rancher-dashboard
CYPRESS_API_URL: http://139.59.134.103:1234/
TEST_RUN_ID: ${{github.run_number}}-${{github.run_attempt}}-${{github.event.pull_request.title || github.event.head_commit.message}}
# Build the dashboard to use in tests. When set to false it will grab `latest` from CDN (useful for running e2e tests quickly)
BUILD_DASHBOARD: true
jobs:
e2e-test:
if: "!contains( github.event.pull_request.labels.*.name, 'ci/skip-e2e')"
strategy:
fail-fast: false
matrix:
role: [
{ username: 'admin', tag: '@adminUser' },
{ username: 'standard_user', tag: '@standardUser' }
]
features: [
['@navigation', '@extensions'],
['@charts'],
['@explorer'],
['@fleet'],
['@generic', '@globalSettings'],
['@manager'],
['@userMenu', '@usersAndAuths']
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '14.x'
# Installing fixed version of Chrome since latest version does not work (117-118 didn't work)
# Leaving this here again in case we need to pin to a specific Chrome version in the future
# - name: Install Chrome 116
# run: |
# sudo apt-get install -y wget
# cd /tmp
# wget -q http://mirror.cs.uchicago.edu/google-chrome/pool/main/g/google-chrome-stable/google-chrome-stable_116.0.5845.187-1_amd64.deb
# sudo apt-get install -y --allow-downgrades ./google-chrome-stable_116.0.5845.187-1_amd64.deb
# google-chrome --version
- name: Install packages
run: yarn install:ci
- name: Prepare build
run: yarn e2e:pre-prod
- name: Setup Rancher and user
run: |
yarn e2e:prod
env:
GREP_TAGS: ${{ matrix.role.tag }}Setup+${{ matrix.features[0] }} --@jenkins ${{ matrix.role.tag }}Setup+${{ matrix.features[1] || matrix.features[0] }} --@jenkins
TEST_USERNAME: admin
TEST_ONLY: setup
- name: Run user tests
run: |
yarn e2e:prod
[ "$BUILD_DASHBOARD" != "false" ] || exit 0
env:
TEST_SKIP: setup
GREP_TAGS: ${{ matrix.role.tag }}+${{ matrix.features[0] }} --@jenkins ${{ matrix.role.tag }}+${{ matrix.features[1] || matrix.features[0] }} --@jenkins
TEST_USERNAME: ${{ matrix.role.username }}
- name: Upload screenshots
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: ${{github.run_number}}-${{github.run_attempt}}-screenshots-${{ matrix.role.tag }}+${{ matrix.features[0] }}
path: cypress/screenshots
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '14.x'
- name: Install packages
run: yarn install:ci
- name: Run tests
run: |
yarn test:ci
mkdir -p coverage-artifacts/coverage
cp coverage/unit/coverage-final.json coverage-artifacts/coverage/coverage-unit.json
cp -r coverage/unit/ coverage-artifacts/coverage/unit/
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
name: ${{github.run_number}}-${{github.run_attempt}}-coverage
path: coverage-artifacts/**/*
i18n:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '14.x'
- name: Install packages
run: yarn install:ci
- name: Run i18n linters
run: yarn lint-l10n
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '14.x'
- name: Install packages
run: yarn install:ci
- name: Run linters
run: yarn lint
coverage:
runs-on: ubuntu-latest
needs:
- unit-test
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '14.x'
- name: Download Coverage Artifacts
uses: actions/download-artifact@v3
with:
name: ${{github.run_number}}-${{github.run_attempt}}-coverage
- name: Upload unit test coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit
files: ./coverage/coverage-unit.json
fail_ci_if_error: false