Skip to content

Merge pull request #4 from MCCitiesNetwork/develop #24

Merge pull request #4 from MCCitiesNetwork/develop

Merge pull request #4 from MCCitiesNetwork/develop #24

Workflow file for this run

name: Test & Coverage
on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master, develop]
workflow_dispatch:
permissions:
contents: read
checks: write # surface JUnit results as a check
pull-requests: write # post coverage comment on PRs
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
cache: maven
# Unit tests only — no real Bukkit server, no MariaDB, no Docker.
# Listener / command / database packages are excluded from JaCoCo
# because they require an integration environment to exercise.
# -U forces a snapshot update each run. The build depends on
# net.democracycraft:treasury-api:*-SNAPSHOT; with `cache: maven` and
# Maven's default daily snapshot update policy, the runner would
# otherwise reuse a stale cached snapshot and miss newly published API
# (e.g. MarketApi), failing to compile.
- name: Run tests + JaCoCo
run: mvn -B -U -pl plugin -am test -DfailIfNoTests=false
- name: Publish test results
if: always()
uses: mikepenz/action-junit-report@v4
with:
report_paths: '**/plugin/target/surefire-reports/TEST-*.xml'
require_tests: true
detailed_summary: true
- name: Upload coverage report on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: |
plugin/target/surefire-reports/
plugin/target/site/jacoco/
# PR-only: comment with overall + per-changed-file coverage.
# No hard gate — the goal is visibility on this fork; production gates
# are enforced by the consumer plugins (treasury, business-rian).
- name: Coverage report
if: github.event_name == 'pull_request'
uses: madrapps/jacoco-report@v1.7.1
with:
paths: ${{ github.workspace }}/plugin/target/site/jacoco/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 0
min-coverage-changed-files: 60
title: Coverage report
update-comment: true
pass-emoji: ':white_check_mark:'
fail-emoji: ':x:'