Update maven.yml #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Java CI with Maven | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events. | |
push: | |
branches: ["*"] | |
paths: ["**.java", ".github/workflows/maven.yml", "pom.xml"] | |
pull_request: | |
branches: ["*"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: "17" | |
distribution: "adopt" | |
cache: maven | |
- name: Code vulnerability scanning | |
uses: anchore/scan-action@v3 | |
id: scan | |
with: | |
path: "${{ github.workspace }}" | |
fail-build: false | |
severity-cutoff: high | |
acs-report-enable: true | |
- name: Upload vulnerability report | |
uses: github/codeql-action/upload-sarif@v3 | |
if: success() || failure() | |
with: | |
sarif_file: ${{ steps.scan.outputs.sarif }} | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "adopt" | |
java-version: "17" | |
- name: Build with Maven | |
run: mvn -B package -Pcoverage | |
coverage: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- run: mvn -B test -P coverage --no-transfer-progress | |
- uses: codecov/codecov-action@v1 | |
with: | |
file: ./**/target/site/jacoco/jacoco.xml | |
name: codecov |