Chore: Migrate build process from gradle to maven #678
Workflow file for this run
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 and Test | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '21' | |
distribution: 'adopt' | |
cache: maven | |
- name: Build with maven | |
run: mvn -Pgithub-action clean verify | |
- name: Publish Unit Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
#if: always() # clause guarantees that this action always runs, even if earlier steps (e.g., the unit test step) in your workflow fail. | |
with: | |
files: ${{ github.workspace }}/target/surefire-reports/**/*.xml | |
- name: Add coverage to PR | |
id: jacoco | |
uses: madrapps/[email protected] # requires at least two pushes to a PR, see https://github.com/Madrapps/jacoco-report/issues/13 | |
with: | |
paths: ${{ github.workspace }}/target/jacoco-report/jacoco.xml | |
token: ${{ secrets.GITHUB_TOKEN }} | |
min-coverage-overall: 40 | |
min-coverage-changed-files: 60 | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-coverage-report | |
path: target/jacoco-report/** | |
- name: ls | |
run: ls -al target/jacoco-report/ | |
- name: Generate JaCoCo Badge | |
uses: cicirello/jacoco-badge-generator@v2 | |
with: | |
jacoco-csv-file: target/jacoco-report/jacoco.csv | |
generate-coverage-badge: true | |
badges-directory: .github/badges | |
- name: Commit the badge (if it changed) | |
run: | | |
git config user.name 'github-actions[bot]' | |
git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
if [[ `git diff --exit-code .github/badges/jacoco.svg` ]]; then | |
git add .github/badges/jacoco.svg | |
git commit -m "Autogenerated JaCoCo coverage badge" | |
git push | |
fi | |
lint-markdown: | |
name: Lint all markdown files in project | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Lint markdowns | |
uses: nosborn/[email protected] | |
with: | |
files: '**/*.md' | |