Skip to content

Latest code changes in the Reporter #63

Latest code changes in the Reporter

Latest code changes in the Reporter #63

Workflow file for this run

#
#name: Selenium TestNG CI
#
#on:
# push:
# branches:
# - main
# pull_request:
# branches:
# - main
#
#jobs:
# build:
# runs-on: ubuntu-latest
#
# steps:
# # Step 1: Checkout the code
# - name: Checkout repository
# uses: actions/checkout@v2
#
# # Step 2: Set up Java environment
# - name: Set up JDK 11
# uses: actions/setup-java@v2
# with:
# distribution: 'adopt'
# java-version: '11'
#
# # 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: Run TestNG tests
# - name: Run TestNG tests
# run: mvn test
#
# # Step 6: Generate Extent Reports (optional)
# - name: Upload TestNG Extent Reports
# uses: actions/upload-artifact@v2
# with:
# name: extent-reports
# path: target/extent-reports/ # Adjust this path to your reports folder
#name: Selenium TestNG CI
#
#on:
# push:
# branches:
# - main
# pull_request:
# branches:
# - main
#
#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: Run TestNG tests
# - name: Run TestNG tests
# run: mvn test
#
# # Step 6: Upload Extent Reports
# - name: Upload TestNG Extent Reports
# uses: actions/upload-artifact@v3
# with:
# name: extent-reports
# path: Reports
#name: Selenium TestNG CI
#
#on:
# push:
# branches:
# - main
# pull_request:
# branches:
# - main
#
#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 4: 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 4: 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: Generate Extent Report
# - name: Generate Extent Report
# if: always() # Ensure report generation runs regardless of test success/failure
# run: mvn site # Adjust this to your Extent report generation command
#
# # Step 6: Deploy Extent Report
# - name: Deploy Extent Report
# if: always()
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GH_TOKEN }} # Use the secret created
# publish_branch: gh-pages
# publish_dir: target/extent-reports
# env:
# JAVA_HOME: /opt/hostedtoolcache/Java_Adopt_jdk/16.0.2-7/x64
#
# # Step 7: Upload Extent Report as Artifact using the latest version (v3)
# - name: Upload Extent Report as Artifact
# if: always()
# uses: actions/upload-artifact@v3 # Updated to v3 to avoid deprecation
# with:
# name: extent-report
# path: Reports/* # Update to your report directory path
#
# # Step 8: Send email with Extent Reports (Optional)
# - 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 or view them at the deployed location.
#
# Regards,
# CI System
# to: [email protected], [email protected], [email protected]
# from: CI System <[email protected]>
# attachments: target/extent-reports/*.html # Attach Extent HTML reports
#
#
#
# # Step 6: Set the report path and ensure the directory exists
# - name: Set report path
# id: set_report_path
# run: |
# REPORT_DIR=$(pwd)/Reports
# if [ -d "$REPORT_DIR" ]; then
# echo "REPORT_PATH=$REPORT_DIR" >> $GITHUB_ENV
# else
# echo "No reports directory found!"
# exit 1
# fi # Closing the if block properly
#
# # Step 7: Upload reports as artifacts (Optional)
# - name: Upload TestNG Reports
# uses: actions/upload-artifact@v3
# with:
# name: TestNG-Extent-Reports
# path: ${{ env.REPORT_PATH }}/*.html # This will upload all HTML reports
#
# # Step 8: Send email with TestNG Extent Reports
# - name: Send email with TestNG 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 }} # Set up as a secret in GitHub
# password: ${{ secrets.EMAIL_PASSWORD }} # Set up as a secret in GitHub
# subject: "TestNG Automation Report - Build ${{ github.run_number }}: ${{ job.status }}"
# body: |
# Hello,
#
# The TestNG Automation build ${{ github.run_number }} has completed with status: **${{ job.status }}**.
#
# You can download the TestNG Extent Reports from the attached files.
#
# Regards,
# CI System
# to: [email protected], [email protected], [email protected]
# from: CI System <[email protected]>
# attachments: ${{ env.REPORT_PATH }}/*.html # Attach all HTML reports in the Reports directory
# # Step 6: Set the report path
# - name: Set report path
# id: set_report_path
# run: |
# echo "REPORT_PATH=$(pwd)/Reports" >> $GITHUB_ENV
#
# # Step 7: Send email with TestNG Extent Reports
# - name: Send email with TestNG 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 }} # Set up as a secret in GitHub
# password: ${{ secrets.EMAIL_PASSWORD }} # Set up as a secret in GitHub
# subject: "TestNG Automation Report - Build ${{ github.run_number }}: ${{ job.status }}"
# body: |
# Hello,
#
# The TestNG 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], [email protected]
# from: CI System <[email protected]>
# attachments: ${{ env.REPORT_PATH }}/*.html # Attach all HTML reports in the Reports directory
#
# # Step 6: Upload TestNG Extent Reports
# - name: Upload TestNG Extent Reports
# uses: actions/upload-artifact@v3
# with:
# name: extent-reports
# path: Reports
#
# # Step 7: Set up report file paths
# - name: Prepare report file paths
# id: report-files
# run: |
# echo "REPORT_FILES<<EOF" >> $GITHUB_ENV
# for file in Reports/*; do
# echo "$file" >> $GITHUB_ENV
# done
# echo "EOF" >> $GITHUB_ENV
#
# # Step 8: Send email with TestNG Extent Reports (Runs on both success and failure)
# - name: Send email with TestNG 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 }} # Set up as a secret in GitHub
# password: ${{ secrets.EMAIL_PASSWORD }} # Set up as a secret in GitHub
# subject: "TestNG Automation Report - Build ${{ github.run_number }}: ${{ job.status }}"
# body: |
# Hello,
#
# The TestNG 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], [email protected]" # Replace with actual recipient emails
# from: CI System <[email protected]>
# attachments: ${{ env.REPORT_FILES }} # Attach individual report files
#
#
# # Step 6: Upload TestNG Extent Reports
# - name: Upload TestNG Extent Reports
# uses: actions/upload-artifact@v3
# with:
# name: extent-reports
# path: Reports/** # Ensure this path matches the actual path of the Extent Report
#
# # Step 7: Send email with TestNG Extent Reports (Runs on both success and failure)
# - name: Send email with TestNG 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 }} # Set up as a secret in GitHub
# password: ${{ secrets.EMAIL_PASSWORD }} # Set up as a secret in GitHub
# subject: "TestNG Automation Report - Build ${{ github.run_number }}: ${{ job.status }}"
# body: |
# Hello,
#
# The Automation build ${{ github.run_number }} has completed with status: **${{ job.status }}**.
#
# Please find the attached Extent Reports.
#
# Regards,
# Amol K
# to: [email protected], [email protected] # Replace with actual recipient email
# from: CI System <[email protected]>
# attachments: Reports/TestSuite.html # Ensure this is the correct path to the report file
name: Selenium TestNG CI
on:
push:
branches:
- main
pull_request:
branches:
- main
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 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], [email protected], [email protected]"
from: "CI System <${{ secrets.EMAIL_USERNAME }}>"
attachments: /tmp/reports/*.html # Attach reports from the temporary directory