1- name : Build cwms-data-api-client
1+ name : " Build and Static Code Analysis "
22on :
3+ push :
4+ branches : [ main ]
35 pull_request :
4- branches :
5- - main
6+ branches : [ main ]
7+ schedule :
8+ - cron : ' 0 0 * * 0'
9+
610
711jobs :
8- build :
9- name : build and test
12+ analyze :
13+ name : Analyze
1014 runs-on : ubuntu-latest
1115 steps :
12- - name : checkout code
16+ - name : Checkout repository
1317 uses : actions/checkout@v4
18+
19+ - name : Initialize CodeQL
20+ uses : github/codeql-action/init@v3
21+ with :
22+ languages : ' java'
1423 - name : setup java
1524 uses : actions/setup-java@v4
1625 with :
1726 java-version : ' 21'
1827 java-package : jdk
1928 distribution : ' temurin'
29+ - name : Setup Gradle
30+ uses : gradle/actions/setup-gradle@v3.4.2
31+ with :
32+ dependency-graph : generate-and-submit
2033 - name : Cache SonarCloud packages
2134 uses : actions/cache@v4.0.0
2235 with :
2336 path : ~/.sonar/cache
2437 key : ${{ runner.os }}-sonar
2538 restore-keys : ${{ runner.os }}-sonar
2639 - name : build and test
27- id : thebuild
40+ id : build
2841 run : ./gradlew build --info --init-script init.gradle
29- - name : Setup .NET Core # Required to execute ReportGenerator
30- uses : actions/setup-dotnet@v4
31- with :
32- dotnet-version : 6.x
33- dotnet-quality : ' ga'
34- - name : Analyze
42+ - name : CodeQL Analysis
43+ uses : github/codeql-action/analyze@v3
44+ - name : SonarCloud Analysis
3545 env :
3646 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
3747 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
3848 run : ./gradlew sonar
39- - name : ReportGenerator
40- uses : danielpalme/ReportGenerator-GitHub-Action@5.3.6
41- with :
42- reports : cwms-aaa-client/build/reports/jacoco/test/jacocoTestReport.xml;cwms-http-client/build/reports/jacoco/test/jacocoTestReport.xml;cwms-radar-client/build/reports/jacoco/test/jacocoTestReport.xml
43- targetdir : .github/coveragereport
44- reporttypes : Html;MarkdownSummaryGithub;Badges
45- - name : Upload coverage report artifact
46- uses : actions/upload-artifact@v4.3.3
47- with :
48- name : CoverageReport # Artifact name
49- path : .github/coveragereport # Directory containing files to upload
50- - name : Commit and push Badges
51- if : github.event_name != 'pull_request' && github.ref != 'refs/heads/main'
52- run : |
53- cd .github/coveragereport
54- if [[ `git status --porcelain badge_*coverage.svg` ]]; then
55- git config --global user.name 'builduser'
56- git config --global user.email 'builduser@rmanet.com'
57- git add badge_*coverage.svg
58- git commit -m "Autogenerated JaCoCo coverage badge" badge_*coverage.svg
59- git push
60- fi
0 commit comments