Skip to content

Latest code changes in the Reporter #74

Latest code changes in the Reporter

Latest code changes in the Reporter #74

Workflow file for this run

#
#
## * * * * *
## | | | | |
## | | | | +---- Day of the week (0 - 7) (Sunday is both 0 and 7)
## | | | +------ Month (1 - 12)
## | | +-------- Day of the month (1 - 31)
## | +---------- Hour (0 - 23)
## +------------ Minute (0 - 59)
#
#
#
#
#name: Selenium TestNG CI
#
#on:
# push:
# branches:
# - main
# pull_request:
# branches:
# - main
# schedule:
# - cron: '30 23 * * *' # This will run every day at 5 AM IST (11:30 PM UTC)
#
#jobs:
# build:
# runs-on: ubuntu-latest
#
# steps:
# # Step 1: Checkout the code
# - name: Checkout repository
# uses: actions/checkout@v2
#
# # Step 2: Set up JDK 16 (Ensure you are using Java 16)
# - name: Set up JDK 16
# uses: actions/setup-java@v2
# with:
# distribution: 'adopt'
# java-version: '16'
#
# # Step 3: Cache Maven dependencies for faster builds
# - name: Cache Maven dependencies
# uses: actions/cache@v2
# with:
# path: ~/.m2
# key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
# restore-keys: |
# ${{ runner.os }}-maven-
#
# # Step 4: Install Maven dependencies
# - name: Install dependencies
# run: mvn install -DskipTests
#
# # Step 5: Clean Temporary Reports Directory
# - name: Clean Temp Reports Directory
# run: |
# if [ -d "/tmp/reports" ]; then
# rm -rf /tmp/reports/*
# echo "Old temporary reports cleaned."
# else
# mkdir -p /tmp/reports
# echo "Created temporary reports directory."
# fi
#
# # Step 6: Run UI-Automation tests with Chrome browser
## - name: Run UI-Automation tests with Chrome browser
## run: mvn test -Dthread=3 -Dlaunch=remote # Adjust as necessary for your project
#
#
# # Step 5: Run multiple UI-Automation tests with Chrome browser
# - name: Run UI-Automation tests
# run: |
# mvn test -DsuiteXmlFile=suite1.xml
# mvn test -DsuiteXmlFile=suite2.xml
# mvn test -DsuiteXmlFile=testng.xml
#
# # Step 7: Upload Extent Report from Temporary Directory
# - name: Upload Extent Report as Artifact
# if: always()
# uses: actions/upload-artifact@v3 # Updated to v3 to avoid deprecation
# with:
# name: extent-report
# path: /tmp/reports/*.html # Upload from the temporary directory
# if-no-files-found: warn
#
# # Step 8: Send email with Extent Reports
# - name: Send email with Extent Reports
# if: always() # Ensure this step runs whether the build succeeds or fails
# uses: dawidd6/action-send-mail@v3
# with:
# server_address: smtp.gmail.com
# server_port: 465
# username: ${{ secrets.EMAIL_USERNAME }}
# password: ${{ secrets.EMAIL_PASSWORD }}
# subject: "Extent Report - Build ${{ github.run_number }}: ${{ job.status }}"
# body: |
# Hello,
#
# The UI Automation build ${{ github.run_number }} has completed with status: **${{ job.status }}**.
#
# Please find the attached Extent Reports.
#
# Regards,
# CI System
# to: "[email protected], [email protected]"
# from: "CI System <${{ secrets.EMAIL_USERNAME }}>"
# attachments: /tmp/reports/*.html # Attach reports from the temporary directory
#
#
## * * * * *
## | | | | |
## | | | | +---- Day of the week (0 - 7) (Sunday is both 0 and 7)
## | | | +------ Month (1 - 12)
## | | +-------- Day of the month (1 - 31)
## | +---------- Hour (0 - 23)
## +------------ Minute (0 - 59)
#
#
#
#
name: Selenium TestNG CI
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule: # Trigger daily at 5 AM IST (23:00 UTC)
- cron: '0 23 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code
- name: Checkout repository
uses: actions/checkout@v2
# Step 2: Set up JDK 16
- name: Set up JDK 16
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '16'
# Step 3: Cache Maven dependencies
- name: Cache Maven dependencies
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
# Step 4: Install Maven dependencies
- name: Install dependencies
run: mvn install -DskipTests
# Step 5: Create Reports Directories
- name: Create Reports Directories
run: |
mkdir -p /tmp/reports/suite1
mkdir -p /tmp/reports/suite2
mkdir -p /tmp/reports/testng
# Step 6: Run UI-Automation tests and save reports in separate directories
- name: Run UI-Automation tests
run: |
mvn test -DsuiteXmlFile=suite1.xml -Dtestng.output.dir=/tmp/reports/suite1
mvn test -DsuiteXmlFile=suite2.xml -Dtestng.output.dir=/tmp/reports/suite2
mvn test -DsuiteXmlFile=testng.xml -Dtestng.output.dir=/tmp/reports/testng
# Step 7: Upload all Extent Reports from the Temporary Directories
- name: Upload Extent Reports as Artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: extent-reports
path: /tmp/reports/**/*.html # Upload all HTML reports from all suite directories
if-no-files-found: warn
# Step 8: Send email with Extent Reports
- name: Send email with Extent Reports
if: always()
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.EMAIL_PASSWORD }}
subject: "Extent Reports - Build ${{ github.run_number }}: ${{ job.status }}"
body: |
Hello,
The UI Automation build ${{ github.run_number }} has completed with status: **${{ job.status }}**.
Please find the attached Extent Reports or view them at the deployed location.
Regards,
CI System
to: [email protected], [email protected], [email protected]
from: CI System <[email protected]>
attachments: /tmp/reports/**/*.html # Attach all generated HTML reports