Generate Coverage Badge #16
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: Generate Coverage Badge | |
| on: | |
| workflow_run: | |
| workflows: ["Java CI with Gradle"] | |
| types: | |
| - completed | |
| jobs: | |
| coverage: | |
| runs-on: ubuntu-latest | |
| env: | |
| APPLE_PRIVATE_KEY: ${{ secrets.APPLE_PRIVATE_KEY }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Run tests & generate Jacoco report | |
| run: ./gradlew test jacocoTestReport | |
| - name: Generate coverage badge JSON | |
| run: | | |
| chmod +x ./scripts/generate-badge-json.sh | |
| ./scripts/generate-badge-json.sh | |
| - name: Upload badge to GitHub Pages root | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./badges | |
| publish_branch: coverage-pages | |
| destination_dir: . | |
| keep_files: true |