Fix a few possible null dereferences by adding additional checks #17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Java CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: maven | |
- name: Verify test files exist | |
run: | | |
ls -R src/tests/java/data | |
[ -f "src/tests/java/data/test1/expected1.out" ] || exit 1 | |
[ -f "src/tests/java/data/test1/test1.json" ] || exit 1 | |
- name: Run tests | |
run: mvn test | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
- name: Run tests | |
run: mvn test | |
- name: Upload test results | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: target/surefire-reports/ | |
retention-days: 5 | |
- name: Upload coverage report | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: target/site/jacoco/ | |
retention-days: 5 | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Check for common code issues | |
run: mvn spotbugs:check |