-
Notifications
You must be signed in to change notification settings - Fork 9
72 lines (69 loc) · 2.32 KB
/
maven.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
62
63
64
65
66
67
68
69
70
71
72
name: Java CI
on:
push:
branches:
- main
pull_request:
branches: '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v6
- name: Set up JDK 1.8
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 8
cache: maven
- run: rm -rf /tmp/*
continue-on-error: true
- name: Build with Maven
env:
AWS_REGION: us-west-2
run: mvn -ntp -U clean verify
- name: Upload Failed Test Report
uses: actions/upload-artifact@v3
if: failure()
with:
name: Failed Test Report
path: target/surefire-reports
- name: Upload Coverage
uses: actions/upload-artifact@v3
if: always()
with:
name: Coverage Report
path: target/jacoco-report
- name: Upload unit test coverage to Codecov
uses: codecov/codecov-action@v3
with:
directory: target/jacoco-report
files: jacoco.xml
flags: unit
- name: Upload integration test coverage to Codecov
uses: codecov/codecov-action@v3
with:
directory: target/jacoco-report/jacoco-it
files: jacoco.xml
flags: integration
- name: Convert Jacoco unit test report to Cobertura
run: python3 .github/scripts/cover2cover.py target/jacoco-report/jacoco.xml src/main/java > target/jacoco-report/cobertura.xml
- name: Convert Jacoco integ test report to Cobertura
run: python3 .github/scripts/cover2cover.py target/jacoco-report/jacoco-it/jacoco.xml src/main/java > target/jacoco-report/cobertura-it.xml
- name: Save PR number
run: |
mkdir -p ./pr/jacoco-report
echo ${{ github.event.number }} > ./pr/NR
echo ${{ github.event.pull_request.head.sha }} > ./pr/SHA
cp target/jacoco-report/cobertura.xml ./pr/jacoco-report/cobertura.xml
cp target/jacoco-report/cobertura-it.xml ./pr/jacoco-report/cobertura-it.xml
if: github.event_name == 'pull_request'
- name: Upload files
uses: actions/upload-artifact@v2
with:
name: pr
path: pr/
if: github.event_name == 'pull_request'