Skip to content

Commit

Permalink
chore: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed May 1, 2024
1 parent c01abde commit 03350b6
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Gradle CI

on: [workflow_dispatch, workflow_call, push, pull_request]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
#max-parallel: 3
fail-fast: false
matrix:
java: [ '17', '21' ]
os: [ 'ubuntu-latest' ]
name: Java ${{ matrix.Java }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: "Setup Git"
shell: bash
run: |
git branch -a
for branch in $(
git branch -a \
| grep '^\s*remotes' \
| egrep --invert-match '(:?HEAD|remotes/pull/[0-9]+/merge)$' \
| sed -e "s/^.*remotes\/origin\///"
); do
echo setting up $branch
git checkout $branch
git checkout -
done
git branch -a
git remote remove origin
git remote add origin [email protected]:${GITHUB_REPOSITORY}.git
git remote -v
- name: Setup java
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
- name: prepare Gradle
shell: bash
run: |
mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties
- name: Check formatting
shell: bash
run: |
./gradlew --no-daemon spotlessJavaCheck
- name: "Gradle build"
shell: bash
run: |
java -version
javac -version
./gradlew --no-daemon build
- name: Transorm static code analysis to SARIF
if: ${{ (success() || failure()) }}
run: |
npx violations-command-line -sarif sarif-report.json \
-v "FINDBUGS" "." ".*build/reports/spotbugs/main\.xml$" "Spotbugs" \
-v "CHECKSTYLE" "." ".*build/reports/checkstyle/main\.xml$" "Checkstyle" \
-v "PMD" "." ".*build/reports/pmd/main\.xml$" "PMD" \
-v "JUNIT" "." ".*/build/test-results/test/TEST-.*\.xml$" "JUNIT"
- uses: github/codeql-action/upload-sarif@v3
if: ${{ (success() || failure()) }}
with:
sarif_file: sarif-report.json
category: violations-lib

- name: Publish Build
uses: actions/upload-artifact@v4
if: failure()
with:
name: build-${{ github.run_number }}-${{ matrix.java }}
path: ${{ github.workspace }}

0 comments on commit 03350b6

Please sign in to comment.