GITHUB ACTIONS CI/CD PIPELINE: MAVEN RUNS, ALLURE PAGES & SECRETS

Architect enterprise-grade automated continuous delivery pipelines in GitHub Actions for REST Assured: Parallel test matrix orchestration via Maven Surefire, dependency caching (~/.m2), secure token and credential governance via GitHub Secrets, automated Allure Report publishing to GitHub Pages with historical trends, test retry gates, failure diagnostic artifact retention, and pull-request verification checks.

πŸš€ Continuous Integration Pipelines, Cloud Test Matrix & Automated Governance

An automated API test suite delivers maximum value only when integrated directly into the software development lifecycle via an automated Continuous Integration / Continuous Deployment (CI/CD) pipeline. Local test executions run in isolated workstations, but cloud runners subject tests to ephemeral Linux containers, headless networking environments, and concurrent merge workflows. GitHub Actions provides a native, scalable cloud orchestration platform for REST Assured frameworks. By coupling Apache Maven lifecycle commands (mvn clean test) with parallel TestNG suite executions, caching local ~/.m2/repository dependencies to cut build durations by over 70%, securing API credentials and private keys using GitHub Actions Secrets, publishing historicized Allure Reports to GitHub Pages, and capturing failure diagnostic dumps on red runs, automation architects build self-healing, zero-maintenance validation gates that safeguard production releases against regression bugs.

1. GitHub Actions CI/CD Maven Test Pipeline Topography
The end-to-end architectural workflow of the GitHub Actions CI/CD pipeline, detailing event triggers (push, pull_request, schedule), runner provisioning, dependency resolution, parallel execution, report publishing, and PR status gating.
GitHub Actions CI/CD Pipeline Lifecycle Topography
GITHUB ACTIONS CONTINUOUS INTEGRATION & ARTIFACT DELIVERY PIPELINE:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ EVENT TRIGGER: git push | pull_request (main / staging) | workflow_dispatch (Manual Run)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                β”‚
                                                β–Ό (Provisions ubuntu-latest Hosted Runner)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ STAGE 1: ENVIRONMENT PROVISIONING & DEPENDENCY HYDRATION                                      β”‚
β”‚  β”œβ”€β”€ actions/checkout@v4: Clones test codebase and git metadata                               β”‚
β”‚  β”œβ”€β”€ actions/setup-java@v4: Configures Eclipse Temurin JDK 17 with Maven toolchain            β”‚
β”‚  └── actions/cache@v4: Restores ~/.m2/repository cache (Reduces build time from 4m to 45s)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                β”‚
                                                β–Ό (Injects GitHub Secrets & Environment Variables)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ STAGE 2: PARALLEL TEST EXECUTION (Maven Surefire Lifecycle)                                   β”‚
β”‚  mvn clean test -DsuiteXmlFile=testng-ci.xml -Denv=staging                                    β”‚
β”‚                 -Dauth.token=${{ secrets.API_STAGING_TOKEN }}                                 β”‚
β”‚                 -Ddb.password=${{ secrets.RDBMS_SECRET_KEY }}                                 β”‚
β”‚  β”œβ”€β”€ TestNG distributes tests across 4 worker threads                                         β”‚
β”‚  β”œβ”€β”€ AllureRestAssured & DiagnosticBufferFilter intercept wire exchanges                      β”‚
β”‚  └── Telemetry output writes to target/allure-results & target/failure-dumps                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                β”‚
                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                     β–Ό (BRANCH A: ALL PASS)                                β–Ό (BRANCH B: ASSERTION FAILURE)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ STAGE 3A: REPORT COMPILATION & DEPLOYMENT    β”‚      β”‚ STAGE 3B: INCIDENT TRIAGE & NOTIFICATION     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€      β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 1. Download historic Allure data from gh-pagesβ”‚      β”‚ 1. actions/upload-artifact@v4: Uploads      β”‚
