Skip to content

Commit 883dd6f

Browse files
Merge pull request #156 from yusufugurozbek/next
v1.1.2
2 parents 5b32cd2 + 1978b7c commit 883dd6f

21 files changed

+954
-50
lines changed

.github/workflows/build.yml

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps:
2-
# - validate Gradle Wrapper,
3-
# - run 'test' and 'verifyPlugin' tasks,
4-
# - run Qodana inspections,
5-
# - run 'buildPlugin' task and prepare artifact for the further tests,
6-
# - run 'runPluginVerifier' task,
7-
# - create a draft release.
2+
# - Validate Gradle Wrapper.
3+
# - Run 'test' and 'verifyPlugin' tasks.
4+
# - Run Qodana inspections.
5+
# - Run the 'buildPlugin' task and prepare artifact for further tests.
6+
# - Run the 'runPluginVerifier' task.
7+
# - Create a draft release.
88
#
9-
# Workflow is triggered on push and pull_request events.
9+
# The workflow is triggered on push and pull_request events.
1010
#
1111
# GitHub Actions reference: https://help.github.com/en/actions
1212
#
1313
## JBIJPPTPL
1414

1515
name: Build
1616
on:
17-
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests)
17+
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests)
1818
push:
1919
branches: [ main ]
2020
# Trigger the workflow on any pull request
@@ -32,13 +32,6 @@ jobs:
3232
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
3333
steps:
3434

35-
# Free GitHub Actions Environment Disk Space
36-
- name: Maximize Build Space
37-
run: |
38-
sudo rm -rf /usr/share/dotnet
39-
sudo rm -rf /usr/local/lib/android
40-
sudo rm -rf /opt/ghc
41-
4235
# Check out current repository
4336
- name: Fetch Sources
4437
uses: actions/checkout@v3
@@ -47,7 +40,7 @@ jobs:
4740
- name: Gradle Wrapper Validation
4841
uses: gradle/wrapper-validation-action@v1.1.0
4942

50-
# Setup Java environment for the next steps
43+
# Set up Java environment for the next steps
5144
- name: Setup Java
5245
uses: actions/setup-java@v3
5346
with:
@@ -57,6 +50,8 @@ jobs:
5750
# Setup Gradle
5851
- name: Setup Gradle
5952
uses: gradle/gradle-build-action@v2
53+
with:
54+
gradle-home-cache-cleanup: true
6055

6156
# Set environment variables
6257
- name: Export Properties
@@ -109,7 +104,7 @@ jobs:
109104
- name: Fetch Sources
110105
uses: actions/checkout@v3
111106

112-
# Setup Java environment for the next steps
107+
# Set up Java environment for the next steps
113108
- name: Setup Java
114109
uses: actions/setup-java@v3
115110
with:
@@ -119,6 +114,8 @@ jobs:
119114
# Setup Gradle
120115
- name: Setup Gradle
121116
uses: gradle/gradle-build-action@v2
117+
with:
118+
gradle-home-cache-cleanup: true
122119

123120
# Run tests
124121
- name: Run Tests
@@ -132,11 +129,11 @@ jobs:
132129
name: tests-result
133130
path: ${{ github.workspace }}/build/reports/tests
134131

135-
# Upload Kover report to CodeCov
132+
# Upload the Kover report to CodeCov
136133
- name: Upload Code Coverage Report
137134
uses: codecov/codecov-action@v3
138135
with:
139-
files: ${{ github.workspace }}/build/reports/kover/xml/report.xml
136+
files: ${{ github.workspace }}/build/reports/kover/report.xml
140137

141138
# Run Qodana inspections and provide report
142139
inspectCode:
@@ -149,11 +146,18 @@ jobs:
149146
pull-requests: write
150147
steps:
151148

149+
# Free GitHub Actions Environment Disk Space
150+
- name: Maximize Build Space
151+
uses: jlumbroso/free-disk-space@main
152+
with:
153+
tool-cache: false
154+
large-packages: false
155+
152156
# Check out current repository
153157
- name: Fetch Sources
154158
uses: actions/checkout@v3
155159

156-
# Setup Java environment for the next steps
160+
# Set up Java environment for the next steps
157161
- name: Setup Java
158162
uses: actions/setup-java@v3
159163
with:
@@ -169,15 +173,22 @@ jobs:
169173
# Run plugin structure verification along with IntelliJ Plugin Verifier
170174
verify:
171175
name: Verify plugin
172-
needs: [ build, test, inspectCode ]
176+
needs: [ build ]
173177
runs-on: ubuntu-latest
174178
steps:
175179

