diff --git a/.github/renovate.json b/.github/renovate.json index c5ed5b3..8be4bb2 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -1,10 +1,11 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": ["github>cake-contrib/renovate-presets"], + "ignoreDeps": ["cake.tool"], "packageRules": [ { "description": "Do not update cake references inside the actual Cake.IntelliJ.Recipe", - "matchFileNames": ["**/Cake.IntelliJ.Recipe/Content/**/*"], + "matchFileNames": ["src/Cake.IntelliJ.Recipe/Content/**"], "matchManagers": ["cake"], "enabled": false } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eb38792..3feb069 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,11 +43,11 @@ jobs: steps: - name: Checkout the repository - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 - name: Fetch all tags and branches run: git fetch --prune --unshallow - name: Install .net - uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 + uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0 with: # gitReleaseManager needs 3.1, gitVersion needs 5.0 dotnet-version: | @@ -55,19 +55,19 @@ jobs: 5.0.x 7.0.x - name: Cache Tools - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 with: path: tools key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }} - name: Build project - uses: cake-build/cake-action@a6eb054329257c9e70a6c6bf01747ad6e1d9d52b # v1.4.1 + uses: cake-build/cake-action@1223b6fa067ad192159f43b50cd4f953679b0934 # v2.0.0 with: script-path: recipe.cake target: CI cake-version: tool-manifest # currently, Cake.Recipe does not upload artifacts when run on gh-actions - name: Upload Issues - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4 with: if-no-files-found: warn name: ${{ matrix.os }} Issues @@ -75,7 +75,7 @@ jobs: BuildArtifacts/report.html BuildArtifacts/**/coverlet/*.xml - name: Upload Packages - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4 if: runner.os == 'Linux' with: if-no-files-found: warn diff --git a/.github/workflows/dependabot-cake.yml b/.github/workflows/dependabot-cake.yml deleted file mode 100644 index f28fc1d..0000000 --- a/.github/workflows/dependabot-cake.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Run dependabot for cake -on: - workflow_dispatch: - schedule: - # run everyday at 6 - - cron: '0 6 * * *' - -jobs: - dependabot-cake: - runs-on: ubuntu-latest # linux, because this is a docker-action - steps: - - name: check/update cake dependencies - uses: nils-org/dependabot-cake-action@f2b01cbc4aa6ee4ae4229435c5d146eacdfadf40 # v1.1.0 \ No newline at end of file diff --git a/.github/workflows/publishDocs.yml b/.github/workflows/publishDocs.yml index 8d8f729..2e52341 100644 --- a/.github/workflows/publishDocs.yml +++ b/.github/workflows/publishDocs.yml @@ -15,19 +15,19 @@ jobs: steps: - name: checkout - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 with: fetch-depth: 0 # GitVersion is somewhat irritated when fetch-depth is "1".... ref: ${{ github.event.ref }} - name: Cache Tools - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 with: path: tools key: ${{ runner.os }}-doc-tools-${{ hashFiles('recipe.cake') }} - name: Publishing documentaiton - uses: cake-build/cake-action@a6eb054329257c9e70a6c6bf01747ad6e1d9d52b # v1.4.1 + uses: cake-build/cake-action@1223b6fa067ad192159f43b50cd4f953679b0934 # v2.0.0 with: script-path: recipe.cake target: Force-Publish-Documentation diff --git a/README.md b/README.md index 1c22d42..79829bb 100644 --- a/README.md +++ b/README.md @@ -9,25 +9,35 @@ Convention based Cake scripts for building IntelliJ plugins. ## Table of Contents -- [Install](#install) -- [Usage](#usage) -- [Discussion](#discussion) -- [Settings](#settings) - - [Publishing](#publishing) - - [Marketplace-ID](#marketplace-id) - - [Grade-Verbosity](#grade-verbosity) - - [Channels](#channels) -- [Changes to the template](#changes-to-the-template) - - [Readme](#user-content-readme) - - [Changelog](#user-content-changelog) - - [Releases and PreReleases](#releases-and-prereleases) -- [CI Systems](#ci-systems) - - [GitHub Actions](#github-actions) - - [AppVeyor](#appveyor) -- [Maintainer](#maintainer) -- [Contributing](#contributing) - - [Contributors](#contributors) -- [License](#license) +- [Cake.IntelliJ.Recipe](#cakeintellijrecipe) + - [Table of Contents](#table-of-contents) + - [Install](#install) + - [Usage](#usage) + - [Discussion](#discussion) + - [Settings](#settings) + - [Analyze](#analyze) + - [Channels](#channels) + - [Grade-Verbosity](#grade-verbosity) + - [Marketplace-ID](#marketplace-id) + - [PluginVerifier](#pluginverifier) + - [Publishing](#publishing) + - [Changes to the template](#changes-to-the-template) + - [Readme](#readme) + - [Changelog](#changelog) + - [Releases and PreReleases](#releases-and-prereleases) + - [CI Systems](#ci-systems) + - [GitHub Actions](#github-actions) + - [operating systems](#operating-systems) + - [java version](#java-version) + - [gradle](#gradle) + - [AppVeyor](#appveyor) + - [operating systems](#operating-systems-1) + - [java version](#java-version-1) + - [gradle](#gradle-1) + - [Maintainer](#maintainer) + - [Contributing](#contributing) + - [Contributors](#contributors) + - [License](#license) ## Install @@ -69,14 +79,22 @@ If you have questions, search for an existing one, or create a new discussion on ## Settings -### Publishing +### Analyze -To publish the plugin to the [JetBrains Marketplace](https://plugins.jetbrains.com/) a [token](https://plugins.jetbrains.com/author/me/tokens) is required. -The token must be supplied in an environment variable and then picked up in the `gradle` build. -Default for plugins created from https://github.com/JetBrains/intellij-platform-plugin-template is to use the `PUBLISH_TOKEN` variable name. +The Cake target `IntelliJAnalyze` is run on every build and is used to run code analysis. -Also, as with the "normal" gradle-based publishing, the first publish of the plugin must be made manually. +The default in this target is to run the following gradle tasks: +`detekt`, `ktlintCheck`, and `verifyPlugin`. +If for some reason this should be changed (e.g. for plugins that do not use detekt and ktlint but rather depend on something different), +the tasks to invoke can be configured using the `intelliJAnalyzerTasks` setting. + +```csharp +IntelliJBuildParameters.SetParameters( + // ... all other parameters ... + intelliJAnalyzerTasks: new[]{ "check", "verifyPlugin" } +); +``` ### Channels Settings with regard to publishing channels are: @@ -89,6 +107,13 @@ Settings with regard to publishing channels are: See [Releases and PreReleases](#releases-and-prereleases) for their meaning. +### Grade-Verbosity + +The verbosity of running gradle has it's own setting: `gradleVerbosity`. (Default is set to `GradleLogLevel.Default`) + +Keep in mind, that while setting Cake verbosity to `diagnostic`, secrets will still be secret. +However, setting gradle verbosity to `GradleLogLevel.Debug` will print out all secrets in the logs. + ### Marketplace-ID When publishing is automated, Twitter and Gitter messages can be created. To have them link to the plugin-page in the marketplace, @@ -96,12 +121,30 @@ a setting of `marketplaceId` is needed. The `marketplaceId` can be fetched from All other settings for Twitter, Gitter and such follow [Cake.Recipe](https://cake-contrib.github.io/Cake.Recipe/docs/fundamentals/environment-variables#twitter). -### Grade-Verbosity +### PluginVerifier -The verbosity of running gradle has it's own setting: `gradleVerbosity`. (Default is set to `GradleLogLevel.Default`) +The gradle task `runPluginVerifier` runs the [JetBrains plugin verifier](https://github.com/JetBrains/intellij-plugin-verifier). +This task is "mapped" to the Cake target `Run-Plugin-Verifier` which runs on `CI` builds. +If running on CI builds is not desired for any reason, the setting `shouldRunPluginVerifier` can be used to disable the run. -Keep in mind, that while setting Cake verbosity to `diagnostic`, secrets will still be secret. -However, setting gradle verbosity to `GradleLogLevel.Debug` will print out all secrets in the logs. + +Example: Do not run the plugin verifier, if the build runs on Linux (e.g. beacuse the GitHub actions Linux runner does not have enough +free space for the plugin verifier.) + +```csharp +IntelliJBuildParameters.SetParameters( + // ... all other parameters ... + shouldRunPluginVerifier: !IsRunningOnLinux() +); +``` + +### Publishing + +To publish the plugin to the [JetBrains Marketplace](https://plugins.jetbrains.com/) a [token](https://plugins.jetbrains.com/author/me/tokens) is required. +The token must be supplied in an environment variable and is then picked up in the `gradle` build. +Default for plugins created from https://github.com/JetBrains/intellij-platform-plugin-template is to use the `PUBLISH_TOKEN` variable name. + +Also, as with the "normal" gradle-based publishing, the first publish of the plugin must be made manually. ## Changes to the template diff --git a/recipe.cake b/recipe.cake index ab9b71f..bad6e09 100644 --- a/recipe.cake +++ b/recipe.cake @@ -24,6 +24,9 @@ BuildParameters.SetParameters( BuildParameters.PrintParameters(Context); +ToolSettings.SetToolPreprocessorDirectives( + gitReleaseManagerGlobalTool: "#tool dotnet:?package=GitReleaseManager.Tool&version=0.17.0"); + ToolSettings.SetToolSettings(context: Context); BuildParameters.Tasks.CleanTask diff --git a/src/Cake.IntelliJ.Recipe/Cake.IntelliJ.Recipe.csproj b/src/Cake.IntelliJ.Recipe/Cake.IntelliJ.Recipe.csproj index 1ddc074..b743a99 100644 --- a/src/Cake.IntelliJ.Recipe/Cake.IntelliJ.Recipe.csproj +++ b/src/Cake.IntelliJ.Recipe/Cake.IntelliJ.Recipe.csproj @@ -25,7 +25,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Cake.IntelliJ.Recipe/Content/analyzing.cake b/src/Cake.IntelliJ.Recipe/Content/analyzing.cake index 651bd3e..7b83f2d 100644 --- a/src/Cake.IntelliJ.Recipe/Content/analyzing.cake +++ b/src/Cake.IntelliJ.Recipe/Content/analyzing.cake @@ -12,15 +12,14 @@ BuildParameters.Tasks.AnalyzeTask = Task("IntelliJAnalyze") .FromPath(BuildParameters.SourceDirectoryPath) .WithLogLevel(IntelliJBuildParameters.GradleVerbosity) .WithProjectProperty("pluginVersion", buildVersion.SemVersion) - .WithTask("detekt") - .WithTask("ktlintCheck") - .WithTask("verifyPlugin") + .WithTask(IntelliJBuildParameters.IntelliJAnalyzerTasks) .Run(); }); IntelliJBuildParameters.Tasks.RunPluginVerifierTask = Task("Run-Plugin-Verifier") .IsDependentOn("IntelliJBuild") + .WithCriteria(() => IntelliJBuildParameters.ShouldRunPluginVerifier, "Plugin Verifier is disabled") .Does((context, buildVersion) => { Gradle diff --git a/src/Cake.IntelliJ.Recipe/Content/parameters.cake b/src/Cake.IntelliJ.Recipe/Content/parameters.cake index cc4386f..a753aae 100644 --- a/src/Cake.IntelliJ.Recipe/Content/parameters.cake +++ b/src/Cake.IntelliJ.Recipe/Content/parameters.cake @@ -16,6 +16,8 @@ public static class IntelliJBuildParameters public static FilePath IntegrationTestScriptPath { get; private set; } public static IntelliJBuildTasks Tasks { get; private set; } public static IntelliJBuildPaths Paths { get; private set; } + public static bool ShouldRunPluginVerifier { get; private set; } + public static string[] IntelliJAnalyzerTasks { get; private set; } static IntelliJBuildParameters() { Tasks = new IntelliJBuildTasks(); @@ -38,6 +40,8 @@ public static class IntelliJBuildParameters context.Information("ShouldPublishPluginCiBuilds: {0}", ShouldPublishPluginCiBuilds); context.Information("PluginChannelGradleProperty: {0}", PluginChannelGradleProperty); context.Information("PluginVersionGradleProperty: {0}", PluginVersionGradleProperty); + context.Information("ShouldRunPluginVerifier: {0}", ShouldRunPluginVerifier); + context.Information("IntelliJAnalyzerTasks: {0}", string.Join(", ", IntelliJAnalyzerTasks)); } public static void SetParameters( @@ -118,7 +122,9 @@ public static class IntelliJBuildParameters string marketplaceId = null, GradleLogLevel gradleVerbosity = GradleLogLevel.Default, DirectoryPath pluginBuildOutputPath = null, - DirectoryPath pluginPackOutputPath = null + DirectoryPath pluginPackOutputPath = null, + bool shouldRunPluginVerifier = true, + string[] intelliJAnalyzerTasks = null ) { if (context == null) @@ -227,5 +233,7 @@ public static class IntelliJBuildParameters PluginChannelGradleProperty = pluginChannelGradleProperty; PluginVersionGradleProperty = pluginVersionGradleProperty; Paths = IntelliJBuildPaths.GetPaths(context); + ShouldRunPluginVerifier = shouldRunPluginVerifier; + IntelliJAnalyzerTasks = intelliJAnalyzerTasks ?? new[] { "detekt", "ktlintCheck", "verifyPlugin" }; } }