This repository was archived by the owner on Sep 25, 2024. It is now read-only.
File tree 3 files changed +35
-6
lines changed
3 files changed +35
-6
lines changed Original file line number Diff line number Diff line change 1
- # Default build validation "clean verify" for non-experimental branches
1
+ # Build validation
2
2
3
3
name : Build
4
4
5
5
on :
6
6
push :
7
7
branches-ignore :
8
- - ' experimental/**'
8
+ - experimental/**
9
9
pull_request :
10
+ types : [opened, synchronize, reopened]
10
11
branches-ignore :
11
- - ' experimental/**'
12
+ - experimental/**
13
+ workflow_dispatch :
12
14
13
15
jobs :
14
16
build :
15
17
16
- runs-on : ubuntu-latest
18
+ runs-on : ${{ matrix.os }}
19
+ strategy :
20
+ matrix :
21
+ java : [8, 11]
22
+ os : [ubuntu-latest]
23
+ distribution : [temurin]
17
24
18
25
steps :
19
26
- name : Checkout code
20
27
uses : actions/checkout@v2
28
+ with :
29
+ fetch-depth : 0 # Shallow clones should be disabled for a better relevancy of analysis
21
30
22
31
- name : Setup JDK
23
32
uses : actions/setup-java@v2
24
33
with :
25
- distribution : temurin
26
- java-version : 8
34
+ distribution : ${{ matrix.distribution }}
35
+ java-version : ${{ matrix.java }}
27
36
cache : ' maven'
28
37
38
+ - name : Cache SonarCloud packages
39
+ uses : actions/cache@v1
40
+ with :
41
+ path : ~/.sonar/cache
42
+ key : ${{ runner.os }}-sonar
43
+ restore-keys : ${{ runner.os }}-sonar
44
+
29
45
- name : Build and verify
30
46
run : mvn -s ./.maven-settings.xml -B -U clean verify
47
+
48
+ - name : Analyze in SonarCloud
49
+ env :
50
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
51
+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
52
+ # SONAR_TOKEN is not present when building for external PR
53
+ run : ([ -z $SONAR_TOKEN ] || mvn -s ./.maven-settings.xml -Pcontinuous-integration -B sonar:sonar -Dsonar.projectKey=${{github.repository_owner}}_${{github.event.repository.name}} -Dsonar.projectName=${{github.event.repository.name}})
54
+ if : ${{ matrix.java == '11' && matrix.os == 'ubuntu-latest' }}
Original file line number Diff line number Diff line change 1
1
[ ![ Build] ( https://github.com/wcm-io-devops/jenkins-pipeline-library/workflows/Build/badge.svg )] ( https://github.com/wcm-io-devops/jenkins-pipeline-library/actions?query=workflow%3ABuild )
2
+ [ ![ Coverage] ( https://sonarcloud.io/api/project_badges/measure?project=wcm-io-devops_jenkins-pipeline-library&metric=coverage )] ( https://sonarcloud.io/summary/new_code?id=wcm-io-devops_jenkins-pipeline-library )
2
3
[ ![ Maven Central] ( https://maven-badges.herokuapp.com/maven-central/io.wcm.devops.jenkins/io.wcm.devops.jenkins.pipeline-library/badge.svg )] ( https://maven-badges.herokuapp.com/maven-central/io.wcm.devops.jenkins/io.wcm.devops.jenkins.pipeline-library )
3
4
[ ![ Sonatype Snapshots] ( https://img.shields.io/nexus/s/https/oss.sonatype.org/io.wcm.devops.jenkins/io.wcm.devops.jenkins.pipeline-library.svg )] ( https://oss.sonatype.org/content/repositories/snapshots/io/wcm/devops/jenkins/io.wcm.devops.jenkins.pipeline-library/ )
4
5
Original file line number Diff line number Diff line change 46
46
<animal .sniffer.skip>true</animal .sniffer.skip>
47
47
<java .level>8</java .level>
48
48
<groovy .version>2.4.12</groovy .version>
49
+
50
+ <!-- SonarCloud -->
51
+ <sonar .organization>wcm-io-devops</sonar .organization>
52
+ <sonar .host.url>https://sonarcloud.io</sonar .host.url>
49
53
</properties >
50
54
51
55
<inceptionYear >2017</inceptionYear >
You can’t perform that action at this time.
0 commit comments