180+
# Free GitHub Actions Environment Disk Space
181+
- name: Maximize Build Space
182+
uses: jlumbroso/free-disk-space@main
183+
with:
184+
tool-cache: false
185+
large-packages: false
186+
176187
# Check out current repository
177188
- name: Fetch Sources
178189
uses: actions/checkout@v3
179190

180-
# Setup Java environment for the next steps
191+
# Set up Java environment for the next steps
181192
- name: Setup Java
182193
uses: actions/setup-java@v3
183194
with:
@@ -187,6 +198,8 @@ jobs:
187198
# Setup Gradle
188199
- name: Setup Gradle
189200
uses: gradle/gradle-build-action@v2
201+
with:
202+
gradle-home-cache-cleanup: true
190203

191204
# Cache Plugin Verifier IDEs
192205
- name: Setup Plugin Verifier IDEs Cache
@@ -212,7 +225,7 @@ jobs:
212225
releaseDraft:
213226
name: Release draft
214227
if: github.event_name != 'pull_request'
215-
needs: [ build, verify ]
228+
needs: [ build, test, inspectCode, verify ]
216229
runs-on: ubuntu-latest
217230
permissions:
218231
contents: write
@@ -222,7 +235,7 @@ jobs:
222235
- name: Fetch Sources
223236
uses: actions/checkout@v3
224237

225-
# Setup Java environment for the next steps
238+
# Set up Java environment for the next steps
226239
- name: Setup Java
227240
uses: actions/setup-java@v3
228241
with:

.github/workflows/release.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111

12-
# Prepare and publish the plugin to the Marketplace repository
12+
# Prepare and publish the plugin to JetBrains Marketplace repository
1313
release:
1414
name: Publish Plugin
1515
runs-on: ubuntu-latest
@@ -24,7 +24,7 @@ jobs:
2424
with:
2525
ref: ${{ github.event.release.tag_name }}
2626

27-
# Setup Java environment for the next steps
27+
# Set up Java environment for the next steps
2828
- name: Setup Java
2929
uses: actions/setup-java@v3
3030
with:
@@ -34,6 +34,8 @@ jobs:
3434
# Setup Gradle
3535
- name: Setup Gradle
3636
uses: gradle/gradle-build-action@v2
37+
with:
38+
gradle-home-cache-cleanup: true
3739

3840
# Set environment variables
3941
- name: Export Properties
@@ -57,7 +59,7 @@ jobs:
5759
run: |
5860
./gradlew patchChangelog --release-note="$CHANGELOG"
5961
60-
# Publish the plugin to the Marketplace
62+
# Publish the plugin to JetBrains Marketplace
6163
- name: Publish Plugin
6264
env:
6365
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
@@ -72,7 +74,7 @@ jobs:
7274
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7375
run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
7476

75-
# Create pull request
77+
# Create a pull request
7678
- name: Create Pull Request
7779
if: ${{ steps.properties.outputs.changelog != '' }}
7880
env:
@@ -91,6 +93,7 @@ jobs:
9193
9294
gh label create "$LABEL" \
9395
--description "Pull requests with release changelog update" \
96+
--force \
9497
|| true
9598
9699
gh pr create \

.github/workflows/run-ui-tests.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# GitHub Actions Workflow for launching UI tests on Linux, Windows, and Mac in the following steps:
2-
# - prepare and launch IDE with your plugin and robot-server plugin, which is needed to interact with UI
3-
# - wait for IDE to start
4-
# - run UI tests with separate Gradle task
2+
# - Prepare and launch IDE with your plugin and robot-server plugin, which is needed to interact with the UI.
3+
# - Wait for IDE to start.
4+
# - Run UI tests with a separate Gradle task.
55
#
6-
# Please check https://github.com/JetBrains/intellij-ui-test-robot for information about UI tests with IntelliJ Platform
6+
# Please check https://github.com/JetBrains/intellij-ui-test-robot for information about UI tests with IntelliJ Platform.
77
#
88
# Workflow is triggered manually.
99

@@ -35,7 +35,7 @@ jobs:
3535
- name: Fetch Sources
3636
uses: actions/checkout@v3
3737

38-
# Setup Java environment for the next steps
38+
# Set up Java environment for the next steps
3939
- name: Setup Java
4040
uses: actions/setup-java@v3
4141
with:
@@ -45,6 +45,8 @@ jobs:
4545
# Setup Gradle
4646
- name: Setup Gradle
4747
uses: gradle/gradle-build-action@v2
48+
with:
49+
gradle-home-cache-cleanup: true
4850

