Browse Source
This commit harmonizes our CI configuration with Spring Boot, in particular the clever use of reusable custom actions that simplify the workflow definition quite a bit. One main difference compared to Spring Boot is that we can now specify a different distribution for a Java version to test, in preparation for the support of building against 23-ea See gh-32090pull/33350/head
6 changed files with 136 additions and 73 deletions
@ -0,0 +1,56 @@ |
|||||||
|
name: 'Build' |
||||||
|
description: 'Builds the project, optionally publishing it to a local deployment repository' |
||||||
|
inputs: |
||||||
|
java-version: |
||||||
|
required: false |
||||||
|
default: '17' |
||||||
|
description: 'The Java version to compile and test with' |
||||||
|
java-distribution: |
||||||
|
required: false |
||||||
|
default: 'liberica' |
||||||
|
description: 'The Java distribution to use for the build' |
||||||
|
java-toolchain: |
||||||
|
required: false |
||||||
|
default: 'false' |
||||||
|
description: 'Whether a Java toolchain should be used' |
||||||
|
publish: |
||||||
|
required: false |
||||||
|
default: 'false' |
||||||
|
description: 'Whether to publish artifacts ready for deployment to Artifactory' |
||||||
|
develocity-access-key: |
||||||
|
required: false |
||||||
|
description: 'The access key for authentication with ge.spring.io' |
||||||
|
outputs: |
||||||
|
build-scan-url: |
||||||
|
description: 'The URL, if any, of the build scan produced by the build' |
||||||
|
value: ${{ (inputs.publish == 'true' && steps.publish.outputs.build-scan-url) || steps.build.outputs.build-scan-url }} |
||||||
|
version: |
||||||
|
description: 'The version that was built' |
||||||
|
value: ${{ steps.read-version.outputs.version }} |
||||||
|
runs: |
||||||
|
using: composite |
||||||
|
steps: |
||||||
|
- name: Prepare Gradle Build |
||||||
|
uses: ./.github/actions/prepare-gradle-build |
||||||
|
with: |
||||||
|
develocity-access-key: ${{ inputs.develocity-access-key }} |
||||||
|
java-version: ${{ inputs.java-version }} |
||||||
|
java-distribution: ${{ inputs.java-distribution }} |
||||||
|
java-toolchain: ${{ inputs.java-toolchain }} |
||||||
|
- name: Build |
||||||
|
id: build |
||||||
|
if: ${{ inputs.publish == 'false' }} |
||||||
|
shell: bash |
||||||
|
run: ./gradlew check antora |
||||||
|
- name: Publish |
||||||
|
id: publish |
||||||
|
if: ${{ inputs.publish == 'true' }} |
||||||
|
shell: bash |
||||||
|
run: ./gradlew -PdeploymentRepository=$(pwd)/deployment-repository build publishAllPublicationsToDeploymentRepository |
||||||
|
- name: Read Version From gradle.properties |
||||||
|
id: read-version |
||||||
|
shell: bash |
||||||
|
run: | |
||||||
|
version=$(sed -n 's/version=\(.*\)/\1/p' gradle.properties) |
||||||
|
echo "Version is $version" |
||||||
|
echo "version=$version" >> $GITHUB_OUTPUT |
||||||
@ -0,0 +1,49 @@ |
|||||||
|
name: 'Prepare Gradle Build' |
||||||
|
description: 'Prepares a Gradle build. Sets up Java and Gradle and configures Gradle properties' |
||||||
|
inputs: |
||||||
|
java-version: |
||||||
|
required: false |
||||||
|
default: '17' |
||||||
|
description: 'The Java version to use for the build' |
||||||
|
java-distribution: |
||||||
|
required: false |
||||||
|
default: 'liberica' |
||||||
|
description: 'The Java distribution to use for the build' |
||||||
|
java-toolchain: |
||||||
|
required: false |
||||||
|
default: 'false' |
||||||
|
description: 'Whether a Java toolchain should be used' |
||||||
|
develocity-access-key: |
||||||
|
required: false |
||||||
|
description: 'The access key for authentication with ge.spring.io' |
||||||
|
runs: |
||||||
|
using: composite |
||||||
|
steps: |
||||||
|
- name: Set Up Java |
||||||
|
uses: actions/setup-java@v4 |
||||||
|
with: |
||||||
|
distribution: ${{ inputs.java-distribution }} |
||||||
|
java-version: | |
||||||
|
${{ inputs.java-version }} |
||||||
|
${{ inputs.java-toolchain == 'true' && '17' || '' }} |
||||||
|
- name: Set Up Gradle |
||||||
|
uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 |
||||||
|
with: |
||||||
|
cache-read-only: false |
||||||
|
develocity-access-key: ${{ inputs.develocity-access-key }} |
||||||
|
- name: Configure Gradle Properties |
||||||
|
shell: bash |
||||||
|
run: | |
||||||
|
mkdir -p $HOME/.gradle |
||||||
|
echo 'systemProp.user.name=spring-builds+github' >> $HOME/.gradle/gradle.properties |
||||||
|
echo 'systemProp.org.gradle.internal.launcher.welcomeMessageEnabled=false' >> $HOME/.gradle/gradle.properties |
||||||
|
echo 'org.gradle.daemon=false' >> $HOME/.gradle/gradle.properties |
||||||
|
echo 'org.gradle.daemon=4' >> $HOME/.gradle/gradle.properties |
||||||
|
- name: Configure Toolchain Properties |
||||||
|
if: ${{ inputs.java-toolchain == 'true' }} |
||||||
|
shell: bash |
||||||
|
run: | |
||||||
|
echo toolchainVersion=${{ inputs.java-version }} >> $HOME/.gradle/gradle.properties |
||||||
|
echo systemProp.org.gradle.java.installations.auto-detect=false >> $HOME/.gradle/gradle.properties |
||||||
|
echo systemProp.org.gradle.java.installations.auto-download=false >> $HOME/.gradle/gradle.properties |
||||||
|
echo systemProp.org.gradle.java.installations.paths=${{ format('$JAVA_HOME_{0}_X64', inputs.java-version) }} >> $HOME/.gradle/gradle.properties |
||||||
@ -1,13 +1,11 @@ |
|||||||
name: "Validate Gradle Wrapper" |
name: "Validate Gradle Wrapper" |
||||||
on: [push, pull_request] |
on: [push, pull_request] |
||||||
|
|
||||||
permissions: |
permissions: |
||||||
contents: read |
contents: read |
||||||
|
|
||||||
jobs: |
jobs: |
||||||
validation: |
validation: |
||||||
name: "Validation" |
name: "Validate Gradle Wrapper" |
||||||
runs-on: ubuntu-latest |
runs-on: ubuntu-latest |
||||||
steps: |
steps: |
||||||
- uses: actions/checkout@v4 |
- uses: actions/checkout@v4 |
||||||
- uses: gradle/wrapper-validation-action@v2 |
- uses: gradle/actions/wrapper-validation@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 |
||||||
Loading…
Reference in new issue