Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
enable SonarCloud and Java 11
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Jan 12, 2022
1 parent a630519 commit ade9308
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
38 changes: 31 additions & 7 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,54 @@
# Default build validation "clean verify" for non-experimental branches
# Build validation

name: Build

on:
push:
branches-ignore:
- 'experimental/**'
- experimental/**
pull_request:
types: [opened, synchronize, reopened]
branches-ignore:
- 'experimental/**'
- experimental/**
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [8, 11]
os: [ubuntu-latest]
distribution: [temurin]

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Setup JDK
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 8
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
cache: 'maven'

- name: Build and verify
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Build and verify (with SonarCloud)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -s ./.maven-settings.xml -B -U clean verify sonar:sonar -Dsonar.projectKey=${{github.repository_owner}}_${{github.event.repository.name}} -Dsonar.projectName=${{github.event.repository.name}}
if: ${{ matrix.java == '11' && matrix.os == 'ubuntu-latest' }}

- name: Build and verify (without SonarCloud)
run: mvn -s ./.maven-settings.xml -B -U clean verify
if: ${{ matrix.java != '11' || matrix.os != 'ubuntu-latest' }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![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)
[![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)
[![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)
[![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/)

Expand Down
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
<animal.sniffer.skip>true</animal.sniffer.skip>
<java.level>8</java.level>
<groovy.version>2.4.12</groovy.version>

<!-- SonarCloud -->
<sonar.organization>wcm-io-devops</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>

<inceptionYear>2017</inceptionYear>
Expand Down

0 comments on commit ade9308

Please sign in to comment.