4951
# Run IDEA prepared for UI testing
5052
- name: Run IDE

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Testcontainers Port Updater Changelog
22

33
## [Unreleased]
4+
- Introduce JSON logging format / Now you can change the logging format via settings
45
- Support latest IntelliJ 2023.2
56
- Bump dependencies to their latest versions
6-
- Bump Gradle version to 8.2.1
7-
- Migrate latest changes of intellij-platform-plugin-template v1.9.0
7+
- Bump Gradle version to 8.3
8+
- Migrate latest changes of intellij-platform-plugin-template v1.11.1
89

910
## [1.1.1] - 2023-04-06
1011
- Bump dependencies to their latest versions

detekt-config.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ pluginUntilBuild = 232.*
1111

1212
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
1313
platformType = IU
14-
platformVersion = 2022.2
14+
platformVersion = 2022.3.3
1515

1616
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
1717
platformPlugins = com.intellij.database
1818

1919
# Gradle Releases -> https://github.com/gradle/gradle/releases
20-
gradleVersion = 8.2.1
20+
gradleVersion = 8.3
2121
org.gradle.jvmargs=-Xmx1g
2222

2323
# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ done
8383
# This is normally unused
8484
# shellcheck disable=SC2034
8585
APP_BASE_NAME=${0##*/}
86-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
86+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
8788

8889
# Use the maximum available, or set MAX_FD != -1 to use that value.
8990
MAX_FD=maximum

src/main/kotlin/com/github/yusufugurozbek/testcontainers/port/updater/impl/DataSourceUpdaterImpl.kt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,26 @@ import com.github.yusufugurozbek.testcontainers.port.updater.DataSourceUrlExtrac
55
import com.github.yusufugurozbek.testcontainers.port.updater.api.DataSourceUpdater
66
import com.github.yusufugurozbek.testcontainers.port.updater.common.TpuNotifier
77
import com.github.yusufugurozbek.testcontainers.port.updater.equalsIgnoringPort
8+
import com.github.yusufugurozbek.testcontainers.port.updater.settings.LoggingFormat
89
import com.github.yusufugurozbek.testcontainers.port.updater.settings.MatchMode
910
import com.github.yusufugurozbek.testcontainers.port.updater.settings.TpuSettingsState
1011
import com.intellij.database.dataSource.LocalDataSource
1112
import com.intellij.openapi.components.service
13+
import com.intellij.openapi.diagnostic.thisLogger
1214
import com.intellij.openapi.project.Project
15+
import kotlinx.serialization.json.Json
16+
import kotlinx.serialization.json.jsonObject
17+
import kotlinx.serialization.json.jsonPrimitive
1318

1419
class DataSourceUpdaterImpl(private var project: Project) : DataSourceUpdater {
1520

1621
private var urlExtractor: DataSourceUrlExtractor = DataSourceUrlExtractor()
1722
private var settingsState: TpuSettingsState = project.service()
1823

1924
override fun update(localDataSources: List<LocalDataSource>, logEntryText: String) {
20-
val splitLogEntry = logEntryText.split(settingsState.logEntryPrefix)
25+
val logEntry = getLogMessage(logEntryText)
26+
27+
val splitLogEntry = logEntry.split(settingsState.logEntryPrefix)
2128
if (splitLogEntry.size == 2) {
2229
urlExtractor.extract(splitLogEntry[1])?.let { logEntryDataSourceUrl ->
2330
localDataSources
@@ -27,6 +34,17 @@ class DataSourceUpdaterImpl(private var project: Project) : DataSourceUpdater {
2734
}
2835
}
2936

37+
private fun getLogMessage(logEntryText: String): String {
38+
if (settingsState.loggingFormat == LoggingFormat.JSON && logEntryText.contains(settingsState.logEntryPrefix)) {
39+
try {
40+
return Json.parseToJsonElement(logEntryText).jsonObject["message"]!!.jsonPrimitive.content
41+
} catch (e: Exception) {
42+
thisLogger().warn("JSON log message cannot be extracted", e)
43+
}
44+
}
45+
return logEntryText
46+
}
47+
3048
private fun update(localDataSource: LocalDataSource, logEntryDataSourceUrl: DataSourceUrl) {
3149
val localDataSourceUrl = urlExtractor.toDataSourceUrl(localDataSource) ?: return
3250

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.github.yusufugurozbek.testcontainers.port.updater.settings
2+
3+
enum class LoggingFormat {
4+
JSON,
5+
SIMPLE_TEXT
6+
}

0 commit comments

Comments
 (0)