Skip to content

Bump org.apache.maven.plugins:maven-checkstyle-plugin #843

Bump org.apache.maven.plugins:maven-checkstyle-plugin

Bump org.apache.maven.plugins:maven-checkstyle-plugin #843

name: Earthly/Maven CI
env:
OWASP_NVD_API_KEY: ${{ secrets.OWASP_NVD_API_KEY }}
# Workaround for: https://github.com/earthly/earthly/issues/4220
EARTHLY_DISABLE_REMOTE_REGISTRY_PROXY: true
# Ignore cross-build files with Gradle
on:
push:
paths-ignore:
# Generic files to ignore for building
- '*.md'
- 'images/**'
# These ignores are specific to a cross-build against Gradle
- 'build.gradle'
- 'gradle/**' # Directory is distinct from files in GitHub ignores
- 'gradle*' # Wrapper scripts and properties
- '.gradle'
- '.github/workflows/*gradle*'
# These ignores are specific to this project
- 'run-with-gradle.sh'
pull_request:
paths-ignore:
# Generic files to ignore for building
- '*.md'
- 'images/**'
# These ignores are specific to a cross-build against Gradle
- 'build.gradle'
- 'gradle/**' # Directory is distinct from files in GitHub ignores
- 'gradle*' # Wrapper scripts and properties
- '.gradle'
- '.github/workflows/*gradle*'
# These ignores are specific to this project
- 'run-with-gradle.sh'
workflow_dispatch:
jobs:
build:
name: Builds and tests
runs-on: ubuntu-latest
steps:
- name: Use Earthly
uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# The version in CI should match the version you use locally.
# This is a manual step.
# Using "latest" to force CI warnings if Earthfile is outdated
version: "latest"
- name: Clone repository
uses: actions/checkout@v4
- name: Restore Maven caches
uses: actions/cache@master
env:
cache-name: maven-cache
with:
path: ~/.m2
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Build and test
run: earthly --secret OWASP_NVD_API_KEY +build-with-maven
- name: Execute run script
run: earthly --secret OWASP_NVD_API_KEY +run-with-maven
# Save artifacts for build
# See Earthfile that copies these from container to local
- name: Save Jar for main
uses: actions/upload-artifact@v4
with:
name: jar-main
if-no-files-found: error
path: target/modern-java-practices-0-SNAPSHOT.jar
# Javadoc HTML and jars
- name: Save Javadoc HTML for main
uses: actions/upload-artifact@v4
with:
name: javadoc-html-main
if-no-files-found: error
path: target/reports/apidocs/
- name: Save Javadoc HTML Jar for main
uses: actions/upload-artifact@v4
with:
name: javadoc-jar-main
if-no-files-found: error
path: target/modern-java-practices-0-SNAPSHOT-javadoc.jar
- name: Save Javadoc HTML for unit tests
uses: actions/upload-artifact@v4
with:
name: javadoc-html-unittests
if-no-files-found: error
path: target/reports/testapidocs/
- name: Save Javadoc HTML Jar for unit tests
uses: actions/upload-artifact@v4
with:
name: javadoc-jar-unittests
if-no-files-found: error
path: target/modern-java-practices-0-SNAPSHOT-test-javadoc.jar
# Coverage coverage report
- name: Save coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
if-no-files-found: error
path: target/site/jacoco/
# Generate coverage badge for README
# Gradle builds are similar but will require configuration the path for the
# CSV JaCoCo report.
- name: Generate coverage badge
uses: cicirello/jacoco-badge-generator@v2
with:
badges-directory: images
generate-branches-badge: false
generate-summary: false
# The saved badge does not appear when you pull code locally
- name: Add coverage to CI repo
# Limit frontpage badge to mainline code, not branches or PRs
if: ${{ github.ref == 'refs/head/master' }}
run: |
cd images
if [[ ! -z "$(git status --porcelain *.svg)" ]]; then
git config --global user.name 'github-actions'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add *.svg
git commit -m 'Autogenerated coverage badge'
git push
fi