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
3
6
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
10
8
11
9
on :
12
10
# Trigger analysis when pushing in master or pull requests, and when creating
13
11
# a pull request.
14
12
push :
15
13
branches :
16
14
- main
17
- - branch-sonarcloud
15
+ - develop
16
+ - branch-preview
18
17
pull_request :
19
18
types :
20
19
- opened
@@ -26,28 +25,31 @@ jobs:
26
25
name : Build
27
26
runs-on : ubuntu-latest
28
27
steps :
29
- - uses : actions/checkout@v4
28
+ - uses : actions/checkout@main
30
29
with :
31
30
# Shallow clones should be disabled for a better relevancy of analysis
32
31
fetch-depth : 0
33
32
- name : Set up JDK 17
34
- uses : actions/setup-java@v4
33
+ uses : actions/setup-java@main
35
34
with :
36
35
java-version : ' 17'
37
36
distribution : ' corretto'
38
37
cache : ' maven'
39
38
- name : Cache Maven packages
40
- uses : actions/cache@v1
39
+ uses : actions/cache@main
41
40
with :
42
41
path : ~/.m2
43
42
key : ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
44
43
restore-keys : ${{ runner.os }}-m2
45
44
- name : Cache SonarCloud packages
46
- uses : actions/cache@v1
45
+ uses : actions/cache@main
47
46
with :
48
47
path : ~/.sonar/cache
49
48
key : ${{ runner.os }}-sonar
50
49
restore-keys : ${{ runner.os }}-sonar
50
+ - uses : actions/setup-node@main
51
+ with :
52
+ node-version : 20
51
53
- name : Maven version
52
54
run : mvn -v
53
55
env :
@@ -56,13 +58,33 @@ jobs:
56
58
# SonarCloud access token should be generated from https://sonarcloud.io/account/security/
57
59
SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
58
60
- 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}}
60
62
env :
61
63
# Needed to get some information about the pull request, if any
62
64
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
63
65
# SonarCloud access token should be generated from https://sonarcloud.io/account/security/
64
66
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
65
87
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
67
89
- 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