-
Notifications
You must be signed in to change notification settings - Fork 28
54 lines (52 loc) · 1.78 KB
/
test-analysis.yml
File metadata and controls
54 lines (52 loc) · 1.78 KB
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
name: Build and test the project
on:
workflow_call:
inputs:
cache_key:
type: string
required: false
secrets:
SONAR_TOKEN:
required: true
jobs:
test:
name: Test and push Sonar analysis
runs-on: ${{ vars.UBUNTU_VERSION }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: Cache local Maven repository
uses: actions/cache/restore@v4
if: ${{ inputs.cache_key != '' }}
with:
path: ~/.m2/repository
key: ${{ inputs.cache_key }}
## Force cache hit to avoid analyzing with incomplete dependencies
fail-on-cache-miss: true
- name: Start MongoDB v6.0
uses: supercharge/mongodb-github-action@1.8.0
with:
mongodb-version: 6.0
mongodb-replica-set: rs-test
- name: Test and Analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify surefire-report:report --fail-never org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=opencb_java-common-libs --no-transfer-progress
- name: Publish Test Report
uses: scacap/action-surefire-report@v1
## Skip cancelled()
## https://docs.github.com/en/actions/learn-github-actions/expressions#cancelled
if: success() || failure()
with:
check_name: "Surefire tests report"
report_paths: './**/surefire-reports/TEST-*.xml'
commit: '${{ github.sha }}'
fail_on_test_failures: true