51 Try to improve github jobs #6
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: Java CI with Maven | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
java_version: ${{ steps.setup-java.outputs.java-version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
id: setup-java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
build: | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- name: Use JDK ${{ needs.setup.outputs.java_version }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ needs.setup.outputs.java_version }} | |
distribution: 'temurin' | |
cache: maven | |
- name: Compile with maven | |
run: mvn clean compile | |
checkstyle: | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- name: Use JDK ${{ needs.setup.outputs.java_version }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ needs.setup.outputs.java_version }} | |
distribution: 'temurin' | |
cache: maven | |
- name: Checkstyle with maven | |
run: mvn checkstyle:check | |
test: | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- name: Use JDK ${{ needs.setup.outputs.java_version }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ needs.setup.outputs.java_version }} | |
distribution: 'temurin' | |
cache: maven | |
- name: Compile maven project | |
run: mvn clean compile | |
- name: Test maven project | |
run: mvn test |