Skip to content

Update java-ci.yml workflow file #267

Update java-ci.yml workflow file

Update java-ci.yml workflow file #267

Workflow file for this run

name: Java CI
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-24.04
permissions:
contents: write
pages: write
id-token: write
strategy:
matrix:
java: [ '8', '11', '17', '21', '25']
name: JDK ${{ matrix.Java }} build
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
steps:
- uses: actions/checkout@v5.0.0
- name: Set up Java
uses: actions/setup-java@v5.0.0
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v4.4.2
- name: Build with Gradle headless
uses: coactions/setup-xvfb@v1.0.1
with:
run: ./gradlew clean build jacocoTestReport
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
- name: Test & publish code coverage
uses: qltysh/qlty-action/coverage@v2
with:
oidc: true
files: ${{github.workspace}}/build/reports/jacoco/test/jacocoTestReport.xml
add-prefix: src/main/java/