-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (71 loc) · 2.64 KB
/
ci.yml
File metadata and controls
84 lines (71 loc) · 2.64 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
81
82
83
84
name: CI
on:
push:
branches:
- 'main'
tags-ignore:
- 'v*'
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
build-and-test:
name: All Tests
runs-on: ubuntu-latest
permissions:
security-events: write # Required to upload Trivy SARIF results to GitHub code scanning.
steps:
- name: Harden Runner
uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
with:
disable-sudo-and-containers: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
check.trivy.dev:443
get.trivy.dev:443
github.com:443
mirror.gcr.io:443
registry.npmjs.org:443
release-assets.githubusercontent.com:443
repo.maven.apache.org:443
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: '21'
- name: Set up SBOM tools
uses: ./.github/actions/setup-sbom-tools
with:
github-token: ${{ github.token }}
- name: Build and run tests
run: ./mvnw -B -ntp -P integration-tests,generate-sbom verify
- name: Show WireMock log on failure
if: failure()
run: cat maven-plugin/target/wiremock.log 2>/dev/null || echo "(WireMock log not found)"
# Trivy runs here rather than in ci-guardrails.yml because it scans the
# CycloneDX SBOM produced by the Maven build (target/bom_all.json), which
# contains the exact resolved dependency graph including transitives.
# Scanning the SBOM is strictly more accurate than Trivy's own filesystem
# heuristics, and the SBOM only exists after the build completes.
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0
with:
scan-type: sbom
scan-ref: target/bom_all.json
format: sarif
output: trivy-results.sarif
severity: HIGH,CRITICAL
ignore-unfixed: true
- name: Upload Trivy SARIF file
if: always()
uses: github/codeql-action/upload-sarif@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.35.2
with:
sarif_file: trivy-results.sarif