Skip to content

Commit 3d64f03

Browse files
committed
chore: ci
1 parent c01abde commit 3d64f03

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

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

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

0 commit comments

Comments
 (0)