-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (60 loc) · 2.27 KB
/
verify.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Verify source code changes
on:
push:
branches:
- main
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '11' ]
name: Verify source code changes on Java ${{ matrix.Java }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Get changed source files or maven poms of all modules
id: changed-files-specific
uses: tj-actions/changed-files@v35
with:
files: |
pom.xml
.mvn/**
.github/workflows/verify.yml
src/main/**
src/test/**
- name: Set up JDK
if: steps.changed-files-specific.outputs.any_changed == 'true'
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Cache SonarCloud packages
if: ${{steps.changed-files-specific.outputs.any_changed == 'true' && github.event_name != 'pull_request'}}
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Analyze with SonarCloud
if: ${{steps.changed-files-specific.outputs.any_changed == 'true' && github.event_name != 'pull_request'}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./mvnw -B install verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.coverage.jacoco.xmlReportPaths=\${project.build.directory}/site/jacoco/jacoco.xml -Dsonar.projectKey=devlauer_jndi-provider
- name: Verify via Maven without SonarCloud
if: ${{steps.changed-files-specific.outputs.any_changed == 'true' && github.event_name == 'pull_request'}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./mvnw -B install verify