Skip to content

STD UI experimental template #201

STD UI experimental template

STD UI experimental template #201

# Experimental workflow for STD UI
name: STD UI experimental template
on:
workflow_dispatch:
# Variables to set when calling this reusable workflow
inputs:
k3s_version:
description: k3s version
required: true
type: string
default: v1.25.9+k3s1
browser:
description: Browser where the test will run
required: true
type: string
default: chrome
cypress_docker:
description: Cypress Docker Image
required: true
type: string
default: cypress/included:10.11.0
cypress_spec:
description: Cypress specs (default "all")
required: false
type: string
default: "*"
grep_test_by_tag:
description: Grep tags. For multiple selection separate with spaces
required: false
type: string
default: ''
docker_options:
description: Set other docker options
required: false
type: string
epinio_branch:
description: Choose specific branch (default main)
required: false
type: string
default: 'main'
helm_version:
description: Choose specific helm version (default 3.12.0)
required: false
type: string
default: '3.12.0'
node_version:
description: Choose specific node version (default 16.2.0)
required: false
type: string
default: '16.2.0'
epinio_version:
description: Enter desired Epinio version (default latest)
required: false
type: string
jobs:
E2E-Cypress:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.EPINIO_DOCKER_USER }}
password: ${{ secrets.EPINIO_DOCKER_PASSWORD }}
- name: Checkout Epinio repository
uses: actions/checkout@v3
with:
repository: epinio/epinio
submodules: recursive
fetch-depth: 0
ref: ${{ inputs.epinio_branch }}
path: epinio
- name: Checkout Rancher Dashboard repository
uses: actions/checkout@v3
with:
repository: rancher/dashboard
ref: epinio-dev
path: dashboard
- name: Checkout Epinio UI-backend repository
uses: actions/checkout@v3
with:
repository: epinio/ui-backend
path: ui-backend
- name: Setup Go
uses: actions/setup-go@v4
env:
SETUP_GO_VERSION: '^1.20'
with:
go-version: ${{ env.SETUP_GO_VERSION }}
cache: false
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node_version }}
- name: Cache Tools
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/tools
key: ${{ runner.os }}-tools
- name: Add Tools to PATH
run: |
echo "`pwd`/output/bin" >> $GITHUB_PATH
- name: Install K3s / Helm / Epinio
id: installation
env:
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
HELM_VERSION: ${{ inputs.helm_version }}
K3S_VERSION: ${{ inputs.k3s_version }}
EXT_REG: ${{ inputs.ext_reg }}
S3: ${{ inputs.s3 }}
EXT_REG_USER: ${{ secrets.EPINIO_DOCKER_USER }}
EXT_REG_PASSWORD: ${{ secrets.EPINIO_DOCKER_PASSWORD }}
GHCR_USER: ${{ secrets.GHCR_USER }}
GHCR_PASSWORD: ${{ secrets.GHCR_PASSWORD }}
S3_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
S3_KEY_SECRET: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
EPINIO_VERSION: ${{ inputs.epinio_version }}
# EXTRAENV_NAME: SESSION_KEY
# EXTRAENV_VALUE: 12345
run: |
## Export information
ETH_DEV=$(ip route | awk '/default via / { print $5 }')
MY_IP=$(ip a s ${ETH_DEV} | egrep -o 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d' ' -f2)
export MY_HOSTNAME=$(hostname)
export EPINIO_SYSTEM_DOMAIN="${MY_IP}.omg.howdoi.website"
export EPINIO_VERSION
echo "MY_IP=${MY_IP}" >> $GITHUB_OUTPUT
echo "EPINIO_VERSION"=$EPINIO_VERSION >> $GITHUB_OUTPUT
make prepare-e2e-ci-standalone
- name: Patch epinio-ui with latest QA image
env:
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
EPINIO_VERSION: ${{ inputs.epinio_version }}
run: |
make patch-epinio-ui
- name: Start Cypress tests
env:
BROWSER: ${{ inputs.browser }}
CYPRESS_CFG: cypress.config.ts
CYPRESS_DOCKER: ${{ inputs.cypress_docker }}
DOCKER_OPTIONS: ${{ inputs.docker_options }}
EXT_REG_USER: ${{ secrets.EPINIO_DOCKER_USER }}
EXT_REG_PASSWORD: ${{ secrets.EPINIO_DOCKER_PASSWORD }}
RANCHER_PASSWORD: password
RANCHER_URL: https://epinio.${{ steps.installation.outputs.MY_IP }}.omg.howdoi.website
RANCHER_USER: admin
SPEC: cypress/e2e/unit_tests/${{ inputs.cypress_spec }}.spec.ts
SYSTEM_DOMAIN: ${{ steps.installation.outputs.MY_IP }}.omg.howdoi.website
GREP: ${{ inputs.grep_test_by_name }}
GREPTAGS: ${{ inputs.grep_test_by_tag }}
run: |
ETH_DEV=$(ip route | awk '/default via / { print $5 }')
MY_IP=$(ip a s ${ETH_DEV} | egrep -o 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d' ' -f2)
export EPINIO_SYSTEM_DOMAIN="${MY_IP}.omg.howdoi.website"
make start-cypress-tests
- name: Copying screenshots and videos to Mochawesome report
if: always()
run: |
sudo mkdir -p mochawesome-report
sudo cp -r cypress/screenshots mochawesome-report || echo "No screenshots found in this run, probably all tests were OK"
sudo cp -r cypress/videos mochawesome-report
- name: Upload Cypress screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
retention-days: 7
# Test run video was always captured, so this action uses "always()" condition
- name: Upload Cypress videos
uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-videos
path: cypress/videos
retention-days: 7
- name: Upload Mochawesome report
uses: actions/upload-artifact@v3
if: always()
with:
name: mochawesome-report
path: mochawesome-report
retention-days: 7
- name: Uninstall Epinio
if: always()
env:
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
run: |
make uninstall-epinio
- name: Delete k3s cluster
if: always()
run: |
make clean-k3s
- name: Clean all
if: always()
uses: colpal/actions-clean@v1