Run builds/tests with Java 21 #249
This file contains hidden or 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 will build a Java project with Gradle | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | |
name: Test and Build | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden the runner (Audit all outbound calls) | |
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up JDK | |
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 | |
with: | |
java-version: 21 | |
distribution: temurin | |
- name: Test with Gradle | |
run: ./gradlew assemble check | |
- name: Generate and submit dependency graph | |
uses: gradle/actions/dependency-submission@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1 | |
if: github.ref == 'refs/heads/master' | |
env: | |
DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS: runtimeClasspath | |
previewGithubRelease: | |
needs: test | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_USER: "gocd" | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
steps: | |
- name: Harden the runner (Audit all outbound calls) | |
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK | |
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 | |
with: | |
java-version: 21 | |
distribution: temurin | |
- name: Test with Gradle | |
run: ./gradlew githubRelease |