Skip to content

For #449

For #449 #407

name: Build with Maven using Earthly
on:
push:
paths-ignore:
- '*.md'
- 'images/**'
pull_request:
paths-ignore:
- '*.md'
- 'images/**'
workflow_dispatch:
jobs:
build:
name: Builds and tests
runs-on: ubuntu-latest
# First run in GitHub actions - verify this
# Afterwards, change to a comment
strategy:
matrix:
include:
- java: 21
steps:
- name: Use Earthly
uses: earthly/actions-setup@v1
with:
version: "latest"
- name: Clone repository
uses: actions/checkout@master
- 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 +build-with-maven
- name: Execute run script
run: earthly +run-with-maven
- name: Generate coverage badge
# if: ${{ github.ref == 'refs/head/master' }}
uses: cicirello/jacoco-badge-generator@v2
with:
badges-directory: images
generate-branches-badge: false
generate-summary: false
- name: Save coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: target/site/jacoco
- name: Add coverage to repo
# 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 || echo "$0: Another build won for coverage badge" >&2
fi