diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8123f0820..52bd9af3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ on: [ push, pull_request ] permissions: checks: write pull-requests: write - + jobs: build-java-8-plus: strategy: @@ -40,7 +40,7 @@ jobs: - name: Build run: ./gradlew build --no-daemon - + - name: Publish Test Results (Linux) uses: EnricoMi/publish-unit-test-result-action@v2 if: ${{ always() && matrix.os == 'ubuntu-latest' }} @@ -48,7 +48,7 @@ jobs: junit_files: | build/test-results/test/**/*.xml picocli-*/build/test-results/test/**/*.xml - + - name: Publish Test Results (Win/Mac) uses: EnricoMi/publish-unit-test-result-action/composite@v2 if: ${{ always() && (matrix.os == 'macos-latest' || matrix.os == 'windows-latest') }} @@ -56,7 +56,42 @@ jobs: junit_files: | build/test-results/test/**/*.xml picocli-*/build/test-results/test/**/*.xml - + + + - name: Set badge color + shell: bash + run: | + case ${{ fromJSON( steps.test-results.outputs.json ).conclusion }} in + success) + echo "BADGE_COLOR=31c653" >> $GITHUB_ENV + ;; + failure) + echo "BADGE_COLOR=800000" >> $GITHUB_ENV + ;; + neutral) + echo "BADGE_COLOR=696969" >> $GITHUB_ENV + ;; + esac + + - name: Create badge + uses: emibcn/badge-action@d6f51ff11b5c3382b3b88689ae2d6db22d9737d1 + with: + label: Tests + status: '${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests }} tests, ${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.runs }} runs: ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}' + color: ${{ env.BADGE_COLOR }} + path: badge.svg + + - name: Upload badge to Gist + # Upload only for master branch + if: > + github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'master' || + github.event_name != 'workflow_run' && github.ref == 'refs/heads/master' + uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d + with: + token: ${{ secrets.GIST_TOKEN }} + gistURL: https://gist.githubusercontent.com/remkop/picocli + file: badge.svg + build-java-6-7: strategy: diff --git a/README.md b/README.md index 3d3afde5f..d09d6800d 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![GitHub Release](https://img.shields.io/github/release/remkop/picocli.svg)](https://github.com/remkop/picocli/releases) [![Maven Central](https://img.shields.io/maven-central/v/info.picocli/picocli.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22info.picocli%22%20AND%20a:%22picocli%22) [![GitHub Actions Build Status](https://github.com/remkop/picocli/actions/workflows/ci.yml/badge.svg)](https://github.com/remkop/picocli/actions/workflows/ci.yml) +[![Test Results](https://gist.githubusercontent.com/{user}/{id}/raw/badge.svg)](https://github.com/remkop/picocli/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/remkop/picocli/branch/master/graph/badge.svg)](https://codecov.io/gh/remkop/picocli) [![Follow @remkopopma](https://img.shields.io/twitter/follow/remkopopma.svg?style=social)](https://twitter.com/intent/follow?screen_name=remkopopma) [![Follow @picocli](https://img.shields.io/twitter/follow/picocli.svg?style=social)](https://twitter.com/intent/follow?screen_name=picocli) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 96bc7bc94..7baf54df7 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -37,6 +37,7 @@ Artifacts in this release are signed by Remko Popma (6601 E5C0 8DCC BB96). * [#1910][#1917] DOC: Fix broken link to Zero Bug Commitment. Thanks to [Jiehong](https://github.com/Jiehong) for raising this and thanks to [Andreas Deininger](https://github.com/deining) for the pull request. * [#1915] DOC: Improve default provider examples. Thanks to [David](https://github.com/DavidTheExplorer) for raising this. * [#1918][#1920] DOC: Removed unused Travis CI badge and associated broken link from README. Thanks to [Andreas Deininger](https://github.com/deining) for raising this and the pull request. +* [#706] DOC: Add GitHub badge with test count to README. * [#1939] BUILD: Fix `picocli-annotation-processing-tests` failures on Java 16+: rewrite tests to avoid Google `compiler-test` API that internally uses `com.sun.tools.javac.util.Context`. * [#1887] DEP: Bump biz.aQute.bnd.gradle from 6.3.1 to 6.4.0 * [#1865] DEP: Bump ivy from 2.5.0 to 2.5.1