Skip to content

Update free locations method (#134) #588

Update free locations method (#134)

Update free locations method (#134) #588

Workflow file for this run

name: build
on: [push]
jobs:
run-gradle-build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Set up JDK 1.11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'corretto'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Run Gradle build
run: |
./gradlew build
rm build/reports/jacoco/test/html/jacoco-sessions.html
- name: Upload JaCoCo coverage artifact
uses: actions/upload-artifact@v4
with:
name: jacoco-coverage
path: build/reports/jacoco/test/html
publish-jacoco-coverage:
if: ${{ always() && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: run-gradle-build
outputs:
COVERAGE_PERCENT: ${{ steps.coverage-percent.outputs.COVERAGE_PERCENT }}
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Download JaCoCo coverage artifact
uses: actions/download-artifact@v4
with:
name: jacoco-coverage
path: pages/coverage
- name: Extract coverage percent
id: coverage-percent
run: |
echo "COVERAGE_PERCENT=$(grep -oP '>\K([0-9]+)(?=%)' pages/coverage/index.html | head -n 1)" >> $GITHUB_OUTPUT
- name: Publish coverage report
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: pages/coverage
target-folder: coverage
update-build-badges:
if: ${{ always() && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: [run-gradle-build, publish-jacoco-coverage]
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Generate coverage badge
uses: knightdave/[email protected]
with:
file: docs/badges/coverage.svg
label: coverage
value: ${{ needs.publish-jacoco-coverage.outputs.COVERAGE_PERCENT }}
value_format: "%d%%"
anybadge_args: 50=red 60=orange 80=yellow 100=green
template: docs/badges/template.svg
overwrite: true
- name: Get build result
run: |
if [[ ${{ needs.run-gradle-build.result }} == "success" || ${{ needs.run-gradle-build.result }} == "skipped" ]]; then
exit 0
else
exit 1
fi
- name: Generate passing badge
if: success()
uses: knightdave/[email protected]
with:
file: docs/badges/build.svg
label: build
value: passing
color: green
template: docs/badges/template.svg
overwrite: true
- name: Generate failing badge
if: failure()
uses: knightdave/[email protected]
with:
file: docs/badges/build.svg
label: build
value: failing
color: red
template: docs/badges/template.svg
overwrite: true
- name: Publish badge
if: success() || failure()
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/badges
target-folder: badges
clean: false