Skip to content

Updated to push

Updated to push #12

name: PR Checks
on:
push:
branches:
- '**'
jobs:
build-and-test:
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: ${{ secrets.CLOUD_STORE_GROUP_ID }}
CLOUD_STORE_ARTIFACT_ID: ${{ secrets.CLOUD_STORE_ARTIFACT_ID }}
CLOUD_STORE_VERSION: ${{ secrets.CLOUD_STORE_VERSION }}
run: |
mvn clean install -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: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
**/target/
content-api/content-service/target/site/jacoco/
- 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
code-quality:
runs-on: ubuntu-latest
needs: build-and-test
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
- 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