diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..15a0195 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +# Dependabot configuration: +# https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "gradle" + directory: "/" + schedule: + interval: "daily" + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4cbb5ec --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,173 @@ +# GitHub Actions Workflow created for testing and preparing the plugin release in following steps: +# - validate Gradle Wrapper, +# - run test and verifyPlugin tasks, +# - run buildPlugin task and prepare artifact for the further tests, +# - run IntelliJ Plugin Verifier, +# - create a draft release. +# +# Workflow is triggered on push and pull_request events. +# +# Docs: +# - GitHub Actions: https://help.github.com/en/actions +# - IntelliJ Plugin Verifier GitHub Action: https://github.com/ChrisCarini/intellij-platform-plugin-verifier-action +# + +name: Build +on: + pull_request: + branches: + - master +jobs: + + # Run Gradle Wrapper Validation Action to verify the wrapper's checksum + gradleValidation: + name: Gradle Wrapper + runs-on: ubuntu-latest + steps: + + - name: Fetch Sources + uses: actions/checkout@v2 + + - name: Gradle Wrapper Validation + uses: gradle/wrapper-validation-action@v1.0.3 + + # Run verifyPlugin and test Gradle tasks + test: + name: Test + needs: gradleValidation + runs-on: ubuntu-latest + steps: + + - name: Setup Java + uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: 'zulu' + + - name: Fetch Sources + uses: actions/checkout@v2 + + - name: Setup Gradle Dependencies Cache + uses: actions/cache@v2.1.4 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }} + + - name: Setup Gradle Wrapper Cache + uses: actions/cache@v2.1.4 + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + + - name: Run Linters and Test + run: ./gradlew check + + - name: Verify Plugin + run: ./gradlew verifyPlugin + + # Build plugin with buildPlugin Gradle task and provide the artifact for the next workflow jobs + # Requires test job to be passed + build: + name: Build + needs: test + runs-on: ubuntu-latest + outputs: + name: ${{ steps.properties.outputs.name }} + version: ${{ steps.properties.outputs.version }} + artifact: ${{ steps.properties.outputs.artifact }} + steps: + + - name: Setup Java + uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: 'zulu' + + - name: Fetch Sources + uses: actions/checkout@v2 + + - name: Setup Gradle Dependencies Cache + uses: actions/cache@v2.1.4 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }} + + - name: Setup Gradle Wrapper Cache + uses: actions/cache@v2.1.4 + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + + - name: Set environment variables + id: properties + shell: bash + run: | + PROPERTIES="$(./gradlew properties --console=plain -q)" + VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" + NAME="$(echo "$PROPERTIES" | grep "^pluginName_:" | cut -f2- -d ' ')" + ARTIFACT="${NAME}-${VERSION}.zip" + + echo "::set-output name=version::$VERSION" + echo "::set-output name=name::$NAME" + echo "::set-output name=artifact::$ARTIFACT" + + - name: Build Plugin + run: ./gradlew buildPlugin + + # Upload plugin artifact to make it available in the next jobs + - name: Upload artifact + uses: actions/upload-artifact@v2.2.3 + with: + name: plugin-artifact + path: ./build/distributions/${{ needs.build.outputs.artifact }} + + # Verify built plugin using IntelliJ Plugin Verifier tool + # Requires build job to be passed + verify: + name: Verify + needs: build + runs-on: ubuntu-latest + steps: + + - name: Setup Java + uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: 'zulu' + + - name: Fetch Sources + uses: actions/checkout@v2 + + - name: Setup Gradle Dependencies Cache + uses: actions/cache@v2.1.4 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }} + + - name: Setup Gradle Wrapper Cache + uses: actions/cache@v2.1.4 + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + + # Set environment variables + - name: Export Properties + id: properties + shell: bash + run: | + PROPERTIES="$(./gradlew properties --console=plain -q)" + IDE_VERSIONS="$(echo "$PROPERTIES" | grep "^pluginVerifierIdeVersions:" | base64)" + + echo "::set-output name=ideVersions::$IDE_VERSIONS" + echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier" + + # Cache Plugin Verifier IDEs + - name: Setup Plugin Verifier IDEs Cache + uses: actions/cache@v2.1.4 + with: + path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides + key: ${{ runner.os }}-plugin-verifier-${{ steps.properties.outputs.ideVersions }} + + # Run IntelliJ Plugin Verifier action using GitHub Action + - name: Verify Plugin + run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2295e72 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,85 @@ +# 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 +on: + release: + types: [released] + +jobs: + + # Prepare and publish the plugin to the Marketplace repository +# release: +# name: Publish Plugin +# runs-on: ubuntu-latest +# steps: +# +# - name: Setup Java +# uses: actions/setup-java@v2 +# with: +# java-version: 11 +# distribution: 'zulu' +# +# - name: Fetch Sources +# uses: actions/checkout@v2 +# with: +# ref: ${{ github.event.release.tag_name }} +# +# - name: Publish Plugin +# env: +# PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} +# run: ./gradlew publishPlugin + + + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Setup Java + uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: 'zulu' + + - name: Fetch Sources + uses: actions/checkout@v2 + + - name: Setup Gradle Dependencies Cache + uses: actions/cache@v2.1.4 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }} + + - name: Setup Gradle Wrapper Cache + uses: actions/cache@v2.1.4 + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + + - name: Set environment variables + id: properties + shell: bash + run: | + PROPERTIES="$(./gradlew properties --console=plain -q)" + VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" + NAME="$(echo "$PROPERTIES" | grep "^pluginName_:" | cut -f2- -d ' ')" + ARTIFACT="${NAME}-${VERSION}.zip" + + echo "::set-output name=version::$VERSION" + echo "::set-output name=name::$NAME" + echo "::set-output name=artifact::$ARTIFACT" + + - name: Build Plugin + run: ./gradlew buildPlugin + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./build/distributions/${{ steps.properties.outputs.artifact }} + asset_name: ${{ steps.properties.outputs.artifact }} + asset_content_type: application/zip diff --git a/.idea/misc.xml b/.idea/misc.xml index 5d1a913..b084678 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,7 +4,7 @@ - + diff --git a/build.gradle.kts b/build.gradle.kts index d4c5ad2..ee3cb60 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,10 @@ plugins { id("java") - id("org.jetbrains.intellij") version "1.9.0" + id("org.jetbrains.intellij") version "1.10.0-SNAPSHOT" } group = "com.anas.intellij.plugins.ayah" -version = "0.0.8" +version = "0.0.9" repositories { mavenCentral() @@ -24,14 +24,14 @@ dependencies { testAnnotationProcessor("org.projectlombok:lombok:1.18.24") } java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } // Configure Gradle IntelliJ Plugin // Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html intellij { - version.set("2022.2.1") + version.set("LATEST-EAP-SNAPSHOT") type.set("IC") // Target IDE Platform downloadSources.set(true) @@ -42,12 +42,12 @@ tasks { // Set the JVM compatibility versions withType { options.encoding = "UTF-8" - sourceCompatibility = "11" - targetCompatibility = "11" + sourceCompatibility = "17" + targetCompatibility = "17" } patchPluginXml { - sinceBuild.set("213") + sinceBuild.set("223") untilBuild.set("223.*") } diff --git a/settings.gradle.kts b/settings.gradle.kts index 3b176bd..b210c5c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1,7 @@ -rootProject.name = "Ayah-intellij" \ No newline at end of file +rootProject.name = "Ayah-intellij" +pluginManagement { + repositories { + maven("https://oss.sonatype.org/content/repositories/snapshots/") + gradlePluginPortal() + } +}