β”‚ 2. Compile report with historical trends     β”‚      β”‚    target/failure-dumps/*.log (Wire + cURL)  β”‚
β”‚ 3. Deploy HTML report to GitHub Pages        β”‚      β”‚ 2. Post detailed diagnostic comment to PR    β”‚
β”‚ 4. Update PR commit status: [CHECKS PASSED]  β”‚      β”‚ 3. Fail workflow: Block PR merge [FAST-FAIL] β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Architectural Standard: Test runners in CI are ephemeral. Tests must never assume persistent state, hardcoded localhost ports, or local filesystem artifacts. Storing secrets in GitHub Secrets and passing them via environment variables or Maven -D arguments guarantees clean, isolated, and repeatable test runs.
Real-Time Example 1: Production GitHub Actions Workflow (.github/workflows/api-tests.yml)
A comprehensive, enterprise-grade GitHub Actions YAML workflow. Features triggers on push and pull requests, JDK 17 provisioning, Maven dependency caching, secret injection, parallel test execution, and failure-tolerant post-steps.
YAML (.github/workflows/api-tests.yml)
name: Enterprise REST Assured API Regression Pipeline

on:
  push:
    branches: [ main, release/** ]
  pull_request:
    branches: [ main ]
  workflow_dispatch:
    inputs:
      targetEnvironment:
        description: 'Target Deployment Environment'
        required: true
        default: 'staging'
        type: choice
        options:
          - dev
          - qa
          - staging
          - prod_smoke
      testCategory:
        description: 'Test Group Category (TestNG)'
        required: true
        default: 'Regression'
        type: choice
        options:
          - Smoke
          - Regression
          - SecurityRBAC
          - SchemaContract

permissions:
  contents: write
  pages: write
  id-token: write
  pull-requests: write

jobs:
  api-regression-execution:
    name: Run REST Assured API Tests (${{ inputs.targetEnvironment || 'staging' }})
    runs-on: ubuntu-latest
    timeout-minutes: 30

    steps:
      # Step 1: Check out repository source code
      - name: Checkout Source Code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      # Step 2: Set up Java 17 Development Kit (Eclipse Temurin)
      - name: Set up JDK 17
        uses: actions/setup-java@v4
        with:
          java-version: '17'
          distribution: 'temurin'
          cache: 'maven'

      # Step 3: Cache Maven Local Repository (.m2/repository)
      - name: Cache Maven Dependencies
        uses: actions/cache@v4
        with:
          path: ~/.m2/repository
          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
          restore-keys: |
            ${{ runner.os }}-maven-

      # Step 4: Execute Parallel TestNG Suite via Maven
      - name: Execute Parallel REST Assured Test Suite
        env:
          ENV_TARGET: ${{ inputs.targetEnvironment || 'staging' }}
          TEST_GROUP: ${{ inputs.testCategory || 'Regression' }}
          API_AUTH_TOKEN: ${{ secrets.API_STAGING_TOKEN }}
          RDBMS_PASSWORD: ${{ secrets.DB_AUTOMATION_PASSWORD }}
        run: |
          echo "======================================================================"
          echo "LAUNCHING API REGRESSION: Environment: $ENV_TARGET | Group: $TEST_GROUP"
          echo "======================================================================"
          mvn clean test \
            -Denv=$ENV_TARGET \
            -Dgroups=$TEST_GROUP \
            -Dauth.token="$API_AUTH_TOKEN" \
            -Ddb.password="$RDBMS_PASSWORD" \
            -DsuiteXmlFile=src/test/resources/testng-parallel-suite.xml

      # Step 5: Archive Failure Diagnostic Dumps (Runs only on failure)
      - name: Archive Failure Diagnostics Artifacts
        if: failure()
        uses: actions/upload-artifact@v4
        with:
          name: api-failure-diagnostics-dump
          path: target/failure-dumps/*.log
          retention-days: 14

      # Step 6: Generate Allure Report Artifacts (Runs always, pass or fail)
      - name: Upload Raw Allure Results
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: raw-allure-results
          path: target/allure-results
          retention-days: 7
Workflow Execution Telemetry: Runner: ubuntu-latest | Java: 17.0.10 (Temurin) | Cache: Restored 184MB from ~/.m2/repository Executing: mvn clean test -Denv=staging -Dgroups=Regression ... Test Results: 450 Passed, 0 Failed, 0 Skipped (Duration: 1m 24s) Raw Allure results archived to GitHub Actions artifacts successfully.
Real-Time Example 2: Maven Surefire CI/CD Profile Configuration (pom.xml)
Configuring dedicated Maven CI profiles. Sets up maven-surefire-plugin with AspectJ Weaver, dynamic TestNG suite binding via -DsuiteXmlFile, thread-count overrides, and memory management (-Xms512m -Xmx2048m) tailored for CI runners.
XML (pom.xml Maven CI/CD Execution Profile)
<profiles>
    <!-- ==========================================================================
         PROFILE: ci-execution (Optimized for Headless CI/CD Runners)
         Usage: mvn clean test -Pci-execution -Denv=qa
    ========================================================================== -->
    <profile>
        <id>ci-execution</id>
        <activation>
            <property>
                <name>env</name>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.2.5</version>
                    <configuration>
                        <!-- JVM Memory Sizing for Ephemeral CI Containers -->
                        <argLine>
                            -Xms512m -Xmx2048m
                            -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                        </argLine>
                        <!-- Dynamic Suite File Binding with Fallback -->
                        <suiteXmlFiles>
                            <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
                        </suiteXmlFiles>
                        <!-- Concurrency Tuning Overrides -->
                        <properties>
                            <property>
                                <name>parallel</name>
                                <value>methods</value>
                            </property>
                            <property>
                                <name>dataproviderthreadcount</name>
                                <value>4</value>
                            </property>
                        </properties>
                        <systemPropertyVariables>
                            <allure.results.directory>${project.build.directory}/allure-results</allure.results.directory>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>
Surefire Profile Highlights: 1. -Xms512m -Xmx2048m: Allocates up to 2GB heap to prevent OutOfMemory errors during parallel payload processing. 2. AspectJ Weaver Agent: Injected via ${settings.localRepository} for Allure step interception. 3. ${suiteXmlFile}: Allows external control over which TestNG XML file is dispatched from the GitHub Actions workflow.
Real-Time Example 3: Automated Allure Report Publishing to GitHub Pages with History
Publishing historicized Allure reports. Shows how GitHub Actions downloads historical trend data from the gh-pages branch, compiles new test results, and publishes an updated HTML dashboard using peaceiris/actions-gh-pages.
YAML (GitHub Actions Job: Compile & Deploy Allure to GitHub Pages)
  publish-allure-dashboard:
    name: Generate & Deploy Allure Report to GitHub Pages
    needs: api-regression-execution
    if: always()
    runs-on: ubuntu-latest

    steps:
      # Step 1: Checkout gh-pages branch to preserve historical test run trends
      - name: Checkout GitHub Pages History
        uses: actions/checkout@v4
        if: always()
        continue-on-error: true
        with:
          ref: gh-pages
          path: gh-pages-branch

      # Step 2: Download raw allure results artifact generated in previous job
      - name: Download Raw Allure Results
        uses: actions/download-artifact@v4
        with:
          name: raw-allure-results
          path: allure-results

      # Step 3: Copy previous historical trends into current allure-results directory
      - name: Preserve Allure History Trends
        run: |
          if [ -d "gh-pages-branch/history" ]; then
            echo "[*] Copying existing Allure history into current run..."
            cp -r gh-pages-branch/history allure-results/
          fi

      # Step 4: Install Allure CLI & Compile Standalone HTML Report
      - name: Install Allure CLI & Generate HTML Report
        run: |
          sudo npm install -g allure-commandline --loglevel error
          allure generate allure-results --clean -o allure-report
          echo "[*] Allure report compiled successfully."

      # Step 5: Copy new history back to report for next execution
      - name: Copy Back New History
        run: |
          cp -r allure-report/history allure-results/

      # Step 6: Deploy compiled dashboard to GitHub Pages branch (gh-pages)
      - name: Deploy Allure Dashboard to GitHub Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_branch: gh-pages
          publish_dir: allure-report
          user_name: 'github-actions[bot]'
          user_email: 'github-actions[bot]@users.noreply.github.com'
Allure Publishing Telemetry: [*] Copying existing Allure history into current run... Successfully generated report to [allure-report] Deploying to branch [gh-pages]... Published report live URL: https://nikita-infotech.github.io/rest-assured-masterclass/ Preserves historical pass/fail trend graphs and duration analytics across builds.
Real-Time Example 4: Secure Credentials & Secrets Governance in GitHub Actions
Safeguarding enterprise credentials in CI/CD. Demonstrates mapping GitHub Secrets into environment variables, avoiding command-line logging leaks, and writing a helper class that reads secrets securely inside REST Assured tests.
YAML & Java: Secure Secret Injection Architecture
# ==============================================================================
# SECURE SECRETS MAPPING IN GITHUB ACTIONS WORKFLOW STEP
# ==============================================================================
# - name: Run Authenticated Tests
#   env:
#     # Map repository secrets to environment variables (DO NOT PASS SECRETS IN CLI ARGS!)
#     API_BEARER_TOKEN: ${{ secrets.PROD_API_BEARER_TOKEN }}
#     DATABASE_PASS: ${{ secrets.RDBMS_SECRET_PASSWORD }}
#     PHONEPE_API_KEY: ${{ secrets.PHONEPE_MERCHANT_KEY }}
#   run: |
#     # Secrets are read securely from OS environment variables by the test runner:
#     mvn test -DsuiteXmlFile=src/test/resources/testng-auth-suite.xml
Java (CiSecretManager.java Secure Runtime Token Provider)
package com.nikita.restassured.ci;

public class CiSecretManager {

    /**
     * Retrieves sensitive secrets securely, checking OS environment variables first,
     * then falling back to local system properties for developer workstations.
     */
    public static String getSecret(String secretKey, String fallbackDefault) {
        // Priority 1: Check OS Environment Variable (Set securely by GitHub Actions)
        String envValue = System.getenv(secretKey);
        if (envValue != null && !envValue.trim().isEmpty()) {
            return envValue.trim();
        }

        // Priority 2: Check System Property (Local IDE run: -DsecretKey=...)
        String propValue = System.getProperty(secretKey.toLowerCase().replace('_', '.'));
        if (propValue != null && !propValue.trim().isEmpty()) {
            return propValue.trim();
        }

        // Priority 3: Return fallback default
        return fallbackDefault;
    }

    public static String getApiBearerToken() {
        return getSecret("API_BEARER_TOKEN", "default_local_dev_token");
    }

    public static String getDatabasePassword() {
        return getSecret("DATABASE_PASS", "LocalDevPass#2026");
    }
}
Security Compliance Standard: Never execute: mvn test -Dtoken=${{ secrets.TOKEN }}! Passing secrets as command-line arguments exposes them in process listings (ps aux) and terminal logs. Always inject secrets into OS environment variables (env: TOKEN: ${{ secrets.TOKEN }}), which are masked automatically by GitHub Actions runner daemons.
Real-Time Example 5: Automated Pull Request Status Checks & Quality Gating
Protecting the main branch with quality gates. Configures a GitHub Actions step that posts an automated markdown summary comment directly to the active Pull Request, detailing test pass rates and linking to failure diagnostics.
YAML (PR Status Commenter Step via actions/github-script)
      # Step: Post Test Summary Comment to Pull Request
      - name: Post PR Test Summary Comment
        if: always() && github.event_name == 'pull_request'
        uses: actions/github-script@v7
        with:
          script: |
            const fs = require('fs');
            const outcome = '${{ job.status }}';
            const icon = outcome === 'success' ? 'βœ…' : '❌';

            let commentBody = `### ${icon} REST Assured API Regression Summary\n\n`;
            commentBody += `* **Status:** \`${outcome.toUpperCase()}\`\n`;
            commentBody += `* **Environment:** \`${process.env.ENV_TARGET || 'staging'}\`\n`;
            commentBody += `* **Commit:** \`${context.sha.substring(0, 7)}\`\n`;
            commentBody += `* **Allure Report:** [View Live Dashboard](https://nikita-infotech.github.io/rest-assured-masterclass/)\n\n`;

            if (outcome !== 'success') {
              commentBody += `> ⚠️ **Attention:** API regression failures detected! Inspect the attached \`api-failure-diagnostics-dump\` artifact for exact wire dumps and cURL reproduction scripts.\n`;
            } else {
              commentBody += `> πŸš€ **All API contracts and functional regression suites verified successfully.** Ready for merge.\n`;
            }

            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: commentBody
            });
