-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (75 loc) · 2.23 KB
/
Copy pathjava_test.yml
File metadata and controls
80 lines (75 loc) · 2.23 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
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
name: Java Services Test
on:
pull_request:
branches: [main]
paths:
- 'services/user_service/**'
- 'services/follow_service/**'
jobs:
common:
name: Scan for Secrets & Detect Changed Services
uses: ./.github/workflows/_common.yml
with:
services-to-check: '["user_service", "follow_service"]'
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
checkstyle:
name: Checkstyle (${{ matrix.service }})
needs: common
if: needs.common.outputs.matrix != '[""]'
runs-on: ubuntu-latest
strategy:
matrix:
service: ${{ fromJson(needs.common.outputs.matrix) }}
fail-fast: false
steps:
- uses: actions/checkout@v6
with:
sparse-checkout: |
services/${{ matrix.service }}
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Run Checkstyle
working-directory: services/${{ matrix.service }}
run: |
./mvnw org.apache.maven.plugins:maven-checkstyle-plugin:3.6.0:check \
-Dcheckstyle.config.location=google_checks.xml \
-Dcheckstyle.failsOnError=true
security:
name: Security (${{ matrix.service }})
needs: common
if: needs.common.outputs.matrix != '[""]'
strategy:
matrix:
service: ${{ fromJson(needs.common.outputs.matrix) }}
fail-fast: false
uses: ./.github/workflows/pre_security.yml
with:
service: ${{ matrix.service }}
service_path: services/${{ matrix.service }}
rulesets: "p/java p/owasp-top-ten"
test:
name: Tests (${{ matrix.service }})
needs: [common, checkstyle, security]
if: needs.common.outputs.matrix != '[""]'
runs-on: ubuntu-latest
strategy:
matrix:
service: ${{ fromJson(needs.common.outputs.matrix) }}
fail-fast: false
steps:
- uses: actions/checkout@v6
with:
sparse-checkout: |
services/${{ matrix.service }}
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Run Tests
working-directory: services/${{ matrix.service }}
run: ./mvnw test