diff --git a/.github/badges/branches.svg b/.github/badges/branches.svg new file mode 100644 index 000000000..cc80306a3 --- /dev/null +++ b/.github/badges/branches.svg @@ -0,0 +1 @@ +branches56.1% \ No newline at end of file diff --git a/.github/badges/jacoco.svg b/.github/badges/jacoco.svg new file mode 100644 index 000000000..89e962709 --- /dev/null +++ b/.github/badges/jacoco.svg @@ -0,0 +1 @@ +coverage77.4% \ No newline at end of file diff --git a/.github/workflows/myworkflow.yml b/.github/workflows/myworkflow.yml new file mode 100644 index 000000000..eef26830e --- /dev/null +++ b/.github/workflows/myworkflow.yml @@ -0,0 +1,61 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle + +name: JPacman CI with Gradle + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: write + packages: write + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + cache: gradle + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: xvfb-run ./gradlew build + + - name: Generate JaCoCo Badge + uses: cicirello/jacoco-badge-generator@v2 + with: + badges-directory: .github/badges + generate-coverage-badge: true + coverage-badge-filename: jacoco.svg + generate-branches-badge: true + branches-badge-filename: branches.svg + jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv + + - name: Check badge creation + run: ls -l .github/badges + + - name: Commit changes + uses: EndBug/add-and-commit@v9 + with: + default_author: github_actions + message: 'Updated JaCoCo badges' + add: '.github/badges/*.svg' + - name: Show test results + run: cat build/reports/jacoco/test/jacocoTestReport.csv + + + diff --git a/README.md b/README.md index f394aa1c5..18cd6cef7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # JPacman -[![Build Status](https://travis-ci.com/SERG-Delft/jpacman.svg?branch=master)](https://travis-ci.com/SERG-Delft/jpacman) +![Build Status](https://github.com/6487023Chanyanuch/jpacman/actions/workflows/myworkflow.yml/badge.svg) +![Coverage](.github/badges/jacoco.svg) +![Branches](.github/badges/branches.svg) ## About