Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DPC-4258 Run sonarqube check in GitHub actions #2273

Merged
merged 68 commits into from
Sep 20, 2024
Merged
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
9c0c5fa
Sonarqube dpc-portal first try
jdettmannnava Sep 19, 2024
234d1f7
add actual build
jdettmannnava Sep 19, 2024
6e5f5f5
debugging
jdettmannnava Sep 19, 2024
ead49ea
debugging
jdettmannnava Sep 19, 2024
1473db0
debugging
jdettmannnava Sep 19, 2024
0372542
try without dot
jdettmannnava Sep 19, 2024
41c529c
more debugging
jdettmannnava Sep 19, 2024
fef6fca
more debugging
jdettmannnava Sep 19, 2024
6d35313
more debugging
jdettmannnava Sep 19, 2024
29361d2
with non-dotted resultset
jdettmannnava Sep 19, 2024
8e8a2ec
mv with sudo
jdettmannnava Sep 19, 2024
890d1f6
debugging dpc-portal location
jdettmannnava Sep 19, 2024
71faa01
debugging dpc-portal location
jdettmannnava Sep 19, 2024
029ed16
sonarqube the portal again
jdettmannnava Sep 19, 2024
7e3b603
Merge branch 'main' into jd/dpc-4258-sonarqube-github-actions
jdettmannnava Sep 19, 2024
78870e1
try again
jdettmannnava Sep 19, 2024
206fa31
should fail
jdettmannnava Sep 19, 2024
de00162
should fail
jdettmannnava Sep 19, 2024
7b1ea95
wait for gate
jdettmannnava Sep 19, 2024
5c85b87
try to fail again...
jdettmannnava Sep 19, 2024
c6a5d32
try to fail again...
jdettmannnava Sep 19, 2024
e4f6c7c
test the full workflow
jdettmannnava Sep 19, 2024
d2d3e56
test admin
jdettmannnava Sep 19, 2024
69d1a58
make not pass even if run again
jdettmannnava Sep 19, 2024
55586a2
try to fail again
jdettmannnava Sep 19, 2024
70af992
project version stable with branch
jdettmannnava Sep 19, 2024
7ad2406
other project
jdettmannnava Sep 19, 2024
571cd6e
try setting scm
jdettmannnava Sep 19, 2024
fba707b
different fail
jdettmannnava Sep 19, 2024
1cb2a87
with bad controller
jdettmannnava Sep 19, 2024
5a2110a
Merge branch 'jd/dpc-4258-sonarqube-github-actions' of github.com:CMS…
jdettmannnava Sep 19, 2024
d7b6a88
rename class
jdettmannnava Sep 19, 2024
f4b4845
undisable scm
jdettmannnava Sep 19, 2024
7036c4d
removed foo, should pass
jdettmannnava Sep 19, 2024
765d049
test web
jdettmannnava Sep 19, 2024
ae29380
force fail
jdettmannnava Sep 19, 2024
5331399
run both
jdettmannnava Sep 19, 2024
fa1972b
double check admin
jdettmannnava Sep 19, 2024
a6fe5d9
full test of web/admin
jdettmannnava Sep 19, 2024
84ad909
sonarqube api
jdettmannnava Sep 19, 2024
3fad2b3
sonarqube api
jdettmannnava Sep 19, 2024
dd8f304
sonarqube api
jdettmannnava Sep 19, 2024
e2553a7
unsecure node
jdettmannnava Sep 19, 2024
05d856a
not self hosted
jdettmannnava Sep 19, 2024
a226fd3
try setting up mvn
jdettmannnava Sep 19, 2024
e879f68
set version
jdettmannnava Sep 19, 2024
f89396e
self hosted
jdettmannnava Sep 19, 2024
a53a301
insecure node
jdettmannnava Sep 19, 2024
9531849
set mvn version to 3.0
jdettmannnava Sep 19, 2024
9c791a6
update java setup
jdettmannnava Sep 19, 2024
6d7aae5
update java setup to 2
jdettmannnava Sep 19, 2024
d714419
update java setup to 1
jdettmannnava Sep 19, 2024
3a1a45f
set up web apps for sonarqube
jdettmannnava Sep 19, 2024
5060751
fix workflow
jdettmannnava Sep 19, 2024
16c6eee
reformat
jdettmannnava Sep 19, 2024
9b69eef
add java sonarqube check
jdettmannnava Sep 20, 2024
9cd53f4
set projectVersion
jdettmannnava Sep 20, 2024
a02a7d2
better naming
jdettmannnava Sep 20, 2024
9f0cba0
cleanup
jdettmannnava Sep 20, 2024
a146aac
use dynamic project version
jdettmannnava Sep 20, 2024
073aa07
use dynamic project version
jdettmannnava Sep 20, 2024
c9b4f19
double check dynamic project version setting
jdettmannnava Sep 20, 2024
08cf361
double check dynamic project version setting
jdettmannnava Sep 20, 2024
683918f
back to normal
jdettmannnava Sep 20, 2024
f706993
better branch name
jdettmannnava Sep 20, 2024
15cc133
upgrade checkout to v3
jdettmannnava Sep 20, 2024
346b35d
hopefully fix
jdettmannnava Sep 20, 2024
c2c821d
hopefully still not break
jdettmannnava Sep 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ jobs:
- name: "DPC Web Build"
run: |
make ci-web-portal
- name: "Move the test results" # won't upload hidden files
run: |
sudo mv ./dpc-web/coverage/.resultset.json ./dpc-web/coverage/resultset.json
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report-dpc-web
path: ./dpc-web/coverage/resultset.json

