-
Notifications
You must be signed in to change notification settings - Fork 9
91 lines (73 loc) · 2.99 KB
/
build.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Build
on:
push:
branches:
- '**'
pull_request:
branches: [ main ]
jobs:
build:
name: "Main build"
runs-on: ubuntu-latest
outputs:
candidate_version_revision: ${{ steps.candidate_version.outputs.candidate_version_revision }}
steps:
- uses: actions/checkout@v4
- name: Setup java
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-maven-
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Retrieve current version
id: current_version
run: echo "project_version=$(mvn help:evaluate -Dexpression=project.version -Dchangelist= -q -DforceStdout)" >> "$GITHUB_OUTPUT"
- name: Compute release candidate revision version
id: candidate_version
run: echo "candidate_version_revision=${{ steps.current_version.outputs.project_version }}.$GITHUB_RUN_ID" >> "$GITHUB_OUTPUT"
- name: Build candidate version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B clean install -Drevision=${{ steps.candidate_version.outputs.candidate_version_revision }} -Dchangelist=-rc org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=f-lopes_spring-mvc-test-utils
- name: Upload JaCoCo coverage reports to Codecov
uses: codecov/[email protected]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
smoke-tests:
name: "Run smoke tests with Java ${{ matrix.java }} for spring-mvc-test-utils ${{ needs.build.outputs.candidate_version_revision }}-rc version"
strategy:
matrix:
java: [ 17, 21 ]
runs-on: ubuntu-latest
needs: build
env:
candidate_version_revision: ${{ needs.build.outputs.candidate_version_revision }}
steps:
- uses: actions/checkout@v4
- name: Setup java ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-maven-
- name: Run smoke tests with Java ${{ matrix.java }} for spring-mvc-test-utils ${{ needs.build.outputs.candidate_version_revision }}-rc version
run: mvn -B -Psmoke-tests -Dspring-mvc-test-utils.version=${candidate_version_revision}-rc -Djava.version=${{ matrix.java }} clean verify