diff --git a/.github/workflows/JavaMavenCI.yml b/.github/workflows/JavaMavenCI.yml index 9e637d8..814733d 100644 --- a/.github/workflows/JavaMavenCI.yml +++ b/.github/workflows/JavaMavenCI.yml @@ -7,49 +7,67 @@ on: pull_request: jobs: - build: + checkstyle: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up JDK 21 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '21' + java-version: '17' distribution: 'temurin' - cache: maven - - name: Compile with maven - run: mvn clean compile + - name: Cache Maven dependencies + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Checkstyle with maven + run: mvn checkstyle:check - checkstyle: + build: runs-on: ubuntu-latest + needs: checkstyle steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up JDK 21 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '21' + java-version: '17' distribution: 'temurin' - cache: maven - - name: Checkstyle with maven - run: mvn checkstyle:check + - name: Restore Maven cache + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Compile with maven + run: mvn clean compile test: runs-on: ubuntu-latest + needs: build steps: - - name: Checkout + - name: Checkout code uses: actions/checkout@v4 - - name: Set up JDK 21 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '21' + java-version: '17' distribution: 'temurin' - cache: maven - - name: Compile maven project - run: mvn clean compile - - name: Test maven project - run: mvn test \ No newline at end of file + - name: Restore Maven cache + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Run tests with maven + run: mvn test