first commit #4
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: 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 |