-
Notifications
You must be signed in to change notification settings - Fork 6
74 lines (71 loc) · 2.4 KB
/
Copy pathgithub-actions.yml
File metadata and controls
74 lines (71 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Build and Test
on:
pull_request:
branches:
- main
push:
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/jacoco-report@v1.7.1 # 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@v4
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/github-action-markdown-cli@v3.4.0
with:
files: '**/*.md'