Adds check for license headers and unused imports #112
This file contains 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: build | |
permissions: read-all | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- java: 8 | |
- java: 11 | |
upload_reports: true | |
- java: 17 | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
with: | |
submodules: recursive | |
# Need to also fetch origin/master for the "rachetFrom" functionality of the "spotless" gradle plugin | |
- run: git fetch origin/master | |
- uses: gradle/wrapper-validation-action@b231772637bb498f11fdbc86052b6e8a8dc9fc92 # v2.1.2 | |
- name: Use java ${{ matrix.java }} | |
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 | |
with: | |
distribution: 'corretto' | |
java-version: ${{ matrix.java }} | |
- uses: gradle/gradle-build-action@fe59895742b4f984530980e4f693943577526b61 # v3.2.0 | |
with: | |
arguments: build | |
- name: Test minified JAR | |
uses: gradle/gradle-build-action@fe59895742b4f984530980e4f693943577526b61 # v3.2.0 | |
with: | |
arguments: minifyTest | |
- run: ./ion-test-driver-run version | |
- if: ${{ matrix.upload_reports }} | |
uses: codecov/codecov-action@7afa10ed9b269c561c2336fd862446844e0cbf71 # v4.2.0 | |
with: | |
files: build/reports/jacoco/test/jacocoTestReport.xml | |
- uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595 # v4.1.0 | |
with: | |
name: spotbugs-report-${{ matrix.runs-on }}-java-${{ matrix.java }} | |
path: build/reports/spotbugs/ | |
check-version: | |
# Ensures that the version is not a release (i.e. -SNAPSHOT) or if it is a release version, | |
# ensures that the version is a later version number than the existing releases. | |
# See limitations at: | |
# https://github.com/amazon-ion/ion-java/blob/master/.github/actions/inspect-version/action.yml | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v3.6.0 | |
- name: Get Project Version | |
run: | | |
echo "PROJECT_VERSION=v$(<project.version)" >> $GITHUB_ENV | |
- uses: ./.github/actions/inspect-version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
repo: amazon-ion/ion-java | |
project_version: ${{ env.PROJECT_VERSION }} | |
fail_if_invalid: true |