Yaml update #17
This file contains hidden or 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: Evri API Test Suite | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 6 * * 1-5' # Run at 6 AM UTC, Monday-Friday | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| java-version: [21] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK ${{ matrix.java-version }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ matrix.java-version }} | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Cache Maven packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2 | |
| - name: Configure API credentials | |
| run: | | |
| mkdir -p src/test/resources | |
| echo "parcelshop.base.uri=${{ secrets.PARCELSHOP_BASE_URI }}" > src/test/resources/config.properties | |
| echo "parcelshop.base.path=${{ secrets.PARCELSHOP_BASE_PATH }}" >> src/test/resources/config.properties | |
| echo "parcelshop.api.key=${{ secrets.PARCELSHOP_API_KEY }}" >> src/test/resources/config.properties | |
| - name: Run tests | |
| run: mvn clean test -Dtest=ParcelShopCucumberRunner | |
| continue-on-error: true | |
| - name: Generate Allure Report | |
| if: always() | |
| run: mvn allure:report | |
| - name: Upload TestNG Reports | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: testng-reports | |
| path: target/surefire-reports/ | |
| retention-days: 30 | |
| - name: Upload ExtentReports | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: extent-reports | |
| path: target/extent-reports/ | |
| retention-days: 30 | |
| - name: Upload Allure Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: allure-results | |
| path: target/allure-results/ | |
| retention-days: 30 | |
| - name: Upload Allure Report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: allure-report | |
| path: target/site/allure-maven-plugin/ | |
| retention-days: 30 | |
| - name: Publish Test Results Summary | |
| if: always() | |
| uses: dorny/test-reporter@v1 | |
| with: | |
| name: Test Results | |
| path: target/surefire-reports/TEST-*.xml | |
| reporter: java-junit | |
| fail-on-error: false | |
| - name: Comment PR with test results | |
| if: github.event_name == 'pull_request' && always() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const testResults = fs.existsSync('target/surefire-reports/testng-results.xml'); | |
| const comment = testResults | |
| ? '✅ Tests completed! Check artifacts for detailed reports.' | |
| : '❌ Tests failed or did not run. Check logs for details.'; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: comment | |
| }); | |
| - name: Notify on failure | |
| if: failure() | |
| run: echo "::error::Evri API tests failed. Check reports for details." | |
| code-quality: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: 'temurin' | |
| - name: Verify code compilation | |
| run: mvn clean compile | |
| - name: Check dependencies for vulnerabilities | |
| run: mvn dependency:tree | |
| continue-on-error: true | |
| - name: Display project info | |
| run: | | |
| echo "Project: Evri API Test Framework" | |
| echo "Java Version: $(java -version 2>&1 | head -1)" | |
| echo "Maven Version: $(mvn --version | head -1)" |