build-dpc-admin:
name: "Build and Test DPC Admin Portal"
Expand All @@ -54,6 +62,14 @@ jobs:
- name: "DPC Admin Portal Build"
run: |
make ci-admin-portal
- name: "Move the test results" # won't upload hidden files
run: |
sudo mv ./dpc-admin/coverage/.resultset.json ./dpc-admin/coverage/resultset.json
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report-dpc-admin
path: ./dpc-admin/coverage/resultset.json

build-dpc-portal:
name: "Build and Test DPC Portal"
Expand All @@ -64,6 +80,14 @@ jobs:
- name: "DPC Portal Build"
run: |
make ci-portal
- name: "Move the test results" # won't upload hidden files
run: |
sudo mv ./dpc-portal/coverage/.resultset.json ./dpc-portal/coverage/resultset.json
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report-dpc-portal
path: ./dpc-portal/coverage/resultset.json

build-dpc-client:
name: "Build and Test DPC Client"
Expand All @@ -74,3 +98,118 @@ jobs:
- name: "DPC Client Build"
run: |
make ci-api-client

sonar-quality-gate-dpc-web-and-admin:
name: Sonarqube Quality Gate for dpc-web and dpc-admin
needs: [build-dpc-admin, build-dpc-web]
runs-on: self-hosted
env:
# Workaround until https://jira.cms.gov/browse/PLT-338 is implemented.
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: "true"
steps:
- name: "Checkout code"
uses: actions/checkout@v1
- name: Download web code coverage
uses: actions/download-artifact@v3
with:
name: code-coverage-report-dpc-web
- name: Download admin code coverage
uses: actions/download-artifact@v3
with:
name: code-coverage-report-dpc-admin
- 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: |
SONAR_HOST_URL=/sonarqube/url
SONAR_TOKEN=/sonarqube/token
- name: Run quality gate scan
uses: sonarsource/sonarqube-scan-action@master
with:
args:
-Dsonar.projectKey=bcda-dpc-web
-Dsonar.sources=./dpc-web/app,./dpc-web/lib,./dpc-admin/app,./dpc-admin/lib
-Dsonar.ruby.coverage.reportPaths=./dpc-web/coverage/resultset.json,./dpc-admin/coverage/resultset.json
-Dsonar.working.directory=./sonar_workspace
-Dsonar.branch.name=${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
-Dsonar.projectVersion=${{ github.ref_name == 'main' && github.sha || 'branch' }}
-Dsonar.qualitygate.wait=true

sonar-quality-gate-dpc-portal:
name: Sonarqube Quality Gate for dpc-portal
needs: build-dpc-portal
runs-on: self-hosted
env:
# Workaround until https://jira.cms.gov/browse/PLT-338 is implemented.
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: "true"
steps:
- name: "Checkout code"
uses: actions/checkout@v1
- name: Download code coverage
uses: actions/download-artifact@v3
with:
name: code-coverage-report-dpc-portal
- 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: |
SONAR_HOST_URL=/sonarqube/url
SONAR_TOKEN=/sonarqube/token
- name: Run quality gate scan
uses: sonarsource/sonarqube-scan-action@master
with:
args:
-Dsonar.projectKey=bcda-dpc-portal
-Dsonar.sources=./dpc-portal/app,./dpc-portal/lib
-Dsonar.coverage.exclusions=**/*_preview.rb,**/*html.erb,**/application_*
-Dsonar.ruby.coverage.reportPaths=./dpc-portal/coverage/resultset.json
-Dsonar.working.directory=./sonar_workspace
-Dsonar.branch.name=${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
-Dsonar.projectVersion=${{ github.ref_name == 'main' && github.sha || 'branch' }}
-Dsonar.qualitygate.wait=true

sonar-quality-gate-dpc-api:
name: Sonarqube Quality Gate for dpc-api
runs-on: self-hosted
env:
# Workaround until https://jira.cms.gov/browse/PLT-338 is implemented.
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- name: Checkout Code
uses: actions/checkout@v1
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: temurin
cache: maven
- 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: |
SONAR_HOST_URL=/sonarqube/url
SONAR_TOKEN=/sonarqube/token
- name: Install Maven 3.6.3
run: |
export PATH="$PATH:/opt/maven/bin"
echo "PATH=$PATH" >> $GITHUB_ENV
if mvn -v; then echo "Maven already installed" && exit 0; else echo "Installing Maven"; fi
tmpdir="$(mktemp -d)"
curl -LsS https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz | tar xzf - -C "$tmpdir"
sudo rm -rf /opt/maven
sudo mv "$tmpdir/apache-maven-3.6.3" /opt/maven
- name: Clean maven
run: |
mvn -ntp -U clean
- name: Compile project
run: |
mvn compile
- name: Run quality gate scan
run: |
mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar -Dsonar.projectKey=bcda-dpc-api -Dsonar.branch.name=${{ github.event_name == 'pull_request' && github.head_ref || github.event_name == 'pull_request' && github.head_ref || github.ref_name }} -Dsonar.working.directory=./.sonar_workspace -Dsonar.projectVersion=${{ github.ref_name == 'main' && github.sha || 'branch' }} -Dsonar.qualitygate.wait=true
Loading