| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| # GitHub Actions Workflow for CI: testing and verifying the plugin. |
| # - Validate Gradle Wrapper. |
| # - Run 'buildPlugin' task and prepare artifact. |
| # - Run 'test' and 'verifyPlugin' tasks. |
| # - Run Qodana inspections. |
| # |
| # Pre-release publishing is handled by the separate nightly.yml workflow. |
| # |
| # The workflow is triggered on push and pull_request events. |
| # |
| # GitHub Actions reference: https://help.github.com/en/actions |
| # |
| ## JBIJPPTPL |
| |
| name: Build |
| on: |
| # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests) |
| push: |
| branches: [ main ] |
| # Trigger the workflow on any pull request |
| pull_request: |
| |
| concurrency: |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| # Do not cancel main-branch runs: each push should complete so every commit is verified and gets its own computed plugin version. |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| |
| jobs: |
| |
| # Prepare environment and build the plugin |
| build: |
| name: Build |
| runs-on: ubuntu-latest |
| outputs: |
| pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }} |
| artifact_name: ${{ steps.artifact.outputs.filename }} |
| steps: |
| |
| # Check out the current repository |
| - name: Fetch Sources |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| |
| # Validate wrapper |
| - name: Gradle Wrapper Validation |
| uses: gradle/actions/wrapper-validation@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 |
| |
| # Set up Java environment for the next steps |
| - name: Setup Java |
| uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 |
| with: |
| distribution: zulu |
| java-version: 21 |
| |
| # Setup Gradle |
| - name: Setup Gradle |
| uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 |
| with: |
| cache-cleanup: always |
| |
| # Set environment variables |
| - name: Export Properties |
| id: properties |
| shell: bash |
| run: | |
| echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT |
| |
| # Build plugin |
| # Note: --no-configuration-cache is used to work around XML parsing issues |
| # in IntelliJ Platform Gradle Plugin with bundled plugin resolution |
| - name: Build plugin |
| run: ./gradlew buildPlugin --no-configuration-cache |
| |
| # Prepare plugin archive content for creating artifact (skip for Dependabot) |
| - name: Prepare Plugin Artifact |
| if: github.actor != 'dependabot[bot]' |
| id: artifact |
| shell: bash |
| run: | |
| cd ${{ github.workspace }}/build/distributions |
| FILENAME=$(ls *-signed.zip 2>/dev/null || ls *.zip | head -1) |
| unzip "$FILENAME" -d content |
| echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT |
| |
| # Store already-built plugin as an artifact for downloading (skip for Dependabot) |
| - name: Upload artifact |
| if: github.actor != 'dependabot[bot]' |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 |
| 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 the current repository |
| - name: Fetch Sources |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| |
| # Set up Java environment for the next steps |
| - name: Setup Java |
| uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 |
| with: |
| distribution: zulu |
| java-version: 21 |
| |
| # Setup Gradle |
| - name: Setup Gradle |
| uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 |
| with: |
| cache-cleanup: always |
| |
| # Run tests |
| - name: Run Tests |
| run: ./gradlew check --no-configuration-cache |
| continue-on-error: false |
| |
| # Collect Tests Result of failed tests |
| - name: Collect Tests Result |
| if: ${{ failure() }} |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 |
| with: |
| name: tests-result |
| path: ${{ github.workspace }}/build/reports/tests |
| |
| # Upload the Kover report to CodeCov |
| - name: Upload Code Coverage Report |
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v5 |
| with: |
| files: ${{ github.workspace }}/build/reports/kover/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: |
| |
| # Free GitHub Actions Environment Disk Space |
| - name: Maximize Build Space |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 |
| with: |
| tool-cache: false |
| large-packages: false |
| |
| # Check out the current repository |
| - name: Fetch Sources |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| with: |
| # to check out the actual pull request commit, not the merge commit |
| ref: ${{ github.event.pull_request.head.sha }} |
| # a full history is required for pull request analysis |
| fetch-depth: 0 |
| |
| # Set up the Java environment for the next steps |
| - name: Setup Java |
| uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 |
| with: |
| distribution: zulu |
| java-version: 21 |
| |
| # Run Qodana inspections |
| - name: Qodana - Code Inspection |
| uses: JetBrains/qodana-action@4861e015da555e86a72b862892aba6c2b93e6891 # v2026.1.3 |
| continue-on-error: true |
| with: |
| cache-default-branch-only: true |
| |
| # 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@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 |
| with: |
| tool-cache: false |
| large-packages: false |
| |
| # Check out the current repository |
| - name: Fetch Sources |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| |
| # Set up Java environment for the next steps |
| - name: Setup Java |
| uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5 |
| with: |
| distribution: zulu |
| java-version: 21 |
| |
| # Setup Gradle |
| - name: Setup Gradle |
| uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 |
| with: |
| cache-cleanup: always |
| |
| # Cache Plugin Verifier IDEs |
| - name: Setup Plugin Verifier IDEs Cache |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
| with: |
| 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 verifyPlugin --no-configuration-cache -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }} |
| |
| # Collect Plugin Verifier Result |
| - name: Collect Plugin Verifier Result |
| if: ${{ always() }} |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 |
| with: |
| name: pluginVerifier-result |
| path: ${{ github.workspace }}/build/reports/pluginVerifier |
| |
| # Comment on PR with artifact download link |
| pr-comment: |
| name: Comment on PR with artifact link |
| needs: [ build ] |
| if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' |
| runs-on: ubuntu-latest |
| permissions: |
| pull-requests: write |
| steps: |
| - name: Comment on PR |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 |
| with: |
| script: | |
| const prNumber = context.payload.pull_request.number; |
| const artifactName = '${{ needs.build.outputs.artifact_name }}' || 'plugin-artifact'; |
| const runId = context.runId; |
| |
| const marker = '<!-- plugin-artifact-comment -->'; |
| const body = `${marker}\nš **Plugin artifact ready for testing!**\n\nDownload from [Actions artifacts](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId}#artifacts)\n\nArtifact: \`${artifactName}\``; |
| |
| // Find existing comment with marker |
| const { data: comments } = await github.rest.issues.listComments({ |
| owner: context.repo.owner, |
| repo: context.repo.repo, |
| issue_number: prNumber |
| }); |
| |
| const existing = comments.find(c => c.body.includes(marker)); |
| |
| if (existing) { |
| await github.rest.issues.updateComment({ |
| owner: context.repo.owner, |
| repo: context.repo.repo, |
| comment_id: existing.id, |
| body: body |
| }); |
| } else { |
| await github.rest.issues.createComment({ |
| owner: context.repo.owner, |
| repo: context.repo.repo, |
| issue_number: prNumber, |
| body: body |
| }); |
| } |