Skip to content

Commit

Permalink
Update workflows for README badges
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicasyu committed Oct 3, 2023
1 parent d783c8c commit b11edc4
Show file tree
Hide file tree
Showing 7 changed files with 224 additions and 61 deletions.
121 changes: 98 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,110 @@ on: [push]
jobs:
build:
runs-on: ubuntu-latest

steps:

- name: Checkout the repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up JDK 1.8
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: 1.8

- name: Cache Gradle packages
uses: actions/cache@v2
java-version: '8'
distribution: 'corretto'

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- 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:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Grant execute permission for gradlew
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: |
chmod +x gradlew
- name: Test with Gradle
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

result:
if: ${{ always() }}

runs-on: ubuntu-latest

needs: [build]

steps:

- name: Checkout the repo
uses: actions/checkout@v4

- name: Get build result
run: |
./gradlew test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
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:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./build/reports/jacoco/test/jacocoTestReport.xml
verbose: true
branch: gh-pages
folder: docs/_badges
target-folder: _badges
clean: false
106 changes: 75 additions & 31 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: documentation
on:
push:
branches:
- master
- main
- develop

jobs:
documentation:
Expand All @@ -12,40 +13,83 @@ jobs:
steps:

- name: Checkout the repo
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
uses: actions/checkout@v4

- name: Set up JDK 1.8
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: 1.8

- name: Cache Gradle packages
uses: actions/cache@v2
java-version: '8'
distribution: 'corretto'

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Generate javadoc
run: ./gradlew javadoc

- name: Publish docs
uses: JamesIves/github-pages-deploy-action@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Grant execute permission for gradlew
run: |
chmod +x gradlew
- name: Generate documentation with Gradle
run: |
./gradlew javadoc
branch: gh-pages
folder: docs/javadoc
clean-exclude: |
_badges
_coverage
- name: Commit documentation changes
- name: Extract project version
run: |
git add -f docs/
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "Automated documentation updates"
- name: Push changes
uses: ad-m/github-push-action@master
echo "VERSION=$(grep -oP 'version = "\K([0-9\.]+)(?=")' build.gradle)" >> $GITHUB_ENV
- name: Generate version badge
uses: knightdave/[email protected]
with:
file: docs/_badges/version.svg
label: version
value: v${{ env.VERSION }}
color: teal
template: docs/_badges/template.svg
overwrite: true

- name: Generate license badge
uses: knightdave/[email protected]
with:
file: docs/_badges/license.svg
label: license
value: BSD-3-Clause
color: yellowgreen
template: docs/_badges/template.svg
overwrite: true

- name: Generate passing badge
if: success()
uses: knightdave/[email protected]
with:
file: docs/_badges/documentation.svg
label: docs
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/documentation.svg
label: docs
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:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
branch: gh-pages
folder: docs/_badges
target-folder: _badges
clean: false
33 changes: 32 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,40 @@ jobs:
fetch-depth: 0

- name: Lint code base
uses: dbelyaev/action-checkstyle@master
uses: dbelyaev/action-checkstyle@v0.9.5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-check
checkstyle_config: .github/config/checks.xml
fail_on_error: true

- name: Generate passing badge
if: success()
uses: knightdave/[email protected]
with:
file: docs/_badges/lint.svg
label: lint
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/lint.svg
label: lint
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
bin/
lib/
build/
docs/
docs/javadoc
working/
.DS_Store
MANIFEST.MF
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

## Agent-based model of heterogeneous cell populations in dynamic microenvironments

[![Build Status](https://github.com/bagherilab/ARCADE/workflows/build/badge.svg)](https://github.com/bagherilab/ARCADE/actions?query=workflow%3Abuild)
[![Documentation](https://github.com/bagherilab/ARCADE/workflows/documentation/badge.svg)](https://bagherilab.github.io/ARCADE/javadoc/overview-summary.html)
[![Codecov](https://img.shields.io/codecov/c/gh/bagherilab/ARCADE/v3.1)](https://codecov.io/gh/bagherilab/ARCADE)
[![Lint Status](https://github.com/bagherilab/ARCADE/workflows/lint/badge.svg)](https://github.com/bagherilab/ARCADE/actions?query=workflow%3Alint)
[![Build status](https://bagherilab.github.io/ARCADE/_badges/build.svg)](https://github.com/bagherilab/ARCADE/actions?query=workflow%3Abuild)
[![Lint status](https://bagherilab.github.io/ARCADE/_badges/lint.svg)](https://github.com/bagherilab/ARCADE/actions?query=workflow%3Alint)
[![Documentation](https://bagherilab.github.io/ARCADE/_badges/documentation.svg)](https://bagherilab.github.io/ARCADE/)
[![Coverage](https://bagherilab.github.io/ARCADE/_badges/coverage.svg)](https://bagherilab.github.io/ARCADE/_coverage/)
![Version](https://bagherilab.github.io/ARCADE/_badges/version.svg)
[![License](https://bagherilab.github.io/ARCADE/_badges/license.svg)](https://github.com/bagherilab/ARCADE/blob/develop/LICENSE)

ARCADE v2 is licensed under GPL 3. ARCADE v3+ is licensed under BSD 3-Clause.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id "jacoco"
}

version = "3.1"
version = "3.1.1"
sourceCompatibility = 1.8

repositories {
Expand Down
11 changes: 11 additions & 0 deletions docs/_badges/template.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b11edc4

Please sign in to comment.