Skip to content

Commit

Permalink
Add submissions/shared SonarCloud scans (#15662)
Browse files Browse the repository at this point in the history
* Add submissions/shared SonarCloud scans

* build submissions
  • Loading branch information
snesm authored Aug 27, 2024
1 parent 2792eb4 commit 27e0ee2
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 3 deletions.
70 changes: 70 additions & 0 deletions .github/actions/build-submissions/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# action.yml
name: "Build Submissions"
description: "Build submissions microservice"
inputs:
version:
description: "Version tag"
required: true
upload-build:
default: true
run-integration-tests:
default: false
run-qc:
default: false
github-token:
default: false
sp-creds:
description: "Azure Service Principal creds"

runs:
using: "composite"
steps:
# These are for CI and not credentials of any system
- name: Set Environment Variables
working-directory: prime-router
shell: bash
run: |
echo >> $GITHUB_ENV DB_USER='prime'
echo >> $GITHUB_ENV DB_PASSWORD='changeIT!'
- name: Remove unnecessary software
shell: bash
run: |
sudo rm -rf /usr/local/lib/android
- name: Set up JDK 17
uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018
with:
java-version: "17"
distribution: "temurin"
cache: "gradle"

- uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582

- name: Lint
if: inputs.run-integration-tests == 'true'
run: ./gradlew :submissions:ktlintCheck
shell: bash

- name: Spin up build containers
working-directory: prime-router
shell: bash
run: docker compose -f docker-compose.postgres.yml up -d

- name: Build Submissions Package
uses: ./.github/actions/retry
with:
timeout_minutes: 10
max_attempts: 2
retry_wait_seconds: 30
command: |
./gradlew :submissions:build -x test
shell: bash

- name: Cleanup Gradle Cache
if: inputs.run-integration-tests == 'true'
working-directory: prime-router
run: |
rm -f .gradle/caches/modules-2/modules-2.lock
rm -f .gradle/caches/modules-2/gc.properties
shell: bash
6 changes: 3 additions & 3 deletions .github/actions/sonarcloud/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ runs:
args: >
-Dsonar.coverage.exclusions=prime-router/src/test/**,prime-router/src/testIntegration/**,prime-router/src/main/kotlin/cli/tests/**,frontend-react/**/__mocks__/**,frontend-react/**/mocks/**,frontend-react/**/*.test.*
-Dsonar.cpd.exclusions=frontend-react/**/*.test.*,prime-router/src/test/**,prime-router/src/testIntegration/**,prime-router/src/main/kotlin/cli/tests/**
-Dsonar.sources=frontend-react/src,prime-router/src
-Dsonar.sources=frontend-react/src,prime-router/src,submissions/src,shared/src
-Dsonar.projectKey=CDCgov_prime-data-hub
-Dsonar.organization=cdcgov
-Dsonar.java.binaries=prime-router/build/classes/java/main,prime-router/build/classes/kotlin/main
-Dsonar.java.libraries=prime-router/build/libs/*.jar,prime-router/build/**/*.jar
-Dsonar.java.binaries=prime-router/build/classes/java/main,prime-router/build/classes/kotlin/main,submissions/build/classes/kotlin/main,shared/build/classes/kotlin/main
-Dsonar.java.libraries=prime-router/build/libs/*.jar,prime-router/build/**/*.jar,submissions/build/**/*.jar,shared/build/**/*.jar
-Dsonar.coverage.jacoco.xmlReportPaths=prime-router/build/reports/jacoco/test/jacocoTestReport.xml
-Dsonar.javascript.lcov.reportPaths=frontend-react/coverage/lcov.info
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ jobs:
command: ./gradlew -Dorg.gradle.jvmargs="-Xmx6g" :prime-router:package -x fatjar
shell: bash

- name: Build Submissions Package
if: steps.changed-files-yaml.outputs.backend_any_changed == 'true' || steps.branch-name.outputs.is_default == 'true'
uses: ./.github/actions/build-submissions

- name: Perform Java CodeQL Analysis
if: steps.changed-files-yaml.outputs.backend_any_changed == 'true' || steps.branch-name.outputs.is_default == 'true'
uses: github/codeql-action/analyze@v3
Expand Down

0 comments on commit 27e0ee2

Please sign in to comment.