diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9be205f..fe30e00 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,12 +6,10 @@ updates: # Maintain dependencies for Gradle dependencies - package-ecosystem: "gradle" directory: "/" - target-branch: "next" schedule: interval: "daily" # Maintain dependencies for GitHub Actions - package-ecosystem: "github-actions" directory: "/" - target-branch: "next" schedule: interval: "daily" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b85af83..40b9f09 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ 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: ['231'] + branches: ['232'] # Skip md and SQL files paths-ignore: - '**/*.md' @@ -32,15 +32,14 @@ on: jobs: - # Run Gradle Wrapper Validation Action to verify the wrapper's checksum - # Run verifyPlugin, IntelliJ Plugin Verifier, and test Gradle tasks - # Build plugin and provide the artifact for the next workflow jobs + # Prepare environment and build the plugin build: name: Build runs-on: ubuntu-latest outputs: version: ${{ steps.properties.outputs.version }} changelog: ${{ steps.properties.outputs.changelog }} + pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }} steps: # Free GitHub Actions Environment Disk Space @@ -56,15 +55,18 @@ jobs: # Validate wrapper - name: Gradle Wrapper Validation - uses: gradle/wrapper-validation-action@v1.0.4 + uses: gradle/wrapper-validation-action@v1.0.6 - # Setup Java 11 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: 11 - cache: gradle + java-version: 17 + + # Setup Gradle + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 # Set environment variables - name: Export Properties @@ -73,22 +75,64 @@ 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)" - CHANGELOG="${CHANGELOG//'%'/'%25'}" - CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" - CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" - echo "::set-output name=version::$VERSION" - echo "::set-output name=name::$NAME" - echo "::set-output name=changelog::$CHANGELOG" - echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier" + 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 + 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 @@ -98,16 +142,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 @@ -117,34 +217,12 @@ jobs: name: pluginVerifier-result path: ${{ github.workspace }}/build/reports/pluginVerifier - # Run Qodana inspections - #- name: Qodana - Code Inspection - # uses: JetBrains/qodana-action@v2022.2.1 - - # 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 "::set-output name=filename::${FILENAME:0:-4}" - - # 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 @@ -154,7 +232,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 }} @@ -163,7 +248,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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 22305ad..3ddd498 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,97 +1,63 @@ -# 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. - -name: Release +# GitHub Actions Workflow for launching UI tests on Linux, Windows, and Mac in the following steps: +# - prepare and launch IDE with your plugin and robot-server plugin, which is needed to interact with UI +# - wait for IDE to start +# - run UI tests with separate Gradle task +# +# Please check https://github.com/JetBrains/intellij-ui-test-robot for information about UI tests with IntelliJ Platform +# +# Workflow is triggered manually. + +name: Run UI Tests on: - release: - types: [prereleased, released] + workflow_dispatch jobs: - # Prepare and publish the plugin to the Marketplace repository - release: - name: Publish Plugin - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write + testUI: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + runIde: | + export DISPLAY=:99.0 + Xvfb -ac :99 -screen 0 1920x1080x16 & + gradle runIdeForUiTests & + - os: windows-latest + runIde: start gradlew.bat runIdeForUiTests + - os: macos-latest + runIde: ./gradlew runIdeForUiTests & + steps: # Check out current repository - name: Fetch Sources uses: actions/checkout@v3 - with: - ref: ${{ github.event.release.tag_name }} - # Setup Java 11 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: 11 - - # Set environment variables - - name: Export Properties - id: properties - shell: bash - run: | - CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d' - ${{ github.event.release.body }} - EOM - )" - - CHANGELOG="${CHANGELOG//'%'/'%25'}" - CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" - CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" - - echo "::set-output name=changelog::$CHANGELOG" + java-version: 17 - # Update Unreleased section with the current release note - - name: Patch Changelog - if: ${{ steps.properties.outputs.changelog != '' }} - env: - CHANGELOG: ${{ steps.properties.outputs.changelog }} - run: | - ./gradlew patchChangelog --release-note="$CHANGELOG" + # Setup Gradle + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 - # Publish the plugin to the Marketplace - - 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 + # Run IDEA prepared for UI testing + - name: Run IDE + run: ${{ matrix.runIde }} - # Upload artifact as a release asset - - name: Upload Release Asset - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* - - # Create pull request - - name: Create Pull Request - if: ${{ steps.properties.outputs.changelog != '' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - VERSION="${{ github.event.release.tag_name }}" - BRANCH="changelog-update-$VERSION" - - git config user.email "action@github.com" - git config user.name "GitHub Action" - - git checkout -b $BRANCH - git commit -am "Changelog update - $VERSION" - git push --set-upstream origin $BRANCH - - gh label create "Release Changelog" \ - --description "Tag for Pull Request from Release Changelog" \ - --color 0075ca \ - --force + # Wait for IDEA to be started + - name: Health Check + uses: jtalk/url-health-check-action@v3 + with: + url: http://127.0.0.1:8082 + max-attempts: 15 + retry-delay: 30s - gh pr create \ - --title "Changelog update - \`$VERSION\`" \ - --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \ - --head $BRANCH \ - --label "Release Changelog" + # Run tests + - name: Tests + run: ./gradlew test diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 62a34db..ce1c62c 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,15 +4,10 @@