Skip to content

Commit 5595b30

Browse files
authored
Add CI workflow for Maven TestNG automation
This workflow automates Maven TestNG tests on push and pull request events, caching dependencies and uploading reports.
1 parent 581d5d1 commit 5595b30

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Maven TestNG Automation Pipeline
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
jobs:
9+
run-tests:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
14+
# 1. Checkout code
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
# 2. Setup Java
19+
- name: Set up JDK 17
20+
uses: actions/setup-java@v4
21+
with:
22+
distribution: "temurin"
23+
java-version: "17"
24+
25+
# 3. Cache Maven dependencies (speeds up builds)
26+
- name: Cache Maven packages
27+
uses: actions/cache@v4
28+
with:
29+
path: ~/.m2/repository
30+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
31+
restore-keys: |
32+
${{ runner.os }}-maven-
33+
34+
# 4. Run Maven Tests
35+
- name: Run TestNG tests
36+
run: mvn clean test
37+
38+
# 5. Upload ExtentReport (HTML)
39+
- name: Upload Extent Reports
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: extent-report
43+
path: |
44+
**/test-output/**
45+
**/ExtentReports/**
46+
**/extent-report/**
47+
**/reports/**
48+
retention-days: 7

0 commit comments

Comments
 (0)