1- # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2- # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
1+ # CI with maven build and scan
2+ #
3+ # version 1.0.0
4+ #
5+ # see : https://universe.fugerit.org/src/docs/conventions/workflows/build_maven_package.html
36
4- # This workflow uses actions that are not certified by GitHub.
5- # They are provided by a third-party and are governed by
6- # separate terms of service, privacy policy, and support
7- # documentation.
8-
9- name : CI maven build and sonar cloud scan
7+ name : CI maven build and scan
108
119on :
1210 # Trigger analysis when pushing in master or pull requests, and when creating
1311 # a pull request.
1412 push :
1513 branches :
1614 - main
17- - branch-sonarcloud
15+ - develop
16+ - branch-preview
1817 pull_request :
1918 types :
2019 - opened
@@ -26,28 +25,31 @@ jobs:
2625 name : Build
2726 runs-on : ubuntu-latest
2827 steps :
29- - uses : actions/checkout@v4
28+ - uses : actions/checkout@main
3029 with :
3130 # Shallow clones should be disabled for a better relevancy of analysis
3231 fetch-depth : 0
3332 - name : Set up JDK 17
34- uses : actions/setup-java@v4
33+ uses : actions/setup-java@main
3534 with :
3635 java-version : ' 17'
3736 distribution : ' corretto'
3837 cache : ' maven'
3938 - name : Cache Maven packages
40- uses : actions/cache@v1
39+ uses : actions/cache@main
4140 with :
4241 path : ~/.m2
4342 key : ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
4443 restore-keys : ${{ runner.os }}-m2
4544 - name : Cache SonarCloud packages
46- uses : actions/cache@v1
45+ uses : actions/cache@main
4746 with :
4847 path : ~/.sonar/cache
4948 key : ${{ runner.os }}-sonar
5049 restore-keys : ${{ runner.os }}-sonar
50+ - uses : actions/setup-node@main
51+ with :
52+ node-version : 20
5153 - name : Maven version
5254 run : mvn -v
5355 env :
@@ -56,13 +58,33 @@ jobs:
5658 # SonarCloud access token should be generated from https://sonarcloud.io/account/security/
5759 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
5860 - name : Build and analyze
59- run : mvn -B clean install org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pcoverage,full,metadata,sonarfugerit -Dsonar.projectKey=fugerit-org_${{github.event.repository.name}}
61+ run : mvn -B clean install org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pcoverage,full,metadata,sonarfugerit,buildreact -Dsonar.projectKey=fugerit-org_${{github.event.repository.name}}
6062 env :
6163 # Needed to get some information about the pull request, if any
6264 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6365 # SonarCloud access token should be generated from https://sonarcloud.io/account/security/
6466 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
67+ # snyk
68+ - name : Build a Docker image
69+ run : docker build -t fj-doc-playground-quarkus fj-doc-playground-quarkus
70+ - name : Run Snyk to check Docker image for vulnerabilities
71+ # Snyk can be used to break the build when it detects vulnerabilities.
72+ # In this case we want to upload the issues to GitHub Code Scanning
73+ continue-on-error : true
74+ uses : snyk/actions/docker@master
75+ env :
76+ # In order to use the Snyk Action you will need to have a Snyk API token.
77+ # More details in https://github.com/snyk/actions#getting-your-snyk-token
78+ # or you can signup for free at https://snyk.io/login
79+ SNYK_TOKEN : ${{ secrets.SNYK_TOKEN }}
80+ with :
81+ image : fj-doc-playground-quarkus
82+ args : --file=fj-doc-playground-quarkus/Dockerfile
83+ - name : Upload result to GitHub Code Scanning
84+ uses : github/codeql-action/upload-sarif@main
85+ with :
86+ sarif_file : snyk.sarif
6587
66- # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
88+ # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
6789 - name : Update dependency graph
68- uses : advanced-security/maven-dependency-submission-action@v3.0.2
90+ uses : advanced-security/maven-dependency-submission-action@main
0 commit comments