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

JN-372, DSEC-659 include sonar in Java CI #483

Merged
merged 86 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
f1f6bef
include sonar in Java CI
TomConner Jul 20, 2023
ea49376
sonar in Java CI
TomConner Jul 20, 2023
d0fbe58
separate project sonar scans
TomConner Jul 21, 2023
2781dab
sonar-project.properties at root
TomConner Jul 21, 2023
7023028
combine all java and combine all typescript
TomConner Jul 21, 2023
50add44
sonar typescript
TomConner Jul 21, 2023
c6963e4
sonar args in workflow
TomConner Jul 21, 2023
64d6e2d
sonarscanner
TomConner Jul 21, 2023
4810928
work in progress
TomConner Jul 24, 2023
dec810d
multiproject sonar
TomConner Jul 24, 2023
b6ebf5f
gradle sonar on single bound project
TomConner Jul 24, 2023
1fe02e2
exclude spotless
TomConner Jul 24, 2023
becb898
include resources in sonar
TomConner Jul 24, 2023
6cb22dc
include resources in sonar
TomConner Jul 24, 2023
288039f
resources
TomConner Jul 25, 2023
b558e2c
gha sonar
TomConner Jul 25, 2023
bbdde71
gha
TomConner Jul 25, 2023
150f883
typescript sonar specify branch
TomConner Jul 25, 2023
5739af6
sonar on push
TomConner Jul 25, 2023
67f6447
sonar on push
TomConner Jul 25, 2023
a1b489d
sonar on push
TomConner Jul 25, 2023
a1eee5d
sonar in Java CI
TomConner Jul 20, 2023
d3313bc
separate project sonar scans
TomConner Jul 21, 2023
6019c52
sonar-project.properties at root
TomConner Jul 21, 2023
69126f4
combine all java and combine all typescript
TomConner Jul 21, 2023
6b6cff1
sonar typescript
TomConner Jul 21, 2023
cc8dbba
sonar args in workflow
TomConner Jul 21, 2023
c0aab52
sonarscanner
TomConner Jul 21, 2023
3fd9559
work in progress
TomConner Jul 24, 2023
24d44e6
multiproject sonar
TomConner Jul 24, 2023
f8e4d1f
gradle sonar on single bound project
TomConner Jul 24, 2023
25e12fe
exclude spotless
TomConner Jul 24, 2023
14c05f1
include resources in sonar
TomConner Jul 24, 2023
166fba7
include resources in sonar
TomConner Jul 24, 2023
11de4de
resources
TomConner Jul 25, 2023
bf92e87
gha sonar
TomConner Jul 25, 2023
5389f6c
gha
TomConner Jul 25, 2023
ec0775c
typescript sonar specify branch
TomConner Jul 25, 2023
e240fc7
sonar on push
TomConner Jul 25, 2023
5d8f8b7
sonar on push
TomConner Jul 25, 2023
63530f5
sonar on push
TomConner Jul 25, 2023
7a92258
announce message
TomConner Jul 28, 2023
d393b89
Merge branch 'development' into DSEC-659
TomConner Jul 28, 2023
c779f1c
merge
TomConner Jul 28, 2023
fe33a0c
revert
TomConner Jul 28, 2023
7743265
separate project sonar scans
TomConner Jul 21, 2023
7d57f7d
sonar-project.properties at root
TomConner Jul 21, 2023
9a051f7
combine all java and combine all typescript
TomConner Jul 21, 2023
77927be
sonar typescript
TomConner Jul 21, 2023
9564e2f
sonar args in workflow
TomConner Jul 21, 2023
6e9ce5c
sonarscanner
TomConner Jul 21, 2023
b26bc64
multiproject sonar
TomConner Jul 24, 2023
8f95872
gradle sonar on single bound project
TomConner Jul 24, 2023
7139df9
exclude spotless
TomConner Jul 24, 2023
44739e2
include resources in sonar
TomConner Jul 24, 2023
014f93a
include resources in sonar
TomConner Jul 24, 2023
46043ed
resources
TomConner Jul 25, 2023
a573adb
gha sonar
TomConner Jul 25, 2023
cfe6b37
gha
TomConner Jul 25, 2023
51f0e3f
typescript sonar specify branch
TomConner Jul 25, 2023
c49b612
sonar on push
TomConner Jul 25, 2023
8d1492a
sonar on push
TomConner Jul 25, 2023
61b1e54
sonar on push
TomConner Jul 25, 2023
9d2a533
announce message
TomConner Jul 28, 2023
9e76718
[JN-490] avoiding error on dupe mailing list signup (#482)
devonbush Jul 20, 2023
e167a32
[JN-477] admin help for export (#481)
devonbush Jul 20, 2023
277da84
[JN-453] Preserve fields when switching question types in new questio…
MatthewBemis Jul 27, 2023
edf05e8
multiproject sonar
TomConner Jul 24, 2023
ae9c4a5
gradle sonar on single bound project
TomConner Jul 24, 2023
a5b8fe8
include resources in sonar
TomConner Jul 24, 2023
d6cfbc8
include resources in sonar
TomConner Jul 24, 2023
ff52e8c
resources
TomConner Jul 25, 2023
e379527
gha sonar
TomConner Jul 25, 2023
d2f7e14
gha
TomConner Jul 25, 2023
3041c6b
typescript sonar specify branch
TomConner Jul 25, 2023
088f9ec
sonar on push
TomConner Jul 25, 2023
e038f28
sonar on push
TomConner Jul 25, 2023
1198dc1
sonar on push
TomConner Jul 25, 2023
01bec4d
revert
TomConner Jul 28, 2023
ff4cd25
Merge branch 'DSEC-659' of github.com:broadinstitute/juniper into DSE…
TomConner Jul 28, 2023
bf7caa9
restore
TomConner Jul 28, 2023
1a4f8f3
link to branch sonar scan
TomConner Jul 28, 2023
5012efc
announce branch scan
TomConner Jul 28, 2023
46e4d67
announce branch scan
TomConner Jul 28, 2023
1305120
add ui-core
TomConner Jul 28, 2023
ae4a1c2
add ui-core
TomConner Jul 28, 2023
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
61 changes: 52 additions & 9 deletions .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,67 @@
name: Sonar
on: workflow_dispatch
on:
workflow_dispatch:
push:
branches:
- master
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be triggered by pushes to the development branch instead? development is ultimately what ends up going to production, as we don't use a master or main branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Good catch.

pull_request:
types: [opened, synchronize, reopened]

jobs:
sonar:
sonar-java:
name: SonarCloud Java
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up JDK
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
distribution: 'adopt'
- name: Scan via gradle
run: >-
./gradlew
--build-cache
-x test
-x spotlessJava
-x spotlessJavaApply
-x spotlessJavaCheck
-x spotlessCheck
-x spotlessApply
build sonar -info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Build all projects without running tests
run: ./gradlew --build-cache compileJava

- name: SonarCloud Scan
sonar-typescript:
name: SonarCloud TypeScript
runs-on: ubuntu-latest
strategy:
matrix:
subproject: ['ui-admin', 'ui-core', 'ui-participant']
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v5
- name: Scan ${{ matrix.subproject }} via sonarcloud-github-action
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: ${{ github.workspace }}/${{ matrix.subproject }}
args: >
-Dsonar.branch.target=${{ github.event.repository.default_branch }}
-Dsonar.branch.name=${{ steps.branch-name.outputs.current_branch }}
- name: Announce
run: |
gh pr comment ${{ github.event.pull_request.number }} \
--body "SonarCloud [analyzed ${{ matrix.subproject }} on ${{ steps.branch-name.outputs.current_branch }}](https://sonarcloud.io/summary/new_code?id=broadinstitute_juniper-${{ matrix.subproject }}&branch=${{ steps.branch-name.outputs.current_branch }})"
env:
GH_TOKEN: ${{ github.token }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ npm-debug.log*
.scannerwork
.sonar-token
tmp/

# direnv
.envrc

*.hprof

10 changes: 0 additions & 10 deletions api-admin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ plugins {
id 'de.undercouch.download'
id 'com.google.cloud.tools.jib'
id 'com.srcclr.gradle'
id 'org.sonarqube'

id 'com.gorylenko.gradle-git-properties' version '2.3.1'
}
Expand Down Expand Up @@ -65,12 +64,3 @@ jibDockerBuild.dependsOn('copyWebApp')
test {
useJUnitPlatform ()
}

sonarqube {
properties {
property 'sonar.projectName', 'terra-java-project-template'
property 'sonar.projectKey', 'terra-java-project-template'
property 'sonar.organization', 'broad-databiosphere'
property 'sonar.host.url', 'https://sonarcloud.io'
}
}
10 changes: 0 additions & 10 deletions api-participant/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ plugins {
id 'de.undercouch.download'
id 'com.google.cloud.tools.jib'
id 'com.srcclr.gradle'
id 'org.sonarqube'

id 'com.gorylenko.gradle-git-properties' version '2.3.1'
}
Expand Down Expand Up @@ -61,12 +60,3 @@ jibDockerBuild.dependsOn('copyWebApp')
test {
useJUnitPlatform ()
}

sonarqube {
properties {
property 'sonar.projectName', 'terra-java-project-template'
property 'sonar.projectKey', 'terra-java-project-template'
property 'sonar.organization', 'broad-databiosphere'
property 'sonar.host.url', 'https://sonarcloud.io'
}
}
18 changes: 18 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'com.github.node-gradle.node' version '5.0.0'
id 'org.sonarqube'
}

apply plugin: 'base'
Expand All @@ -16,3 +17,20 @@ task bundleAdminUI(type: NpmTask, dependsOn: [npmInstall, buildUICore]) {
task bundleParticipantUI(type: NpmTask, dependsOn: [npmInstall, buildUICore]) {
args = ['--workspace=ui-participant', 'run', 'build']
}

sonar {
properties {
property 'sonar.projectName', "${rootProject.name}"
property 'sonar.projectKey', "broadinstitute_${rootProject.name}"
property 'sonar.organization', 'dsp-appsec'
property 'sonar.host.url', 'https://sonarcloud.io'
}
}
subprojects {
apply plugin: 'org.sonarqube'
sonar {
properties {
property 'sonar.sources', 'src/main/java,src/main/resources'
}
}
}
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies {
implementation 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.12'
implementation 'io.spring.dependency-management:io.spring.dependency-management.gradle.plugin:1.0.15.RELEASE'
implementation 'org.hidetake.swagger.generator:org.hidetake.swagger.generator.gradle.plugin:2.19.2'
implementation 'org.sonarqube:org.sonarqube.gradle.plugin:3.4.0.2513'
implementation 'org.sonarqube:org.sonarqube.gradle.plugin:4.2.1.3168'
implementation 'org.springframework.boot:spring-boot-gradle-plugin:2.7.10'
implementation 'bio.terra:terra-test-runner:0.1.5-SNAPSHOT'
// This is required due to a dependency conflict between jib and srcclr. Removing it will cause jib to fail.
Expand Down
1 change: 0 additions & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,3 @@ dependencies {
test {
useJUnitPlatform ()
}

1 change: 0 additions & 1 deletion populate/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ dependencies {
test {
useJUnitPlatform ()
}

2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rootProject.name = 'pearl'
rootProject.name = 'juniper'
include('core', 'populate', 'api-admin', 'api-participant')

gradle.ext.releaseVersion = '0.0.85'
8 changes: 0 additions & 8 deletions sonar-project.properties

This file was deleted.

3 changes: 3 additions & 0 deletions ui-admin/sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sonar.projectKey=broadinstitute_juniper-ui-admin
sonar.organization=dsp-appsec
sonar.projectName=juniper-ui-admin
3 changes: 3 additions & 0 deletions ui-core/sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sonar.projectKey=broadinstitute_juniper-ui-core
sonar.organization=dsp-appsec
sonar.projectName=juniper-ui-core
3 changes: 3 additions & 0 deletions ui-participant/sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sonar.projectKey=broadinstitute_juniper-ui-participant
sonar.organization=dsp-appsec
sonar.projectName=juniper-ui-participant
Loading