1
- # CI with maven build and scan
2
- #
3
- # version 1.1.0
4
- #
5
- # see : https://universe.fugerit.org/src/docs/conventions/workflows/build_maven_package.html
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
6
3
7
- name : CI maven build and scan
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
8
10
9
11
on :
10
12
# Trigger analysis when pushing in master or pull requests, and when creating
11
13
# a pull request.
12
14
push :
13
15
branches :
14
16
- main
15
- - develop
16
- - branch-preview
17
17
- branch-sonarcloud
18
+ - branch-test
18
19
pull_request :
19
20
types :
20
21
- opened
24
25
jobs :
25
26
build :
26
27
name : Build
27
- runs-on : ubuntu-latest
28
+ runs-on : ubuntu-22.04
28
29
steps :
29
- - uses : fugerit-org/psychic-actions/maven-build-scan@stable
30
+ - uses : actions/checkout@main
31
+ with :
32
+ # Shallow clones should be disabled for a better relevancy of analysis
33
+ fetch-depth : 0
34
+ - name : Set up JDK 17
35
+ uses : actions/setup-java@main
36
+ with :
37
+ java-version : ' 17'
38
+ distribution : ' corretto'
39
+ cache : ' maven'
40
+ - name : Cache Maven packages
41
+ uses : actions/cache@main
30
42
with :
31
- github-token : ${{ secrets.GITHUB_TOKEN }}
32
- sonar-token : ${{ secrets.SONAR_TOKEN }}
33
- disable-maven-dependency-submission : ${{ vars.DISABLE_MAVEN_DEPENDENCY_SUBMISSION }}
43
+ path : ~/.m2
44
+ key : ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
45
+ restore-keys : ${{ runner.os }}-m2
46
+ - name : Cache SonarCloud packages
47
+ uses : actions/cache@main
48
+ with :
49
+ path : ~/.sonar/cache
50
+ key : ${{ runner.os }}-sonar
51
+ restore-keys : ${{ runner.os }}-sonar
52
+ - name : Maven version
53
+ run : mvn -v
54
+ env :
55
+ # Needed to get some information about the pull request, if any
56
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
57
+ # SonarCloud access token should be generated from https://sonarcloud.io/account/security/
58
+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
59
+ - name : Build and analyze
60
+ 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
+ env :
62
+ # Needed to get some information about the pull request, if any
63
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
64
+ # SonarCloud access token should be generated from https://sonarcloud.io/account/security/
65
+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
66
+
67
+ # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
68
+ - name : Update dependency graph
69
+ uses : advanced-security/maven-dependency-submission-action@main
0 commit comments