Pull Request Comment Output: ### βœ… REST Assured API Regression Summary * **Status:** `SUCCESS` * **Environment:** `staging` * **Commit:** `4f8a10c` * **Allure Report:** [View Live Dashboard](https://nikita-infotech.github.io/rest-assured-masterclass/) > πŸš€ **All API contracts and functional regression suites verified successfully.** Ready for merge.
Real-Time Example 6: Automated Flaky Test Retry Governance via Surefire rerunFailingTestsCount
Preventing false-positive CI build breaks from transient network blips. Configures rerunFailingTestsCount in maven-surefire-plugin to automatically re-execute failing tests up to two times before flagging a true failure.
XML (pom.xml Surefire Automated Flaky Test Retry Configuration)
<!-- ==============================================================================
     MAVEN SUREFIRE AUTOMATED RETRY CONFIGURATION: rerunFailingTestsCount
============================================================================== -->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.2.5</version>
    <configuration>
        <!-- Re-executes any failing test up to 2 times automatically before failing build -->
        <rerunFailingTestsCount>2</rerunFailingTestsCount>
        
        <suiteXmlFiles>
            <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
        </suiteXmlFiles>
        <systemPropertyVariables>
            <allure.results.directory>${project.build.directory}/allure-results</allure.results.directory>
        </systemPropertyVariables>
    </configuration>
