Merge pull request #35 from petrmac/dependabot/gradle/io.micrometer-m… #113
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
name: Java CI with Gradle | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
GITHUB_ACTOR: ${{github.actor}} | |
GITHUB_TOKEN: ${{github.token}} | |
GITHUB_SHA: ${{github.sha}} | |
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}} | |
PERSONAL_GITHUB_TOKEN: ${{secrets.PERSONAL_GITHUB_TOKEN}} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: "Checkout code" | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' # will fetch the entire history | |
- name: "Set up JDK 21" | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: "Build with Gradle - cached" | |
uses: burrunan/gradle-cache-action@v2 | |
with: | |
concurrent: true | |
gradle-build-scan-report: false | |
build-root-directory: . | |
multi-cache-enabled: false | |
arguments: clean build jacocoTestReport --parallel | |
- name: "Create Github Release" | |
# Release job, only for pushes to the main development branch | |
if: github.event_name == 'push' | |
&& github.actor != 'dependabot[bot]' | |
&& github.ref == 'refs/heads/main' | |
&& github.repository == 'petrmac/crag-db' | |
&& !contains(toJSON(github.event.commits.*.message), '[skip release]') | |
id: create_release | |
run: | | |
./gradlew githubRelease | |
- name: "Download Code Climate Test Reporter" | |
if: github.actor != 'dependabot[bot]' # Exclude for Dependabot | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
# Report test coverage to Code Climate | |
- name: "Report coverage to Code Climate" | |
if: github.actor != 'dependabot[bot]' # Exclude for Dependabot | |
env: | |
# Set CC_TEST_REPORTER_ID as secret of your repo | |
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}} | |
JACOCO_SOURCE_PATH: "${{github.workspace}}/src/main/java" | |
run: | | |
./cc-test-reporter format-coverage build/reports/jacoco/test/jacocoTestReport.xml --input-type jacoco | |
./cc-test-reporter upload-coverage | |
dependency-submission: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. | |
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md | |
- name: Generate and submit dependency graph | |
uses: gradle/actions/dependency-submission@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2 |