Bahmni Standard V93 E2E Tests #439
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: Bahmni Standard V93 E2E Tests | |
on: | |
push: | |
branches: | |
- Bahmni_Standard_V93 | |
schedule: | |
- cron: "30 0 * * *" # Schedule for Bahmni Standard Env Runs at 6.00AM IST - 12.30AM UTC | |
workflow_dispatch: | |
inputs: | |
TEST_CONTEXT: | |
description: "Test tags to be executed. eg. clinic, payment, lab, hospital, smoke, regression. Logical operators can be used." | |
required: false | |
default: "hospital & regression" | |
TARGET_ENV: | |
description: "Environment to test" | |
required: true | |
type: choice | |
default: demo | |
options: | |
- demo | |
- demo-v94 | |
TARGET_BRANCH: | |
description: "Branch to checkout" | |
required: true | |
type: choice | |
default: Bahmni_Standard_V93 | |
options: | |
- Bahmni_Standard_V93 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.inputs.TEST_CONTEXT || 'hospital & regression' }}-${{ github.event.inputs.TARGET_ENV || 'demo' }}-${{github.event.schedule}} | |
cancel-in-progress: true | |
env: | |
TEST_CONTEXT: ${{ github.event.inputs.TEST_CONTEXT || 'hospital & regression' }} | |
TARGET_ENV: ${{ github.event.inputs.TARGET_ENV || 'demo' }} | |
ENV_FLAG: false | |
TARGET_BRANCH: ${{ github.event.inputs.TARGET_BRANCH || 'Bahmni_Standard_V93'}} | |
LANGUAGE: en-IN | |
jobs: | |
build-and-run: | |
name: Build and Run E2E tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set environment variables for Demo Regression Schedule | |
if: github.event.schedule=='30 0 * * *' | |
run: | | |
echo "TARGET_ENV=demo" >> $GITHUB_ENV | |
echo "TEST_CONTEXT=hospital" >> $GITHUB_ENV | |
echo "TEST_SETUP=true" >> $GITHUB_ENV | |
echo "TARGET_BRANCH=Bahmni_Standard_V93" >> $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.inputs.TEST_CONTEXT || 'hospital & regression' }}-${{ github.event.inputs.TARGET_ENV || 'demo' }}-${{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: "22" | |
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 Setup | |
if: ${{ env.TEST_SETUP == 'true' }} | |
run: xvfb-run npm run ci -- --env $TARGET_ENV --tags 'setup' | |
- name: Run Tests | |
id: run_test | |
run: xvfb-run 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}} | |
- name: Get Repository Name | |
if: always() | |
run: echo "REPO_NAME=$(basename ${{ github.repository }})" >> $GITHUB_ENV | |
- name: Send Slack Notification if execution Success | |
if: ${{ success() && env.ENV_FLAG == 'true'}} | |
run: | | |
curl -X POST -H 'Content-type: application/json' --data '{"attachments":[{"color": "#32CD32","blocks":[{"type":"header","text":{"type":"plain_text","text":"✅ Bahmni Standard E2E Tests Passed in ${{env.TARGET_ENV}} for tags ${{env.TEST_CONTEXT}}.","emoji":true}},{"type":"divider"},{"type":"section","text":{"type":"mrkdwn","text":"🧪 View the detailed HTML report here 👉"},"accessory":{"type":"button","text":{"type":"plain_text","text":"View"},"url":"https://${{github.repository_owner}}.github.io/${{env.REPO_NAME}}/report-${{GITHUB.RUN_ID}}-${{GITHUB.RUN_ATTEMPT}}"}},{"type":"section","text":{"type":"mrkdwn","text":"🧪 View Workflow Run Details 👉"},"accessory":{"type":"button","text":{"type":"plain_text","text":"View"},"url":"https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"}},{"type":"section","fields":[{"type":"plain_text","text":"RUN NUMBER - ${{ GITHUB.RUN_NUMBER }}","emoji":true},{"type":"plain_text","text":"RUN ID - ${{ GITHUB.RUN_ID }}","emoji":true}]}]}]}' ${{ secrets.SLACK_WEBHOOK_URL }} | |
- name: Send Slack Notification if execution Failure | |
if: ${{ failure() && env.ENV_FLAG == 'true'}} | |
run: | | |
curl -X POST -H 'Content-type: application/json' --data '{"attachments":[{"color": "#FF0000","blocks":[{"type":"header","text":{"type":"plain_text","text":"❌ Bahmni Standard E2E Tests Failed in ${{env.TARGET_ENV}} for tags ${{env.TEST_CONTEXT}}.","emoji":true}},{"type":"divider"},{"type":"section","text":{"type":"mrkdwn","text":"📌 View the detailed HTML report here 👉"},"accessory":{"type":"button","text":{"type":"plain_text","text":"View"},"url":"https://${{github.repository_owner}}.github.io/${{env.REPO_NAME}}/report-${{GITHUB.RUN_ID}}-${{GITHUB.RUN_ATTEMPT}}"}},{"type":"section","text":{"type":"mrkdwn","text":"📌 View Workflow Run Details 👉"},"accessory":{"type":"button","text":{"type":"plain_text","text":"View"},"url":"https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"}},{"type":"section","fields":[{"type":"plain_text","text":"RUN NUMBER - ${{ GITHUB.RUN_NUMBER }}","emoji":true},{"type":"plain_text","text":"RUN ID - ${{ GITHUB.RUN_ID }}","emoji":true}]}]}]}' ${{ secrets.SLACK_WEBHOOK_URL }} | |
- name: Send Slack Notification if Environment Not available | |
if: ${{(success() || failure()) && env.ENV_FLAG == 'false'}} | |
run: | | |
curl -X POST -H 'Content-type: application/json' --data '{"attachments":[{"color": "#FF8C00","blocks":[{"type":"header","text":{"type":"plain_text","text":"⚠️ Unable to execute Bahmni Standard E2E Tests in ${{env.TARGET_ENV}}, Environment is down.","emoji":true}},{"type":"divider"},{"type":"section","text":{"type":"mrkdwn","text":"📌 View Workflow Run Details 👉"},"accessory":{"type":"button","text":{"type":"plain_text","text":"View"},"url":"https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"}},{"type":"section","fields":[{"type":"plain_text","text":"RUN NUMBER - ${{ GITHUB.RUN_NUMBER }}","emoji":true},{"type":"plain_text","text":"RUN ID - ${{ GITHUB.RUN_ID }}","emoji":true}]}]}]}' ${{ secrets.SLACK_WEBHOOK_URL }} |