|
10 | 10 | branches: [ master ] |
11 | 11 |
|
12 | 12 | jobs: |
13 | | - |
14 | | - compile: |
| 13 | + verify: |
15 | 14 | runs-on: ubuntu-latest |
16 | 15 | steps: |
17 | 16 | - name: Checkout repository |
18 | 17 | uses: actions/checkout@v4 |
19 | | - - name: Set up OpenJDK 21 |
20 | | - uses: actions/setup-java@v4 |
| 18 | + |
| 19 | + - name: Cache Git history |
| 20 | + uses: actions/cache@v4 |
21 | 21 | with: |
22 | | - java-version: '21' |
23 | | - distribution: 'adopt' |
24 | | - cache: 'maven' |
25 | | - - name: Compile with Maven |
26 | | - run: mvn compile --file pom.xml |
| 22 | + path: .git |
| 23 | + key: ${{ runner.os }}-git-${{ github.sha }} |
| 24 | + restore-keys: | |
| 25 | + ${{ runner.os }}-git- |
27 | 26 |
|
28 | | - verify: |
29 | | - needs: compile |
30 | | - runs-on: ubuntu-latest |
31 | | - steps: |
32 | | - - name: Checkout repository |
33 | | - uses: actions/checkout@v4 |
34 | 27 | - name: Set up OpenJDK 21 |
35 | 28 | uses: actions/setup-java@v4 |
36 | 29 | with: |
37 | 30 | java-version: '21' |
38 | 31 | distribution: 'adopt' |
39 | 32 | cache: 'maven' |
40 | | - - name: Verify with Maven |
| 33 | + |
| 34 | + - name: Cache local Maven repository |
| 35 | + uses: actions/cache@v4 |
| 36 | + with: |
| 37 | + path: ~/.m2/repository |
| 38 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 39 | + restore-keys: | |
| 40 | + ${{ runner.os }}-maven- |
| 41 | +
|
| 42 | + - name: Compile and verify with Maven |
41 | 43 | run: mvn verify --file pom.xml |
| 44 | + |
42 | 45 | - name: Upload JaCoCo coverage report artifact |
43 | 46 | uses: actions/upload-artifact@v4 |
44 | 47 | with: |
45 | 48 | name: jacoco.xml |
46 | 49 | path: ./target/site/jacoco/jacoco.xml |
47 | 50 |
|
48 | | - coverage-codecov: |
| 51 | + coverage: |
49 | 52 | needs: verify |
50 | 53 | runs-on: ubuntu-latest |
| 54 | + strategy: |
| 55 | + matrix: |
| 56 | + service: [codecov, codacy] |
51 | 57 | steps: |
52 | 58 | - name: Checkout repository |
53 | 59 | uses: actions/checkout@v4 |
| 60 | + with: |
| 61 | + fetch-depth: ${{ matrix.service == 'codacy' && 0 || 1 }} |
| 62 | + |
54 | 63 | - name: Download JaCoCo coverage report artifact |
55 | 64 | uses: actions/download-artifact@v4 |
56 | 65 | with: |
57 | 66 | name: jacoco.xml |
| 67 | + |
58 | 68 | - name: Upload JaCoCo coverage report to Codecov |
| 69 | + if: matrix.service == 'codecov' |
59 | 70 | uses: codecov/codecov-action@v5 |
60 | 71 | with: |
61 | 72 | token: ${{ secrets.CODECOV_TOKEN }} |
62 | 73 | files: jacoco.xml |
63 | 74 |
|
64 | | - coverage-codacy: |
65 | | - needs: verify |
66 | | - runs-on: ubuntu-latest |
67 | | - steps: |
68 | | - - name: Checkout repository |
69 | | - uses: actions/checkout@v4 |
70 | | - - name: Download JaCoCo coverage report artifact |
71 | | - uses: actions/download-artifact@v4 |
72 | | - with: |
73 | | - name: jacoco.xml |
74 | 75 | - name: Upload JaCoCo coverage report to Codacy |
| 76 | + if: matrix.service == 'codacy' |
75 | 77 | uses: codacy/codacy-coverage-reporter-action@v1 |
76 | 78 | with: |
77 | 79 | project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} |
78 | | - coverage-reports: jacoco.xml |
| 80 | + force-coverage-parser: jacoco -r jacoco.xml |
0 commit comments