Skip to content

Commit 13a1016

Browse files
committed
chore: ci
1 parent c01abde commit 13a1016

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

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

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

0 commit comments

Comments
 (0)