Skip to content

GDO Bahmni E2E Tests #248

GDO Bahmni E2E Tests

GDO Bahmni E2E Tests #248

name: GDO Bahmni E2E Tests
on:
push:
branches:
- main
schedule:
- cron: "0 1 * * *" # Schedule for GDO Bahmni DEV Env Runs at 06.30AM IST - 1.00AM UTC
# repository_dispatch:
# types: [Smoke-Test-Dev-Lite]
workflow_dispatch:
inputs:
TEST_CONTEXT:
description: "Test tags to be executed. Logical operators can be used."
required: false
default: "regression"
TARGET_ENV:
description: "Environment to test"
required: true
type: choice
default: dev
options:
- dev
TARGET_BRANCH:
description: "Branch to checkout"
required: true
type: choice
default: main
options:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.client_payload.context || github.event.inputs.TEST_CONTEXT || 'regression' }}-${{ github.event.inputs.TARGET_ENV || 'dev' }}-${{github.event.schedule}}
cancel-in-progress: true
env:
TEST_CONTEXT: ${{ github.event.client_payload.context || github.event.inputs.TEST_CONTEXT || 'regression' }}
TARGET_ENV: ${{ github.event.inputs.TARGET_ENV || 'dev' }}
ENV_FLAG: false
TARGET_BRANCH: ${{ github.event.inputs.TARGET_BRANCH || 'main'}}
LANGUAGE: en-IN
jobs:
build-and-run:
name: Build and Run E2E tests
runs-on: ubuntu-latest
steps:
- name: Set environment variables for DEV Regression Schedule
if: github.event.schedule=='0 1 * * *'
run: |
echo "TARGET_ENV=dev" >> $GITHUB_ENV
echo "TEST_CONTEXT=regression" >> $GITHUB_ENV
echo "TARGET_BRANCH=main" >> $GITHUB_ENV
- name: Show current Env variables
run: |
echo "TARGET_ENV - ${{env.TARGET_ENV}} TEST_CONTEXT - ${{env.TEST_CONTEXT}} TARGET_BRANCH - ${{env.TARGET_BRANCH}}"
- run: echo "Current Concurrency Group - ${{ github.workflow }}-${{ github.event.client_payload.context || github.event.inputs.TEST_CONTEXT || 'clinic & regression' }}-${{ github.event.inputs.TARGET_ENV || 'dev.lite' }}-${{github.event.schedule}}"
- uses: actions/checkout@v2
with:
ref: ${{env.TARGET_BRANCH}}
submodules: recursive
- name: Wait for environment to be up
shell: bash
run: bash .github/waitForEnv.sh $TARGET_ENV
- uses: actions/setup-node@v2
with:
node-version: "16"
cache: "npm"
- uses: zcong1993/[email protected]
with:
timezone: "Asia/Kolkata"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgbm-dev
sudo apt-get install -y xvfb
sudo apt-get -y install xorg xvfb gtk2-engines-pixbuf
sudo apt-get -y install dbus-x11 xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic xfonts-scalable
sudo apt-get -y install imagemagick x11-apps
sudo apt-get update
sudo apt-get install -yq \
gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 \
libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates \
fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget ffmpeg
- run: npm install @getgauge/cli
- run: npm install
- name: Run Tests
id: run_test
run: xvfb-run -a npm run ci -- --env $TARGET_ENV --tags "${{env.TEST_CONTEXT}}"
- name: Upload HTML reports
if: ${{(success() || failure()) && env.ENV_FLAG}}
uses: actions/upload-artifact@v2
with:
name: HTML_Reports_${{ GITHUB.RUN_NUMBER }}
path: ./reports/html-report
- name: Upload Logs
if: ${{(success() || failure()) && env.ENV_FLAG}}
uses: actions/upload-artifact@v2
with:
name: Logs_${{ GITHUB.RUN_NUMBER }}
path: ./logs/gauge.log
- name: Deploy reports
if: ${{(success() || failure()) && env.ENV_FLAG == 'true'}}
env:
SRC_FOLDER_PATH: "reports/html-report"
TARGET_BRANCH: "gh-pages"
MAX_DIR: 10
shell: bash
run: bash .github/deleteOldReports.sh $MAX_DIR $SRC_FOLDER_PATH $TARGET_BRANCH ${{secrets.BAHMNI_USERNAME}} ${{secrets.BAHMNI_EMAIL}} ${{GITHUB.RUN_ID}} ${{GITHUB.RUN_ATTEMPT}}