6
6
pull_request :
7
7
branches : [ master ]
8
8
9
- jobs :
10
- build-and-test :
11
- runs-on : ubuntu-22.04
9
+ defaults :
10
+ run :
11
+ shell : bash
12
+
13
+ env :
14
+ JAVA_VERSION : ' 17'
15
+ UBUNTU_VERSION : ' ubuntu-22.04'
12
16
17
+ jobs :
18
+ build :
19
+ runs-on : ${{ env.UBUNTU_VERSION }}
13
20
steps :
14
21
- uses : actions/checkout@v3
15
- with :
16
- fetch-depth : 0 # Required for Code Climate
17
22
18
23
- name : Set up JDK
19
24
uses : actions/setup-java@v3
20
25
with :
21
- java-version : ' 17 '
26
+ java-version : ${{ env.JAVA_VERSION }}
22
27
distribution : ' adopt'
23
28
cache : maven
24
29
25
30
- name : Build with Maven
26
31
run : mvn clean install
27
32
28
- # Upload build artifacts
29
33
- name : Upload build artifacts
30
34
if : always()
31
35
uses : actions/upload-artifact@v4
32
36
with :
33
37
name : build-artifacts
34
38
path : target/*.jar
35
39
40
+ test :
41
+ needs : build
42
+ runs-on : ${{ env.UBUNTU_VERSION }}
43
+ steps :
44
+ - uses : actions/checkout@v3
45
+
46
+ - name : Set up JDK
47
+ uses : actions/setup-java@v3
48
+ with :
49
+ java-version : ${{ env.JAVA_VERSION }}
50
+ distribution : ' adopt'
51
+ cache : maven
52
+
36
53
- name : Run Tests
37
54
run : mvn test
38
55
39
- # Upload Surefire test results
40
56
- name : Upload Surefire test results
41
57
if : always()
42
58
uses : actions/upload-artifact@v4
43
59
with :
44
60
name : surefire-reports
45
61
path : target/surefire-reports/
46
62
47
- # Upload JaCoCo reports
48
63
- name : Upload JaCoCo reports
49
64
if : always()
50
65
uses : actions/upload-artifact@v4
51
66
with :
52
67
name : jacoco-reports
53
68
path : target/site/jacoco/
54
69
55
- # Code Climate Setup and Analysis
70
+
71
+ code-scan :
72
+ needs : build
73
+ runs-on : u${{ env.UBUNTU_VERSION }}
74
+ steps :
75
+ - uses : actions/checkout@v3
76
+ with :
77
+ fetch-depth : 0
78
+
56
79
- name : Setup Code Climate
57
80
run : |
58
81
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
@@ -66,11 +89,15 @@ jobs:
66
89
JACOCO_SOURCE_PATH=src/main/java ./cc-test-reporter format-coverage target/site/jacoco/jacoco.xml --input-type jacoco
67
90
./cc-test-reporter upload-coverage
68
91
69
- # Install Snyk CLI
92
+ security-scan :
93
+ needs : build
94
+ runs-on : ${{ env.UBUNTU_VERSION }}
95
+ steps :
96
+ - uses : actions/checkout@v3
97
+
70
98
- name : Install Snyk CLI
71
99
run : npm install -g snyk
72
100
73
- # Run Snyk to check for vulnerabilities
74
101
- name : Run Snyk to check for vulnerabilities
75
102
continue-on-error : true
76
103
env :
0 commit comments