-
-
Notifications
You must be signed in to change notification settings - Fork 172
51 lines (45 loc) · 2.22 KB
/
maven.yml
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
# This workflow will build a Java project with Maven, 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-maven
name: Java CI with Maven
on:
pull_request:
paths-ignore:
- '.github/**'
- '!.github/workflows/maven.yml'
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: ['11', '17', '21']
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK ${{ matrix.Java }}
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
with:
java-version: ${{ matrix.Java }}
distribution: 'temurin'
cache: maven
- uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v0.20.1
name: Set up reviewdog
with:
reviewdog_version: latest
- name: Build with Maven
run: mvn --batch-mode --errors --fail-at-end --show-version -Dgpg.skip -Djava.awt.headless=true compile test-compile
- name: Run CodeStyleTest
if: ${{ matrix.Java == 21 }}
run: EXPORT_FAILURES=1 mvn --batch-mode --fail-never --show-version -Dgpg.skip -Djava.awt.headless=true -Dtest=org.htmlunit.CodeStyleTest test
- name: Upload check results
if: ${{ matrix.Java == 21 }}
env:
WORKDIR: ./
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
[ -s target/CodeStyle.txt ] && cat target/CodeStyle.txt | { reviewdog -efm="%f, line %l: %m" -name="CodeStyleTest::codeStyle" -reporter=github-pr-check -filter-mode=diff_context -fail-on-error || touch reporterror; }
[ -s target/Tests.txt ] && cat target/Tests.txt | { reviewdog -efm="%f, line %l: %m" -name="CodeStyleTest::tests" -reporter=github-pr-check -filter-mode=diff_context -fail-on-error || touch reporterror; }
[ -s target/XMLStyle.txt ] && cat target/XMLStyle.txt | { reviewdog -efm="%f, line %l: %m" -name="CodeStyleTest::xmlStyle" -reporter=github-pr-check -filter-mode=diff_context -fail-on-error || touch reporterror; }
[ -f reporterror ] && exit 1
exit 0