diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 0475d46db4..0000000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,22 +0,0 @@ -What does this implement/fix? Explain your changes. ---------------------------------------------------- -… - - -Does this close any currently open issues? ------------------------------------------- - - - - -Any relevant logs, screenshots, error output, etc.? -------------------------------------- - - -Any other comments? -------------------- -… - -Has this been tested? ---------------------------- -- [ ] Tested diff --git a/.github/no-response.yml b/.github/no-response.yml deleted file mode 100644 index 14bbe27944..0000000000 --- a/.github/no-response.yml +++ /dev/null @@ -1,4 +0,0 @@ -daysUntilClose: 14 -responseRequiredLabel: need more info -closeComment: > - This issue has been closed automatically because it needs more information and has not had recent activity. Please reach out if you have or find the answers we need so that we can investigate further. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..ad74ca71be --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,316 @@ +# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps: +# - validate Gradle Wrapper, +# - run 'verifyPlugin' tasks, +# - run 'buildPlugin' task and prepare artifact for the further tests, +# - run 'runPluginVerifier' task, +# - create a draft release. +# +# Workflow is triggered on push and pull_request events. +# +# GitHub Actions reference: https://help.github.com/en/actions +# +## JBIJPPTPL + +name: Build +on: + workflow_dispatch: + # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests) + push: + branches: [ develop ] + # Trigger the workflow on any pull request + pull_request: + branches: + - develop + +jobs: + + # Prepare environment and build the plugin + build-dependencies: + name: Build Dependencies + runs-on: ubuntu-latest + steps: + + # Check out Maven Plugins for Azure Services repository + - name: Fetch Maven Plugins for Azure Services + uses: actions/checkout@v4 + with: + repository: microsoft/azure-maven-plugins + ref: endgame-202310 + path: azure-maven-plugins + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + with: + path: azure-tools-for-intellij + + # Setup Java environment + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: | + 8 + 17 + + # Build Maven Plugins for Azure Services library + - name: Build Maven Plugins for Azure Services + working-directory: ${{ github.workspace }}/azure-maven-plugins + shell: bash + run: | + export JAVA_HOME=$JAVA_HOME_8_X64 + ./mvnw install -f azure-toolkit-libs/pom.xml + + # Build Utils library + - name: Build Utils + working-directory: ${{ github.workspace }}/azure-tools-for-intellij + shell: bash + run: | + export JAVA_HOME=$JAVA_HOME_17_X64 + ./mvnw install -DskipTests -f Utils/pom.xml + + # Upload azure artifacts + - name: Upload azure artifacts + uses: actions/upload-artifact@v3 + with: + name: azure-artifacts + path: /home/runner/.m2/repository/com/microsoft/azure/ + retention-days: 1 + + # Upload hdinsight artifacts + - name: Upload hdinsight artifacts + uses: actions/upload-artifact@v3 + with: + name: hdinsight-artifacts + path: /home/runner/.m2/repository/com/microsoft/hdinsight/ + retention-days: 1 + + # Upload azuretools artifacts + - name: Upload azuretools artifacts + uses: actions/upload-artifact@v3 + with: + name: azuretools-artifacts + path: /home/runner/.m2/repository/com/microsoft/azuretools/ + retention-days: 1 + + # Prepare environment and build the plugin + build: + name: Build + needs: [ build-dependencies ] + runs-on: ubuntu-latest + outputs: + version: ${{ steps.properties.outputs.version }} + changelog: ${{ steps.properties.outputs.changelog }} + pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }} + steps: + + # Download azure artifacts + - name: Download library artifacts + uses: actions/download-artifact@v3 + with: + name: azure-artifacts + path: /home/runner/.m2/repository/com/microsoft/azure/ + + # Download hdinsight artifacts + - name: Download library artifacts + uses: actions/download-artifact@v3 + with: + name: hdinsight-artifacts + path: /home/runner/.m2/repository/com/microsoft/hdinsight/ + + # Download azuretools artifacts + - name: Download library artifacts + uses: actions/download-artifact@v3 + with: + name: azuretools-artifacts + path: /home/runner/.m2/repository/com/microsoft/azuretools/ + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + + # Setup Java environment + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 17 + + # Setup Gradle + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + with: + build-root-directory: ${{ github.workspace }}/PluginsAndFeatures/azure-toolkit-for-rider + gradle-home-cache-cleanup: true + + # Setup .NET 8 environment + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.x' + + # Set environment variables + - name: Export Properties + id: properties + working-directory: ${{ github.workspace }}/PluginsAndFeatures/azure-toolkit-for-rider + shell: bash + run: | + PROPERTIES="$(./gradlew properties --console=plain -q)" + VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" + CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" + + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT + + echo "changelog<> $GITHUB_OUTPUT + echo "$CHANGELOG" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier + + # Build plugin + - name: Build plugin + working-directory: ${{ github.workspace }}/PluginsAndFeatures/azure-toolkit-for-rider + run: ./gradlew buildPlugin + + # Prepare plugin archive content for creating artifact + - name: Prepare Plugin Artifact + id: artifact + working-directory: ${{ github.workspace }}/PluginsAndFeatures/azure-toolkit-for-rider + shell: bash + run: | + cd ./build/distributions + FILENAME=`ls *.zip` + unzip "$FILENAME" -d content + + echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT + + # Store already-built plugin as an artifact for downloading + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.artifact.outputs.filename }} + path: ${{ github.workspace }}/PluginsAndFeatures/azure-toolkit-for-rider/build/distributions/content/*/* + + # Run plugin structure verification along with IntelliJ Plugin Verifier + verify: + name: Verify plugin + needs: [ build ] + runs-on: ubuntu-latest + steps: + + # Free GitHub Actions Environment Disk Space + - name: Maximize Build Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + large-packages: false + + # Download azure artifacts + - name: Download library artifacts + uses: actions/download-artifact@v3 + with: + name: azure-artifacts + path: /home/runner/.m2/repository/com/microsoft/azure/ + + # Download hdinsight artifacts + - name: Download library artifacts + uses: actions/download-artifact@v3 + with: + name: hdinsight-artifacts + path: /home/runner/.m2/repository/com/microsoft/hdinsight/ + + # Download azuretools artifacts + - name: Download library artifacts + uses: actions/download-artifact@v3 + with: + name: azuretools-artifacts + path: /home/runner/.m2/repository/com/microsoft/azuretools/ + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + + # Set up Java environment + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 17 + + # Set up Gradle + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + with: + build-root-directory: ${{ github.workspace }}/PluginsAndFeatures/azure-toolkit-for-rider + gradle-home-cache-cleanup: true + + # Setup .NET 8 environment + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.x' + + # Cache Plugin Verifier IDEs + - name: Setup Plugin Verifier IDEs Cache + uses: actions/cache@v3 + with: + path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides + key: plugin-verifier-${{ hashFiles('PluginsAndFeatures/azure-toolkit-for-rider/build/listProductsReleases.txt') }} + + # Run Verify Plugin task and IntelliJ Plugin Verifier tool + - name: Run Plugin Verification tasks + working-directory: ${{ github.workspace }}/PluginsAndFeatures/azure-toolkit-for-rider + run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }} + + # Collect Plugin Verifier Result + - name: Collect Plugin Verifier Result + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: pluginVerifier-result + path: ${{ github.workspace }}/PluginsAndFeatures/azure-toolkit-for-rider/build/reports/pluginVerifier + + # Prepare a draft release for GitHub Releases page for the manual verification + # If accepted and published, release workflow would be triggered + releaseDraft: + name: Release draft + if: github.event_name != 'pull_request' + needs: [ build, test, inspectCode, verify ] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + + # Set up Java environment for the next steps + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 17 + + # Remove old release drafts by using the curl request for the available releases with a draft flag + - name: Remove Old Release Drafts + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh api repos/{owner}/{repo}/releases \ + --jq '.[] | select(.draft == true) | .id' \ + | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} + + # Create a new release draft which is not publicly visible and requires manual acceptance + - name: Create Release Draft + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create v${{ needs.build.outputs.version }} \ + --draft \ + --title "v${{ needs.build.outputs.version }}" \ + --notes "$(cat << 'EOM' + ${{ needs.build.outputs.changelog }} + EOM + )" \ No newline at end of file diff --git a/.github/workflows/no-response.yml b/.github/workflows/no-response.yml deleted file mode 100644 index dbd72260ca..0000000000 --- a/.github/workflows/no-response.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: No Response - -# **What it does**: Closes issues where the original author doesn't respond to a request for information. -# **Why we have it**: To remove the need for maintainers to remember to check back on issues periodically to see if contributors have responded. -# **Who does it impact**: Everyone that works on docs or docs-internal. - -on: - issue_comment: - types: [created] - schedule: - - cron: '0 0 * * *' - -jobs: - noResponse: - runs-on: ubuntu-latest - steps: - - uses: lee-dohm/no-response@v0.5.0 - with: - token: ${{ github.token }} - daysUntilClose: 14 # Number of days of inactivity before an Issue is closed for lack of response - responseRequiredLabel: "need more info" # Label indicating that a response from the original author is required - closeComment: > - This issue has been closed automatically because it needs more information and has not had recent activity. Please reach out if you have or find the answers we need so that we can investigate further. \ No newline at end of file diff --git a/PluginsAndFeatures/azure-toolkit-for-rider/build.gradle.kts b/PluginsAndFeatures/azure-toolkit-for-rider/build.gradle.kts index a830ba95d0..f089f23efa 100644 --- a/PluginsAndFeatures/azure-toolkit-for-rider/build.gradle.kts +++ b/PluginsAndFeatures/azure-toolkit-for-rider/build.gradle.kts @@ -32,6 +32,12 @@ intellij { plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } } +// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin +changelog { + groups.empty() + repositoryUrl = properties("pluginRepositoryUrl") +} + sourceSets { main { kotlin.srcDir("src/main/kotlin") @@ -169,6 +175,12 @@ tasks { } } + runPluginVerifier { + ideVersions.set( + properties("pluginVerifierIdeVersions").get().split(',').map(String::trim).filter(String::isNotEmpty) + ) + } + val copyIcons by registering(Copy::class) { description = "Copies the icons directory of the base plugin." from(projectDir.resolve("..").resolve("azure-toolkit-for-intellij").resolve("src").resolve("main").resolve("resources").resolve("icons")) @@ -227,6 +239,7 @@ tasks { directory = csDaemonGeneratedOutput.canonicalPath } } + prepareSandbox { dependsOn(compileDotNet) @@ -251,8 +264,22 @@ tasks { } } - buildSearchableOptions { enabled = false } + + signPlugin { + certificateChain = environment("CERTIFICATE_CHAIN") + privateKey = environment("PRIVATE_KEY") + password = environment("PRIVATE_KEY_PASSWORD") + } + + publishPlugin { + dependsOn("patchChangelog") + token = environment("PUBLISH_TOKEN") + // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 + // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more: + // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel + channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) } + } } diff --git a/PluginsAndFeatures/azure-toolkit-for-rider/gradle.properties b/PluginsAndFeatures/azure-toolkit-for-rider/gradle.properties index f25e57ea02..0b4b0fab2a 100644 --- a/PluginsAndFeatures/azure-toolkit-for-rider/gradle.properties +++ b/PluginsAndFeatures/azure-toolkit-for-rider/gradle.properties @@ -4,7 +4,12 @@ pluginGroup = com.jetbrains pluginName = azure-toolkit-for-rider pluginRepositoryUrl = https://github.com/JetBrains/azure-tools-for-intellij # SemVer format -> https://semver.org -pluginVersion = 1.0-SNAPSHOT +pluginVersion = 4.0-SNAPSHOT + +# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl +# See https://jb.gg/intellij-platform-builds-list for available build versions. +# RD-2023.3 +pluginVerifierIdeVersions = RD-2023.3-EAP7 dotnetBuildConfiguration=Debug @@ -40,4 +45,4 @@ org.gradle.caching = true systemProp.org.gradle.unsafe.kotlin.assignment = true # Temporary workaround for Kotlin Compiler OutOfMemoryError -> https://jb.gg/intellij-platform-kotlin-oom -kotlin.incremental.useClasspathSnapshot=false \ No newline at end of file +kotlin.incremental.useClasspathSnapshot = false \ No newline at end of file diff --git a/PluginsAndFeatures/azure-toolkit-for-rider/gradlew b/PluginsAndFeatures/azure-toolkit-for-rider/gradlew old mode 100644 new mode 100755 index fbf29cc490..d91ebd861b --- a/PluginsAndFeatures/azure-toolkit-for-rider/gradlew +++ b/PluginsAndFeatures/azure-toolkit-for-rider/gradlew @@ -83,7 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,15 +198,14 @@ if "$cygwin" || "$msys" ; then done fi - # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \