Skip to content

Commit

Permalink
Merge pull request #4970 from cfpb/add-sbt-ci
Browse files Browse the repository at this point in the history
Add SBT to cve-scan workflow
  • Loading branch information
PatrickGoRaft authored Jan 27, 2025
2 parents fffa9a1 + 969a2b1 commit a43bee3
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 347 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/cve-scan-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ jobs:
- name: Check out repo
uses: actions/checkout@v4

- name: Setup sbt launcher
uses: sbt/setup-sbt@v1

- name: Build Docker image of HMDA platform
run: |
env JAVA_OPTS="-Xss256m -Xmx4096m" sbt "project hmda-platform" dockerPublishLocalSkipTests
continue-on-error: false
- name: Tag and name Docker image
run: docker tag hmda/hmda-platform:latest pr-cve-scan:latest

- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Install Grype
run: |
brew install grype
- name: Scan image
uses: anchore/scan-action@v6
with:
image: pr-cve-scan:latest
output-file: grype-report.txt
fail-build: false
severity-cutoff: high
output-format: table

- name: Run Grype scan
run: |
grype pr-cve-scan:latest > grype-report.txt
- name: Upload Grype report to artifact
uses: actions/upload-artifact@v4
with:
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/helper-functions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "Helper Functions"
on:
workflow_call:
inputs:
service:
required: true
type: string
output-file:
required: true
type: string
jobs:
test-service:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup sbt launcher
uses: sbt/setup-sbt@v1

- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'

- name: Run hmda-platform Tests
run: |
sbt "project ${{ inputs.service }}" "testOnly -- -l actions-ignore" 2>&1 | tee -a ${{ inputs.output-file }}
continue-on-error: true

- name: Check Test Results
run: |
if [ $(grep 'All tests passed.' ${{ inputs.output-file }} | wc -l) -ne 1 ]; then
echo "One or more projects had failures. Please review the logs."
cat ${{ inputs.output-file }}
exit 1
else
echo "All tests passed."
exit 0
fi
Loading

0 comments on commit a43bee3

Please sign in to comment.