PLT-190 Update workflows for docker image promotion #280
This file contains 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: Unit tests and static analysis | |
on: | |
pull_request: | |
workflow_call: | |
workflow_dispatch: # Allow manual trigger | |
jobs: | |
test: | |
runs-on: self-hosted | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up JDK | |
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Set Gradle | |
uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 # v3.5.0 | |
with: | |
gradle-version: 7.5 | |
- name: Set env vars from AWS params | |
uses: cmsgov/ab2d-bcda-dpc-platform/actions/aws-params-env-action@main | |
env: | |
AWS_REGION: ${{ vars.AWS_REGION }} | |
with: | |
params: | | |
ARTIFACTORY_URL=/artifactory/url | |
ARTIFACTORY_USER=/artifactory/user | |
ARTIFACTORY_PASSWORD=/artifactory/password | |
SONAR_HOST_URL=/sonarqube/url | |
SONAR_TOKEN=/sonarqube/token | |
- name: Clean project | |
run: gradle clean | |
- name: Run tests | |
run: gradle test ${RUNNER_DEBUG:+"--debug"} | |
- name: SonarQube analysis | |
run: gradle sonar -Dsonar.host.url=$SONAR_HOST_URL | |
- name: SonarQube Quality Gate check | |
id: sonarqube-quality-gate-check | |
uses: sonarsource/sonarqube-quality-gate-action@master | |
with: | |
scanMetadataReportFile: build/sonar/report-task.txt | |
timeout-minutes: 5 |