chemotherapy scheduling #385
This file contains 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: build | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
- name: Set up JDK 1.11 | |
uses: actions/setup-java@v3 | |
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: Publish coverage report | |
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' }} | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: build/reports/jacoco/test/html | |
target-folder: _coverage | |
- name: Extract coverage percent | |
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' }} | |
run: | | |
echo "COVERAGE=$(grep -oP '>\K([0-9]+)(?=%)' build/reports/jacoco/test/html/index.html | head -n 1)" >> $GITHUB_ENV | |
- name: Generate coverage badge | |
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' }} | |
uses: knightdave/[email protected] | |
with: | |
file: docs/_badges/coverage.svg | |
label: coverage | |
value: ${{ env.COVERAGE }} | |
value_format: "%d%%" | |
anybadge_args: 50=red 60=orange 80=yellow 100=green | |
template: docs/_badges/template.svg | |
overwrite: true | |
- name: Publish badge | |
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' }} | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: docs/_badges | |
target-folder: _badges | |
clean: false | |
build_result: | |
if: ${{ always() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') }} | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
- name: Get build result | |
run: | | |
if [[ ${{ needs.build.result }} == "success" || ${{ needs.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 |