Skip to content

Use setup-gradle only to setup gradle and run to run the build #1807

Use setup-gradle only to setup gradle and run to run the build

Use setup-gradle only to setup gradle and run to run the build #1807

Workflow file for this run

name: Check
on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
jobs:
build:
strategy:
matrix:
jdk: [21]
runs-on: ubuntu-latest
env:
JDK_VERSION: ${{ matrix.jdk }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Gradle wrapper validation
uses: gradle/actions/wrapper-validation@v3
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.jdk }}
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache global .gradle folder
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: global-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.kt*') }}-${{ hashFiles('**/*.java') }}
restore-keys: |
gradle-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Download postgres
run: docker pull postgres:15.4
- name: Setup gradle
uses: gradle/actions/setup-gradle@v3
- name: Run build
run: ./gradlew check detekt mergeDetektSarif :gradle-plugins:buildPlugins --continue
- name: Upload sarif file to GitHub
uses: github/codeql-action/upload-sarif@v3
if: success() || failure()
with:
sarif_file: build/detekt-merged.sarif
category: detekt
- name: Upload failure artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: reports
path: '**/build/reports'