Skip to content

Commit

Permalink
feat!: update gradle to 8.5 (#92129)
Browse files Browse the repository at this point in the history
* update gradle to 8.5
* using JavaToolChain with Java 17
* replaced calls to deprecated code where possible
* removed scmversion-plugin
* removed detekt-plugin
* now using .github actions
* updated documentation
* added docker preparation to workflows
* declared missing inputs in actions/prepare-docker/action.yaml
  • Loading branch information
skiesewetter-intershop authored Jan 10, 2024
1 parent 684dbfd commit 0113864
Show file tree
Hide file tree
Showing 14 changed files with 238 additions and 378 deletions.
19 changes: 19 additions & 0 deletions .github/actions/prepare-docker/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Preparations for later docker usage
description: prepares the access to docker.io and builds an image using createimage.sh
inputs:
docker-user:
required: true
description: The user to be used for the docker login
docker-password:
required: true
description: The password to be used for the docker login

runs:
using: composite
steps:
- name: Run docker login
shell: bash
run: echo ${{ inputs.docker-password }} | docker login -u ${{ inputs.docker-user }} --password-stdin
- name: Create Test container
shell: bash
run: cd testdocker && ./createimage.sh && cd ..
62 changes: 14 additions & 48 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,30 @@
# 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: Run build and tests

on:
push:
branches:
- '*'
- '**'
pull_request:
branches: [ master ]

jobs:
build:
permissions:
checks: write
pull-requests: write
contents: read
environment: CIRelease
runs-on: ubuntu-latest

steps:
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: git fetch --all --tags
- name: Run docker login
run: echo ${{ secrets.DOCKERPASSWD }} | docker login -u ${{ secrets.DOCKERUSER }} --password-stdin
- name: Create Test container
run: cd testdocker && ./createimage.sh && cd ..
- name: Create .gradle dir
run: mkdir -p $HOME/.gradle
- name: Install gpg secret key
env:
SIGNINGFILE: ${{ secrets.SIGNINGFILE }}
run: |
cat <(echo -e "${{ secrets.SIGNINGFILE }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- name: Export gpg file
env:
SIGNINGKEYID: ${{ secrets.SIGNINGKEYID }}
SIGNINGPASSWORD: ${{ secrets.SIGNINGPASSWORD }}
run: |
gpg --batch --passphrase="$SIGNINGPASSWORD" --pinentry-mode loopback --export-secret-keys $SIGNINGKEYID > $HOME/.gradle/secrets.gpg
- name: Create gradle sproperties
env:
APIKEY: ${{ secrets.APIKEY }}
APISECRET: ${{ secrets.APISECRET }}
SIGNINGKEYID: ${{ secrets.SIGNINGKEYID }}
SIGNINGPASSWORD: ${{ secrets.SIGNINGPASSWORD }}
SONATYPEPASSWORD: ${{ secrets.SONATYPEPASSWORD }}
SONATYPEUSER: ${{ secrets.SONATYPEUSER }}
run: echo -e "gradle.publish.key=$APIKEY\ngradle.publish.secret=$APISECRET\nsigning.keyId=$SIGNINGKEYID\nsigning.password=$SIGNINGPASSWORD\nsigning.secretKeyRingFile=$HOME/.gradle/secrets.gpg\nsonatypeUsername=$SONATYPEUSER\nsonatypePassword=$SONATYPEPASSWORD" > $HOME/.gradle/gradle.properties
- name: Build and test with Gradle
env:
GRADLE_OPTS: "-Dorg.gradle.daemon=true"
run: ./gradlew test build :publishIntershopMvnPublicationToMavenRepository -s --scan
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: always()
- name: Setup
uses: IntershopCommunicationsAG/.github/actions/[email protected]
- name: Prepare Docker
uses: ./.github/actions/prepare-docker
with:
files: build/test-results/**/*.xml
- name: Post Build
run: rm -f $HOME/.gradle/gradle.properties && rm -f $HOME/.docker/config.json
docker-user: ${{ secrets.DOCKERUSER }}
docker-password: ${{ secrets.DOCKERPASSWD }}
- name: Build
uses: IntershopCommunicationsAG/.github/actions/[email protected]
67 changes: 22 additions & 45 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,36 @@
# 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: Run release build from tag

on:
push:
tags:
- '*'
- '**'

jobs:
release:
build:
permissions:
checks: write
pull-requests: write
contents: read
environment: CIRelease
runs-on: ubuntu-latest

steps:
- name: Set up JDK 11
uses: actions/setup-java@v3
- name: Setup
uses: IntershopCommunicationsAG/.github/actions/[email protected]
- name: Prepare Docker
uses: ./.github/actions/prepare-docker
with:
java-version: 11
distribution: temurin
- uses: actions/checkout@v2
docker-user: ${{ secrets.DOCKERUSER }}
docker-password: ${{ secrets.DOCKERPASSWD }}
- name: Release
uses: IntershopCommunicationsAG/.github/actions/[email protected]
with:
fetch-depth: 0
- run: git fetch --all --tag
- name: Create .gradle dir
run: mkdir -p $HOME/.gradle
- id: install-secret-key
name: Install gpg secret key
env:
SIGNINGFILE: ${{ secrets.SIGNINGFILE }}
run: |
cat <(echo -e "${{ secrets.SIGNINGFILE }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- id: export-gpg-file
name: Export gpg file
env:
SIGNINGKEYID: ${{ secrets.SIGNINGKEYID }}
SIGNINGPASSWORD: ${{ secrets.SIGNINGPASSWORD }}
run: |
gpg --batch --passphrase="$SIGNINGPASSWORD" --pinentry-mode loopback --export-secret-keys $SIGNINGKEYID > $HOME/.gradle/secrets.gpg
- name: Create gradle sproperties
env:
APIKEY: ${{ secrets.APIKEY }}
APISECRET: ${{ secrets.APISECRET }}
SIGNINGKEYID: ${{ secrets.SIGNINGKEYID }}
SIGNINGPASSWORD: ${{ secrets.SIGNINGPASSWORD }}
SONATYPEPASSWORD: ${{ secrets.SONATYPEPASSWORD }}
SONATYPEUSER: ${{ secrets.SONATYPEUSER }}
run: echo -e "gradle.publish.key=$APIKEY\ngradle.publish.secret=$APISECRET\nsigning.keyId=$SIGNINGKEYID\nsigning.password=$SIGNINGPASSWORD\nsigning.secretKeyRingFile=$HOME/.gradle/secrets.gpg\nsonatypeUsername=$SONATYPEUSER\nsonatypePassword=$SONATYPEPASSWORD" > $HOME/.gradle/gradle.properties
- name: Run docker login
run: echo ${{ secrets.DOCKERPASSWD }} | docker login -u ${{ secrets.DOCKERUSER }} --password-stdin
- name: Create Test container
run: cd testdocker && ./createimage.sh && cd ..
- name: Run gradle release
env:
GRADLE_OPTS: "-Dorg.gradle.daemon=true"
run: ./gradlew -PrunOnCI=true test build :publishIntershopMvnPublicationToMavenRepository :publishPlugins -s --scan
- name: Post Build
run: rm -f $HOME/.gradle/gradle.properties && rm -f $HOME/.docker/config.json
signing-file: ${{ secrets.SIGNINGFILE }}
signing-key-id: ${{ secrets.SIGNINGKEYID }}
signing-password: ${{ secrets.SIGNINGPASSWORD }}
api-key: ${{ secrets.APIKEY }}
api-secret: ${{ secrets.APISECRET }}
sonatype-user: ${{ secrets.SONATYPEUSER }}
sonatype-password: ${{ secrets.SONATYPEPASSWORD }}
6 changes: 6 additions & 0 deletions README-signing.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ gpg --quick-generate-key --batch --pinentry-mode loopback --passphrase=<passphra

which results in an output like
[source,bash]
// used example key is not a real example (just a random hex value)
----
gpg: key CBC0FD16BA0996A4 marked as ultimately trusted
gpg: revocation certificate stored as '/c/Users/myuser/.gnupg/openpgp-revocs.d/B4F305E66AF51773BD04140AABC700315B07837C.rev'
----

Remember the last 8 digits of the key id for example
[source,bash]
----
KEY_ID=5B07837C
----

Export the key into a file
[source,bash]
Expand Down
16 changes: 11 additions & 5 deletions README.asciidoc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
= Intershop Commerce Management - Docker Plugins
:latestRevision: 1.2.5
:latestRevision: 4.0.0
:toc:
:icons: font

== Summary
This plugin collection contains plugins for building container images and
starting container of and for Intershop Commerce Management. It is necessary
that the link:https://github.com/IntershopCommunicationsAG/icm-gradle-plugin['ICM Gradle plugin'] was
applied to the project. Version 3.4.0 of this plugin is the minimum version.
applied to the project. Version 6.0.0 of this plugin is the minimum version.

This plugin is based on link:https://github.com/bmuschko/gradle-docker-plugin['Gradle Docker plugin'] and
the link:https://github.com/docker-java/docker-java['Docker-Java Framework'].
Expand All @@ -24,6 +24,7 @@ The plugins must be applied to the root project.
++++
.build.gradle
[source,groovy]
[subs=+attributes]
----
plugins {
id 'com.intershop.gradle.icm.base' version '3.4.14'
Expand Down Expand Up @@ -82,6 +83,7 @@ intershop_docker {
++++
.build.gradle.kts
[source,kotlin]
[subs=+attributes]
----
plugins {
id("com.intershop.gradle.icm.base") version "3.4.14"
Expand Down Expand Up @@ -216,7 +218,7 @@ imageBuild {
|`redis` | `Property<String>` | `redis:latest` | This image is used for a local redis instance, which can be used as a pagecache when the WebAdapter is disabled.
|===

===== Image Build Configuration `ProjectConfiguration`[[ProjectConfiguration]]
[[ProjectConfiguration]]===== Image Build Configuration `ProjectConfiguration`

*Properties*

Expand Down Expand Up @@ -669,9 +671,10 @@ Furthermore it depends on the configuration of Geb self (`GebConfig.groovy`).
++++
.build.gradle
[source,groovy]
[subs=+attributes]
----
plugins {
id 'com.intershop.gradle.icm.docker.gebtest' version '3.4.0'
id 'com.intershop.gradle.icm.docker.gebtest' version '{latestRevision}'
}
gebConfiguration {
Expand Down Expand Up @@ -727,9 +730,10 @@ gebConfiguration {
++++
.build.gradle.kts
[source,kotlin]
[subs=+attributes]
----
plugins {
id("com.intershop.gradle.icm.docker.gebtest") version "3.4.0"
id("com.intershop.gradle.icm.docker.gebtest") version "{latestRevision}"
}
extensions.getByType(GebConfiguration::class.java).apply {
Expand Down Expand Up @@ -788,6 +792,7 @@ The plugin is based on the following GebTest configuration:

.resources/GebConfig.groovy
[source,groovy]
[subs=+attributes]
----
import org.junit.runner.Description
import org.junit.runners.model.Statement
Expand Down Expand Up @@ -1044,6 +1049,7 @@ This is a minimum set of properties.

icm.properties
[source, properties]
[subs=+attributes]
----
# database connection configuration
intershop.databaseType = oracle|mssql
Expand Down
Loading

0 comments on commit 0113864

Please sign in to comment.