Improved test coverage #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| pull_request: | |
| branches: [ main, master ] | |
| push: | |
| branches: [ main, master ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| unit-tests-coverage: | |
| name: Unit Tests + Coverage | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - paper-version: "1.21.11-R0.1-SNAPSHOT" | |
| mockbukkit-artifactId: "mockbukkit-v1.21" | |
| mockbukkit-version: "4.101.0" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: '21' | |
| cache: maven | |
| - name: Run unit tests with JaCoCo | |
| run: > | |
| mvn -B -ntp | |
| -Dpaper.version=${{ matrix.paper-version }} | |
| -Dmockbukkit.artifactId=${{ matrix.mockbukkit-artifactId }} | |
| -Dmockbukkit.version=${{ matrix.mockbukkit-version }} | |
| jacoco:prepare-agent test jacoco:report | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: unit-coverage-report | |
| path: target/site/jacoco/jacoco.xml | |
| if-no-files-found: error | |
| retention-days: 7 | |
| - name: Upload unit coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: target/site/jacoco/jacoco.xml | |
| flags: unit-tests | |
| name: unit-tests | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| feature-tests-coverage: | |
| name: Feature Tests + Coverage | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - paper-version: "1.21.11-R0.1-SNAPSHOT" | |
| mockbukkit-artifactId: "mockbukkit-v1.21" | |
| mockbukkit-version: "4.101.0" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: '21' | |
| cache: maven | |
| - name: Run feature tests with JaCoCo | |
| run: > | |
| mvn -B -ntp | |
| -Dpaper.version=${{ matrix.paper-version }} | |
| -Dmockbukkit.artifactId=${{ matrix.mockbukkit-artifactId }} | |
| -Dmockbukkit.version=${{ matrix.mockbukkit-version }} | |
| -Pfeature-tests -Dtest=*FeatureTest | |
| jacoco:prepare-agent test jacoco:report | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: feature-coverage-report | |
| path: target/site/jacoco/jacoco.xml | |
| if-no-files-found: error | |
| retention-days: 7 | |
| - name: Upload feature coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: target/site/jacoco/jacoco.xml | |
| flags: feature-tests | |
| name: feature-tests | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} |