Skip to content

Commit

Permalink
Merge pull request #11 from strangelookingnerd/prepare_next_version
Browse files Browse the repository at this point in the history
Prepare next version
  • Loading branch information
strangelookingnerd committed Jun 15, 2024
2 parents 533afd6 + fd42c7a commit 2a48675
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ jobs:
- name: Upload Code Coverage Report
uses: codecov/codecov-action@v4
with:
token: ${{secrets.CODECOV_TOKEN}}
files: ${{ github.workspace }}/build/reports/kover/report.xml

# Run Qodana inspections and provide report
Expand Down Expand Up @@ -174,6 +175,12 @@ jobs:
with:
cache-default-branch-only: true

# Upload results to CodeQL
- name: CodeQL - Upload SARIF
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json

# Run plugin structure verification along with IntelliJ Plugin Verifier
verify:
name: Verify plugin
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Pedro Progress Bar Changelog

## [Unreleased]
- Various dependency updates

## [0.0.2]
### Added
- Prepare next plugin version

Expand Down
16 changes: 10 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ fun environment(key: String) = providers.environmentVariable(key)

plugins {
id("java") // Java support
id("org.jetbrains.kotlin.jvm") version "2.0.0" // Kotlin support
id("org.jetbrains.intellij") version "1.17.4" // Gradle IntelliJ Plugin
id("org.jetbrains.changelog") version "2.2.0" // Gradle Changelog Plugin
id("org.jetbrains.qodana") version "2024.1.5" // Gradle Qodana Plugin
id("org.jetbrains.kotlinx.kover") version "0.8.1" // Gradle Kover Plugin
alias(libs.plugins.kotlin) // Kotlin support
alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin
alias(libs.plugins.changelog) // Gradle Changelog Plugin
alias(libs.plugins.qodana) // Gradle Qodana Plugin
alias(libs.plugins.kover) // Gradle Kover Plugin
}

group = properties("pluginGroup").get()
Expand All @@ -23,7 +23,7 @@ repositories {

// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
dependencies {
// none
testImplementation(libs.junit5)
}

// Set the JVM language level used to build the project.
Expand Down Expand Up @@ -108,6 +108,10 @@ tasks {
systemProperty("jb.consents.confirmation.enabled", "false")
}

test {
useJUnitPlatform()
}

signPlugin {
certificateChain = environment("CERTIFICATE_CHAIN")
privateKey = environment("PRIVATE_KEY")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pluginGroup = com.github.strangelookingnerd
pluginName = pedro-progress-bar
pluginRepositoryUrl = https://github.com/strangelookingnerd/pedro-progress-bar-plugin
# SemVer format -> https://semver.org
pluginVersion = 0.0.2
pluginVersion = 0.0.3

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 232
Expand Down
20 changes: 20 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[versions]
# libraries
junit5 = "5.10.2"

# plugins
kotlin = "2.0.0"
changelog = "2.2.0"
gradleIntelliJPlugin = "1.17.4"
qodana = "2024.1.5"
kover = "0.8.1"

[libraries]
junit5 = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit5" }

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
64 changes: 64 additions & 0 deletions src/test/java/com/github/strangelookingnerd/PedroIconsTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* The MIT License
*
* Copyright (c) 2024 strangelookingnerd
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

package com.github.strangelookingnerd;

import com.intellij.ui.scale.JBUIScale;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

import javax.swing.ImageIcon;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

class PedroIconsTest {

private static final Pattern DESCRIPTION_PATTERN = Pattern.compile("^Pedro (\\d\\d)x(\\d\\d)$");

@ParameterizedTest
@ValueSource(floats = {0.75F, 1F, 1.1F, 1.25F, 1.5F, 1.75F, 2F, 3F})
void testScaling(float scaleFactor) {
JBUIScale.setUserScaleFactorForTest(scaleFactor);

ImageIcon icon = PedroIcons.getScaledIcon();
assertNotNull(icon);

if (scaleFactor < 1F || scaleFactor > 2F) {
assertNull(icon.getImage());
assertNull(icon.getDescription());
} else {
assertNotNull(icon.getImage());

Matcher matcher = DESCRIPTION_PATTERN.matcher(icon.getDescription());
assertTrue(matcher.matches());
assertEquals(Integer.valueOf(matcher.group(1)), icon.getIconWidth());
assertEquals(Integer.valueOf(matcher.group(2)), icon.getIconHeight());
}
}
}

0 comments on commit 2a48675

Please sign in to comment.