Skip to content

Commit 7ef8600

Browse files
committed
chore: ci
1 parent c01abde commit 7ef8600

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

.github/workflows/build-and-test.yml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Gradle CI
2+
3+
on: [workflow_dispatch, workflow_call, push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
build:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
#max-parallel: 3
13+
fail-fast: false
14+
matrix:
15+
java: [ '17', '21' ]
16+
os: [ 'ubuntu-latest' ]
17+
name: Java ${{ matrix.Java }}
18+
steps:
19+
- uses: actions/checkout@v3
20+
with:
21+
fetch-depth: '0'
22+
- name: "Setup Git"
23+
shell: bash
24+
run: |
25+
git branch -a
26+
for branch in $(
27+
git branch -a \
28+
| grep '^\s*remotes' \
29+
| egrep --invert-match '(:?HEAD|remotes/pull/[0-9]+/merge)$' \
30+
| sed -e "s/^.*remotes\/origin\///"
31+
); do
32+
echo setting up $branch
33+
git checkout $branch
34+
git checkout -
35+
done
36+
git branch -a
37+
git remote remove origin
38+
git remote add origin [email protected]:${GITHUB_REPOSITORY}.git
39+
git remote -v
40+
- name: Setup java
41+
uses: actions/setup-java@v2
42+
with:
43+
distribution: 'zulu'
44+
java-version: ${{ matrix.java }}
45+
- name: prepare Gradle
46+
shell: bash
47+
run: |
48+
mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties
49+
- name: Check formatting
50+
shell: bash
51+
run: |
52+
./gradlew --no-daemon spotlessJavaCheck
53+
- name: "Gradle build"
54+
shell: bash
55+
run: |
56+
java -version
57+
javac -version
58+
./gradlew --no-daemon build
59+
60+
- name: Transorm static code analysis to SARIF
61+
if: ${{ (success() || failure()) }}
62+
run: |
63+
npx violations-command-line -sarif sarif-report.json \
64+
-v "FINDBUGS" "." ".*build/reports/spotbugs/main\.xml$" "Spotbugs" \
65+
-v "CHECKSTYLE" "." ".*build/reports/checkstyle/main\.xml$" "Checkstyle" \
66+
-v "PMD" "." ".*build/reports/pmd/main\.xml$" "PMD" \
67+
-v "JUNIT" "." ".*/build/test-results/test/TEST-.*\.xml$" "JUNIT"
68+
- uses: github/codeql-action/upload-sarif@v3
69+
if: ${{ (success() || failure()) }}
70+
with:
71+
sarif_file: sarif-report.json
72+
category: violations-lib
73+
74+
- name: Publish Build
75+
uses: actions/upload-artifact@v4
76+
if: failure()
77+
with:
78+
name: build-${{ github.run_number }}-${{ matrix.java }}
79+
path: ${{ github.workspace }}

0 commit comments

Comments
 (0)