Skip to content

breaking: P4ADEV-1930 update github actions (#13) #44

breaking: P4ADEV-1930 update github actions (#13)

breaking: P4ADEV-1930 update github actions (#13) #44

Workflow file for this run

name: TEMPLATE-PAYMENTS - Code Review
on:
push:
branches: [ main, uat, develop ]
pull_request:
types: [ opened, edited, synchronize ]
branches: [ main, uat, develop ]
env:
JAVA_VERSION: '21'
JAVA_DISTRIBUTION: 'corretto'
jobs:
code-review:
name: Code Review & Quality Analysis
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run Tests & Coverage
id: tests
run: ./gradlew clean build jacocoTestReport --info
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=${{ vars.SONARCLOUD_ORG }}
-Dsonar.projectKey=${{ vars.SONARCLOUD_PROJECT_KEY }}
-Dsonar.sources=src/main
-Dsonar.tests=src/test
-Dsonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml
-Dsonar.exclusions='**/enums/**, **/model/**, **/dto/**, **/*Constant*, **/*Config.java, **/*Scheduler.java, **/*Application.java, **/src/test/**, **/Dummy*.java'
-Dsonar.qualitygate.wait=true
- name: SonarQube Quality Gate check
uses: sonarsource/sonarqube-quality-gate-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
scanMetadataReportFile: .scannerwork/report-task.txt
- name: Save Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ github.run_id }}
path: build/reports/tests/
retention-days: 7
- name: Save Coverage Results
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-reports-${{ github.run_id }}
path: build/reports/jacoco/
retention-days: 7
- name: Merge Reports
if: always()
uses: actions/upload-artifact/merge@v4
with:
name: all-reports-${{ github.run_id }}
pattern: '*-reports-${{ github.run_id }}'
retention-days: 7