Skip to content

Commit

Permalink
51 Try to improve github jobs (#52)
Browse files Browse the repository at this point in the history
* 51 Try to improve github jobs

* 51 Update flow

* 51 Update flow

* 51 Add flow as checkstyle -> build -> test

* 51 Try to caching maven dependencies
  • Loading branch information
asavershin authored Oct 2, 2024
1 parent 375ac97 commit 70a226f
Showing 1 changed file with 38 additions and 20 deletions.
58 changes: 38 additions & 20 deletions .github/workflows/JavaMavenCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
- 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

0 comments on commit 70a226f

Please sign in to comment.