From 86bde954481c9a5ae269b786fdc4f267a17dccd3 Mon Sep 17 00:00:00 2001 From: Christian Vette <6884391+cvette@users.noreply.github.com> Date: Thu, 20 Jul 2023 15:47:21 +0200 Subject: [PATCH] feat: update build --- .github/workflows/build.yml | 149 ++++++++++++++---- .github/workflows/release.yml | 24 ++- .github/workflows/run-ui-tests.yml | 7 +- .run/Run IDE for UI Tests.run.xml | 25 +++ ...with Plugin.run.xml => Run Plugin.run.xml} | 0 .run/Run Qodana.run.xml | 30 ++++ ...Plugin Tests.run.xml => Run Tests.run.xml} | 0 ...tion.run.xml => Run Verifications.run.xml} | 0 gradle.properties | 6 +- gradle/libs.versions.toml | 20 +++ gradle/wrapper/gradle-wrapper.properties | 2 +- 11 files changed, 222 insertions(+), 41 deletions(-) create mode 100644 .run/Run IDE for UI Tests.run.xml rename .run/{Run IDE with Plugin.run.xml => Run Plugin.run.xml} (100%) create mode 100644 .run/Run Qodana.run.xml rename .run/{Run Plugin Tests.run.xml => Run Tests.run.xml} (100%) rename .run/{Run Plugin Verification.run.xml => Run Verifications.run.xml} (100%) create mode 100644 gradle/libs.versions.toml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index faac5090..0ff0db37 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,7 @@ jobs: outputs: version: ${{ steps.properties.outputs.version }} changelog: ${{ steps.properties.outputs.changelog }} + pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }} steps: # Free GitHub Actions Environment Disk Space - name: Maximize Build Space @@ -53,7 +54,10 @@ jobs: with: distribution: zulu java-version: 17 - cache: gradle + + # Setup Gradle + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 # Set environment variables - name: Export Properties @@ -62,11 +66,9 @@ jobs: run: | PROPERTIES="$(./gradlew properties --console=plain -q)" VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" - NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')" CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "name=$NAME" >> $GITHUB_OUTPUT echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT echo "changelog<> $GITHUB_OUTPUT @@ -75,9 +77,53 @@ jobs: ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier + # Build plugin + - name: Build plugin + run: ./gradlew buildPlugin + + # Prepare plugin archive content for creating artifact + - name: Prepare Plugin Artifact + id: artifact + shell: bash + run: | + cd ${{ github.workspace }}/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: ./build/distributions/content/*/* + + # Run tests and upload a code coverage report + test: + name: Test + needs: [ build ] + runs-on: ubuntu-latest + steps: + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v3 + + # Setup Java environment for the next steps + - 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 + # Run tests - name: Run Tests - run: ./gradlew test + run: ./gradlew check # Collect Tests Result of failed tests - name: Collect Tests Result @@ -87,16 +133,72 @@ jobs: name: tests-result path: ${{ github.workspace }}/build/reports/tests + # Upload Kover report to CodeCov + - name: Upload Code Coverage Report + uses: codecov/codecov-action@v3 + with: + files: ${{ github.workspace }}/build/reports/kover/xml/report.xml + + # Run Qodana inspections and provide report + inspectCode: + name: Inspect code + needs: [ build ] + runs-on: ubuntu-latest + permissions: + contents: write + checks: write + pull-requests: write + steps: + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v3 + + # Setup Java environment for the next steps + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 17 + + # Run Qodana inspections + - name: Qodana - Code Inspection + uses: JetBrains/qodana-action@v2023.1.5 + with: + cache-default-branch-only: true + + # Run plugin structure verification along with IntelliJ Plugin Verifier + verify: + name: Verify plugin + needs: [ build, test, inspectCode ] + runs-on: ubuntu-latest + steps: + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v3 + + # Setup Java environment for the next steps + - 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 + # Cache Plugin Verifier IDEs - name: Setup Plugin Verifier IDEs Cache uses: actions/cache@v3 with: - path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides + path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }} # Run Verify Plugin task and IntelliJ Plugin Verifier tool - name: Run Plugin Verification tasks - run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }} + run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }} # Collect Plugin Verifier Result - name: Collect Plugin Verifier Result @@ -106,30 +208,12 @@ jobs: name: pluginVerifier-result path: ${{ github.workspace }}/build/reports/pluginVerifier - # Prepare plugin archive content for creating artifact - - name: Prepare Plugin Artifact - id: artifact - shell: bash - run: | - cd ${{ github.workspace }}/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: ./build/distributions/content/*/* - # 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 + name: Release draft if: github.event_name != 'pull_request' - needs: build + needs: [ build, verify ] runs-on: ubuntu-latest permissions: contents: write @@ -139,7 +223,14 @@ jobs: - name: Fetch Sources uses: actions/checkout@v3 - # Remove old release drafts by using the curl request for the available releases with draft flag + # Setup 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 }} @@ -148,7 +239,7 @@ jobs: --jq '.[] | select(.draft == true) | .id' \ | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} - # Create new release draft - which is not publicly visible and requires manual acceptance + # Create a new release draft which is not publicly visible and requires manual acceptance - name: Create Release Draft env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -159,4 +250,4 @@ jobs: --notes "$(cat << 'EOM' ${{ needs.build.outputs.changelog }} EOM - )" + )" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1cfa0be0..28af7b35 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,6 @@ -# GitHub Actions Workflow created for handling the release process based on the draft release prepared -# with the Build workflow. Running the publishPlugin task requires the PUBLISH_TOKEN secret provided. +# GitHub Actions Workflow created for handling the release process based on the draft release prepared with the Build workflow. +# Running the publishPlugin task requires all following secrets to be provided: PUBLISH_TOKEN, PRIVATE_KEY, PRIVATE_KEY_PASSWORD, CERTIFICATE_CHAIN. +# See https://plugins.jetbrains.com/docs/intellij/plugin-signing.html for more information. name: Release on: @@ -23,13 +24,16 @@ jobs: with: ref: ${{ github.event.release.tag_name }} - # Setup Java 17 environment for the next steps + # Setup Java environment for the next steps - name: Setup Java uses: actions/setup-java@v3 with: distribution: zulu java-version: 17 - cache: gradle + + # Setup Gradle + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 # Set environment variables - name: Export Properties @@ -57,6 +61,9 @@ jobs: - name: Publish Plugin env: PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} + CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }} run: ./gradlew publishPlugin # Upload artifact as a release asset @@ -73,6 +80,7 @@ jobs: run: | VERSION="${{ github.event.release.tag_name }}" BRANCH="changelog-update-$VERSION" + LABEL="release changelog" git config user.email "action@github.com" git config user.name "GitHub Action" @@ -80,9 +88,13 @@ jobs: git checkout -b $BRANCH git commit -am "Changelog update - $VERSION" git push --set-upstream origin $BRANCH + + gh label create "$LABEL" \ + --description "Pull requests with release changelog update" \ + || true gh pr create \ --title "Changelog update - \`$VERSION\`" \ --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \ - --base main \ - --head $BRANCH + --label "$LABEL" \ + --head $BRANCH \ No newline at end of file diff --git a/.github/workflows/run-ui-tests.yml b/.github/workflows/run-ui-tests.yml index 36bbbeb4..5574857a 100644 --- a/.github/workflows/run-ui-tests.yml +++ b/.github/workflows/run-ui-tests.yml @@ -35,13 +35,16 @@ jobs: - name: Fetch Sources uses: actions/checkout@v3 - # Setup Java 17 environment for the next steps + # Setup Java environment for the next steps - name: Setup Java uses: actions/setup-java@v3 with: distribution: zulu java-version: 17 - cache: gradle + + # Setup Gradle + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 # Run IDEA prepared for UI testing - name: Run IDE diff --git a/.run/Run IDE for UI Tests.run.xml b/.run/Run IDE for UI Tests.run.xml new file mode 100644 index 00000000..f31f6d5c --- /dev/null +++ b/.run/Run IDE for UI Tests.run.xml @@ -0,0 +1,25 @@ + + + + + + + + true + true + false + false + + + \ No newline at end of file diff --git a/.run/Run IDE with Plugin.run.xml b/.run/Run Plugin.run.xml similarity index 100% rename from .run/Run IDE with Plugin.run.xml rename to .run/Run Plugin.run.xml diff --git a/.run/Run Qodana.run.xml b/.run/Run Qodana.run.xml new file mode 100644 index 00000000..1b5c7c45 --- /dev/null +++ b/.run/Run Qodana.run.xml @@ -0,0 +1,30 @@ + + + + + + + + true + true + false + false + + + \ No newline at end of file diff --git a/.run/Run Plugin Tests.run.xml b/.run/Run Tests.run.xml similarity index 100% rename from .run/Run Plugin Tests.run.xml rename to .run/Run Tests.run.xml diff --git a/.run/Run Plugin Verification.run.xml b/.run/Run Verifications.run.xml similarity index 100% rename from .run/Run Plugin Verification.run.xml rename to .run/Run Verifications.run.xml diff --git a/gradle.properties b/gradle.properties index 4606415d..7c660e1b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,18 +7,18 @@ pluginSinceBuild = 223 pluginUntilBuild = 232.* platformType = IU -platformVersion = 2022.3 +platformVersion = 2023.1.1 platformDownloadSources = true # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22IntelliLang -platformPlugins = org.intellij.intelliLang,com.intellij.css,com.jetbrains.hackathon.indices.viewer:1.23,PsiViewer:223-SNAPSHOT,yaml,java,java-i18n,properties,com.jetbrains.php:223.7571.182 +platformPlugins = org.intellij.intelliLang,com.intellij.css,com.jetbrains.hackathon.indices.viewer:1.23,PsiViewer:231-SNAPSHOT,yaml,java,java-i18n,properties,com.jetbrains.php:231.8770.68 grammarKitVersion = 2022.3.1 jFlexVersion = 1.9.0 javaVersion = 17 -gradleVersion = 8.0.2 +gradleVersion = 8.2.1 # Opt-out flag for bundling Kotlin standard library. # See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details. diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..de798f62 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,20 @@ +[versions] +# libraries +annotations = "24.0.1" + +# plugins +kotlin = "1.9.0" +changelog = "2.1.2" +gradleIntelliJPlugin = "1.15.0" +qodana = "0.1.13" +kover = "0.7.2" + +[libraries] +annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" } + +[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" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e1bef7e8..84a0b92f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists