Skip to content

Commit

Permalink
ci: Bump Mockito & test compile version (#512)
Browse files Browse the repository at this point in the history
* chore: Bump Mockito & test compile version

* Update build.yml Java version

* Bump codecov actions

* Add build-only job

* Test with Java 20

* Use mockito-core & Java 21

* Add Java 17 to build matrix
  • Loading branch information
SMadani authored Jan 29, 2024
1 parent bb39ee2 commit 730a1a4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 9 deletions.
42 changes: 35 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,21 @@ permissions:
contents: read
deployments: read
issues: write
discussions: write
discussions: read
packages: none
pages: write
pages: read
pull-requests: write
security-events: write
statuses: write

jobs:
build:
build_only:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
java: [8, 11, 20]
java: [8, 11, 17]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- name: Checkout the repo
uses: actions/checkout@v4
Expand All @@ -47,9 +46,38 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Build with Gradle
run: ./gradlew build -x test

test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
java: [21]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Build with Gradle
run: ./gradlew build

- name: Run Codecov
uses: codecov/codecov-action@v2

uses: codecov/codecov-action@v3
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ permissions:
statuses: write

jobs:
build:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
Expand Down
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ java {
targetCompatibility = sourceCompatibility
}

compileTestJava {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = sourceCompatibility
}

dependencies {
def jacksonVersion = '2.16.1'
def httpclientVersion = '4.5.14'
Expand All @@ -41,7 +46,7 @@ dependencies {

testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
testImplementation "org.mockito:mockito-inline:4.11.0"
testImplementation "org.mockito:mockito-core:5.10.0"
testImplementation "jakarta.servlet:jakarta.servlet-api:4.0.4"
}

Expand Down

0 comments on commit 730a1a4

Please sign in to comment.