Skip to content

Update to take it in a single job #13

Update to take it in a single job

Update to take it in a single job #13

name: PR Checks
on:
push:
branches:
- '**'
jobs:
build-test-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: 'maven'
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build and Run Tests
env:
CLOUD_STORE_GROUP_ID: ${{ vars.CLOUD_STORE_GROUP_ID }}
CLOUD_STORE_ARTIFACT_ID: ${{ vars.CLOUD_STORE_ARTIFACT_ID }}
CLOUD_STORE_VERSION: ${{ vars.CLOUD_STORE_VERSION }}
run: |
mvn clean install -DskipTests \
-DCLOUD_STORE_GROUP_ID="${CLOUD_STORE_GROUP_ID}" \
-DCLOUD_STORE_ARTIFACT_ID="${CLOUD_STORE_ARTIFACT_ID}" \
-DCLOUD_STORE_VERSION="${CLOUD_STORE_VERSION}"
cd content-api/content-service/
mvn clean verify
- name: Generate Coverage Report
run: |
cd content-api/content-service/
mvn org.jacoco:jacoco-maven-plugin:0.8.8:prepare-agent test org.jacoco:jacoco-maven-plugin:0.8.8:report
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: 'content-api/content-service/target/surefire-reports/*.xml'
- name: Publish Test Results to PR
if: always()
uses: dorny/test-reporter@v1
with:
name: Test Results
path: content-api/content-service/target/surefire-reports/*.xml
reporter: java-junit
fail-on-error: true
- name: SonarCloud Analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_1 }}
run: |
mvn sonar:sonar \
-Dsonar.projectKey=vinodbhorge \
-Dsonar.organization=vinodbhorge \
-Dsonar.login=$SONAR_TOKEN \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.coverage.jacoco.xmlReportPaths=content-api/content-service/target/site/jacoco/jacoco.xml