This repository was archived by the owner on Sep 25, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +35
-6
lines changed Expand file tree Collapse file tree 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
22
33name : Build
44
55on :
66 push :
77 branches-ignore :
8- - ' experimental/**'
8+ - experimental/**
99 pull_request :
10+ types : [opened, synchronize, reopened]
1011 branches-ignore :
11- - ' experimental/**'
12+ - experimental/**
13+ workflow_dispatch :
1214
1315jobs :
1416 build :
1517
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]
1724
1825 steps :
1926 - name : Checkout code
2027 uses : actions/checkout@v2
28+ with :
29+ fetch-depth : 0 # Shallow clones should be disabled for a better relevancy of analysis
2130
2231 - name : Setup JDK
2332 uses : actions/setup-java@v2
2433 with :
25- distribution : temurin
26- java-version : 8
34+ distribution : ${{ matrix.distribution }}
35+ java-version : ${{ matrix.java }}
2736 cache : ' maven'
2837
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+
2945 - name : Build and verify
3046 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 11[ ![ 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 )
23[ ![ 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 )
34[ ![ 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/ )
45
Original file line number Diff line number Diff line change 4646 <animal .sniffer.skip>true</animal .sniffer.skip>
4747 <java .level>8</java .level>
4848 <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>
4953 </properties >
5054
5155 <inceptionYear >2017</inceptionYear >
You can’t perform that action at this time.
0 commit comments