</plugin>
Surefire Retry Telemetry: [INFO] Running com.nikita.restassured.tests.StudentRegistrationTest [ERROR] Failures: 1 (Transient 503 Gateway Timeout) [INFO] Flakes: 1 [INFO] StudentRegistrationTest.testRegistration: Run 1: Failed, Run 2: Passed [INFO] Tests run: 450, Failures: 0, Errors: 0, Skipped: 0, Flakes: 1 [INFO] BUILD SUCCESS Allure Report categorizes the test with a distinct yellow 'Flaky' badge while preventing the build from failing.
Real-Time Example 7: Matrix Builds Across Multiple Java & Environment Targets
Executing parallel matrix builds across diverse targets. Demonstrates configuring a GitHub Actions strategy: matrix to run the same REST Assured test suite across multiple Java runtime versions (JDK 17 and JDK 21) or environments simultaneously.
YAML (Matrix Strategy Execution across Environments & JDKs)
name: Multi-Environment Matrix API Regression

on:
  schedule:
    # Executes nightly at 02:00 AM UTC
    - cron: '0 2 * * *'
  workflow_dispatch:

jobs:
  matrix-api-execution:
    name: Test ${{ matrix.environment }} on Java ${{ matrix.java-version }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false # Do not cancel other matrix jobs if one environment fails
      matrix:
        environment: [ dev, qa, staging ]
        java-version: [ '17', '21' ]

    steps:
      - name: Checkout Code
        uses: actions/checkout@v4

      - name: Set up Java ${{ matrix.java-version }}
        uses: actions/setup-java@v4
        with:
          java-version: ${{ matrix.java-version }}
          distribution: 'temurin'
          cache: 'maven'

      - name: Execute Suite on Target Matrix Node
        run: |
          mvn clean test \
            -Denv=${{ matrix.environment }} \
            -DsuiteXmlFile=src/test/resources/testng-parallel-suite.xml
Matrix Grid Execution Output: βœ“ Matrix Job 1: dev on Java 17 ──► Passed (1m 18s) βœ“ Matrix Job 2: dev on Java 21 ──► Passed (1m 12s) βœ“ Matrix Job 3: qa on Java 17 ──► Passed (1m 24s) βœ“ Matrix Job 4: qa on Java 21 ──► Passed (1m 20s) βœ“ Matrix Job 5: staging on Java 17 ──► Passed (1m 32s) βœ“ Matrix Job 6: staging on Java 21 ──► Passed (1m 28s) Ensures framework compatibility across both LTS Java releases and deployment stages concurrently.
Real-Time Example 8: Debugging GitHub Actions CI Failures & Runner Triage
Troubleshooting common GitHub Actions pipeline failures: diagnosing missing secrets in pull requests from forks, resolving Maven cache permission errors, handling headless container timezone discrepancies, and debugging out-of-memory container crashes.
Java & YAML (Triage: Diagnosing Missing Secrets & Container Discrepancies)
package com.nikita.restassured.ci;

import org.testng.Assert;
import org.testng.annotations.Test;

public class CiPipelineTriageTest {

    // ==========================================================================
    // PITFALL 1: PULL REQUESTS FROM FORKS LACK ACCESS TO REPOSITORY SECRETS
    // Symptom: Tests pass on 'push' to main, but fail on 'pull_request' with 401 Unauthorized!
    //
    // CAUSE: By default, GitHub Actions withholds repository secrets from workflows
    // triggered by forks to prevent malicious PRs from exfiltrating sensitive tokens.
    //
    // FIX: Provide mock or sandbox fallback tokens for fork workflows, or use
    // the 'pull_request_target' trigger with strict path auditing!
    // ==========================================================================

    @Test(description = "Verify fallback credentials engage when secrets are withheld on fork PRs")
    public void testSecretFallbackGracefulness() {
        String token = CiSecretManager.getApiBearerToken();
        Assert.assertNotNull(token, "Token must never be null in CI execution!");
        
        System.out.println("[*] CI Secret Verification: Successfully resolved credential token.");
    }

    // ==========================================================================
    // PITFALL 2: TIMEZONE DRIFT BETWEEN LOCAL WORKSTATION AND UBUNTU-LATEST RUNNER
    // Local workstation runs in IST (UTC+5:30); GitHub Actions runs in UTC (GMT)!
    // Date/time assertions like LocalDateTime.now() fail by 5.5 hours in CI!
    //
    // FIX: Always use Instant.now() with UTC timestamps or configure user.timezone:
    // -Duser.timezone=UTC
    // ==========================================================================
}
Triage Diagnostic Breakdown: - Missing Secrets on Forks: Fallback to sandbox tokens implemented in CiSecretManager. - Timezone Drift: Set -Duser.timezone=UTC in Maven surefire argLine; eliminates IST/UTC mismatch errors. - OutOfMemory Container Aborts: Configured -Xms512m -Xmx2048m to prevent Linux OOM-killer kills.
Real-Time Example 9: GitHub Actions CI/CD Specification Reference Matrix
A comprehensive reference summary pairing GitHub Actions workflow syntax, Maven CLI arguments, pipeline steps, and operational best practices for REST Assured continuous integration.
GitHub Actions CI/CD Specification Reference Matrix
GITHUB ACTIONS & MAVEN CI/CD SPECIFICATION MATRIX:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ACTION / CONSTRUCT      β”‚ SYNTAX EXAMPLE               β”‚ WORKFLOW SCOPE   β”‚ PRIMARY OPERATIONAL PURPOSE      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ actions/checkout@v4     β”‚ uses: actions/checkout@v4    β”‚ Initial Step     β”‚ Clones repository and history    β”‚
β”‚ actions/setup-java@v4   β”‚ with: java-version: '17'     β”‚ Environment Setupβ”‚ Provisions JDK with caching      β”‚
β”‚ actions/cache@v4        β”‚ path: ~/.m2/repository       β”‚ Dependency Cache β”‚ Speeds up Maven builds by 70%+   β”‚
β”‚ actions/upload-artifact β”‚ uses: actions/upload-artifactβ”‚ Post-Execution   β”‚ Preserves test logs & dumps      β”‚
β”‚ actions-gh-pages@v3     β”‚ publish_branch: gh-pages     β”‚ Deployment Step  β”‚ Publishes Allure report to web   β”‚
β”‚ github-script@v7        β”‚ github.rest.issues.create..  β”‚ PR Step          β”‚ Posts status comments to PR      β”‚
β”‚ ${{ secrets.SECRET_KEY }}β”‚ env: TOKEN: ${{ secrets... }}β”‚ Step Environment β”‚ Masks credentials in logs       β”‚
β”‚ workflow_dispatch       β”‚ on: workflow_dispatch: inputsβ”‚ Workflow Trigger β”‚ Enables manual parameterized runsβ”‚
β”‚ cron Schedule           β”‚ on: schedule: - cron: '0 2..'β”‚ Workflow Trigger β”‚ Runs nightly regression builds   β”‚
β”‚ matrix Strategy         β”‚ matrix: { env: [dev, qa] }   β”‚ Job Strategy     β”‚ Multi-environment parallel runs  β”‚
β”‚ rerunFailingTestsCount  β”‚ <rerunFailingTestsCount>2</..β”‚ Surefire Config  β”‚ Auto-retries flaky test blips    β”‚
β”‚ -DsuiteXmlFile          β”‚ -DsuiteXmlFile=testng.xml    β”‚ Maven CLI Arg    β”‚ Selects TestNG suite dynamically β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ TOP 5 GITHUB ACTIONS CI/CD BEST PRACTICES:                                                                   β”‚
β”‚ 1. Always cache ~/.m2/repository: Drastically reduce build times by reusing downloaded dependencies.         β”‚
β”‚ 2. Never pass secrets via CLI arguments: Inject secrets into OS environment variables to prevent leaks.      β”‚
β”‚ 3. Use rerunFailingTestsCount=2: Prevent transient network blips from breaking pull-request builds.          β”‚
β”‚ 4. Publish Allure to GitHub Pages with history: Maintain visual trends and pass rates across releases.       β”‚
β”‚ 5. Archive failure logs using if: failure(): Capture diagnostic dumps only when tests actually fail.         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Engineering Best Practice: A production-ready GitHub Actions pipeline transforms automated REST Assured tests from a developer-side script into an automated quality gate. By combining parallel Maven Surefire execution, ~/.m2 dependency caching, secure environment variable secret mapping, automated Allure publishing to GitHub Pages, and pull-request verification comments, you ensure every code change is validated thoroughly before merging into production.