Skip to content

docs: Updated README #13

docs: Updated README

docs: Updated README #13

Workflow file for this run

name: 'Build & Test'
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
inputs:
commit:
description: If the commit you want to test isn't the head of a branch, provide its SHA here
required: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
- name: Build
run: ./gradlew shadowJar
test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
- name: Test
run: ./gradlew test
- name: Create badges dir if necessary
run: mkdir -p .github/badges
- name: Generate JaCoCo Badge
uses: cicirello/jacoco-badge-generator@v2
with:
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv
coverage-badge-filename: jacoco.svg
- name: Log coverage percentage
run: |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Check if there are any changes
id: verify_diff
run: |
git diff --quiet .github/badges/jacoco.svg || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit badge
if: steps.verify_diff.outputs.changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .github/badges/jacoco.svg
git commit -m "Add/Update Jacoco badge"
- name: Push badge commit
if: steps.verify_diff.outputs.changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.extract_branch.outputs.branch }}