Skip to content

Commit

Permalink
Merge pull request #128 from olivernybroe/higher-order
Browse files Browse the repository at this point in the history
Upgrade from template repository and remove higher order type provider
  • Loading branch information
Oliver Nybroe authored May 15, 2022
2 parents 6091f15 + e8badec commit ca22521
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 225 deletions.
141 changes: 63 additions & 78 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# 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,
# - run 'test' and '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.
#
# Docs:
# - GitHub Actions: https://help.github.com/en/actions
# - IntelliJ Plugin Verifier GitHub Action: https://github.com/ChrisCarini/intellij-platform-plugin-verifier-action
# GitHub Actions reference: https://help.github.com/en/actions
#
## JBIJPPTPL

Expand All @@ -24,30 +22,24 @@ on:
jobs:

# Run Gradle Wrapper Validation Action to verify the wrapper's checksum
gradleValidation:
name: Gradle Wrapper
# Run verifyPlugin, IntelliJ Plugin Verifier, and test Gradle tasks
# Build plugin and provide the artifact for the next workflow jobs
build:
name: Build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}
steps:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3.0.1
uses: actions/checkout@v3

# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1.0.4

# Run verifyPlugin and test Gradle tasks
test:
name: Test
needs: gradleValidation
runs-on: ubuntu-latest
steps:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3.0.1

# Setup Java 11 environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
Expand All @@ -62,80 +54,68 @@ jobs:
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
IDE_VERSIONS="$(echo "$PROPERTIES" | grep "^pluginVerifierIdeVersions:" | base64)"
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=ideVersions::$IDE_VERSIONS"
echo "::set-output name=version::$VERSION"
echo "::set-output name=name::$NAME"
echo "::set-output name=changelog::$CHANGELOG"
echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier"
# Cache Plugin Verifier IDEs
- name: Setup Plugin Verifier IDEs Cache
uses: actions/cache@v3.0.2
with:
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
key: ${{ runner.os }}-plugin-verifier-${{ steps.properties.outputs.ideVersions }}
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
# Run tests
- name: Run Tests
run: ./gradlew test

# Run verifyPlugin Gradle task
- name: Verify Plugin
run: ./gradlew verifyPlugin

# Run IntelliJ Plugin Verifier action using GitHub Action
- name: Run Plugin Verifier
run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
# Collect Tests Result of failed tests
- name: Collect Tests Result
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: tests-result
path: ${{ github.workspace }}/build/reports/tests

# 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:
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}
steps:
# Cache Plugin Verifier IDEs
- name: Setup Plugin Verifier IDEs Cache
uses: actions/cache@v3
with:
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3.0.1
# 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 }}

# Setup Java 11 environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
# Collect Plugin Verifier Result
- name: Collect Plugin Verifier Result
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
distribution: zulu
java-version: 11
cache: gradle
name: pluginVerifier-result
path: ${{ github.workspace }}/build/reports/pluginVerifier

# Set environment variables
- name: Export Properties
id: properties
# Prepare plugin archive content for creating artifact
- name: Prepare Plugin Artifact
id: artifact
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 ' ')"
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"
cd ${{ github.workspace }}/build/distributions
FILENAME=`ls *.zip`
unzip "$FILENAME" -d content
# Build artifact using buildPlugin Gradle task
- name: Build Plugin
run: ./gradlew buildPlugin
echo "::set-output name=filename::${FILENAME:0:-4}"
# Store built plugin as an artifact for downloading
- name: Upload artifacts
uses: actions/upload-artifact@v3.0.0
# Store already-built plugin as an artifact for downloading
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: "${{ steps.properties.outputs.name }} - ${{ steps.properties.outputs.version }}"
path: ./build/distributions/*
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
Expand All @@ -144,11 +124,13 @@ jobs:
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3.0.1
uses: actions/checkout@v3

# Remove old release drafts by using the curl request for the available releases with draft flag
- name: Remove Old Release Drafts
Expand All @@ -167,4 +149,7 @@ jobs:
gh release create v${{ needs.build.outputs.version }} \
--draft \
--title "v${{ needs.build.outputs.version }}" \
--notes "${{ needs.build.outputs.changelog }}"
--notes "$(cat << 'EOM'
${{ needs.build.outputs.changelog }}
EOM
)"
29 changes: 25 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ jobs:
release:
name: Publish Plugin
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3.0.1
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}

Expand All @@ -28,12 +31,29 @@ jobs:
java-version: 11
cache: gradle

# 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"
# 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="`cat << EOM
${{ github.event.release.body }}
EOM`"
./gradlew patchChangelog --release-note="$CHANGELOG"
# Publish the plugin to the Marketplace
- name: Publish Plugin
Expand All @@ -49,6 +69,7 @@ jobs:

# Create pull request
- name: Create Pull Request
if: ${{ steps.properties.outputs.changelog != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/run-ui-tests.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# GitHub Actions Workflow created for launching UI tests on Linux, Windows, and Mac in the following steps:
# - prepare and launch Idea with your plugin and robot-server plugin, which is need to interact with UI
# - wait for the Idea started
# 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 IDEA.
# Please check https://github.com/JetBrains/intellij-ui-test-robot for information about UI tests with IntelliJ Platform
#
# Workflow is triggered manually.

Expand Down Expand Up @@ -33,7 +33,7 @@ jobs:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3.0.1
uses: actions/checkout@v3

# Setup Java 11 environment for the next steps
- name: Setup Java
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
# collections-intellij Changelog

## [Unreleased]
### Removed
- Removed type provider for higher order collections as it seemed unstable

## [0.3.5]
### Fixed
### Fixed
- Fixed immutable php type issues

## [0.3.4]
Expand Down
36 changes: 0 additions & 36 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

fun properties(key: String) = project.findProperty(key).toString()

Expand All @@ -12,8 +11,6 @@ plugins {
id("org.jetbrains.intellij") version "1.5.3"
// Gradle Changelog Plugin
id("org.jetbrains.changelog") version "1.3.1"
// Gradle Qodana Plugin
id("org.jetbrains.qodana") version "0.1.13"
}

group = properties("pluginGroup")
Expand All @@ -29,8 +26,6 @@ intellij {
pluginName.set(properties("pluginName"))
version.set(properties("platformVersion"))
type.set(properties("platformType"))
downloadSources.set(properties("platformDownloadSources").toBoolean())
updateSinceUntilBuild.set(true)

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
Expand All @@ -42,26 +37,8 @@ changelog {
groups.set(emptyList())
}

// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
qodana {
cachePath.set(projectDir.resolve(".qodana").canonicalPath)
reportPath.set(projectDir.resolve("build/reports/inspections").canonicalPath)
saveReport.set(true)
showReport.set(System.getenv("QODANA_SHOW_REPORT")?.toBoolean() ?: false)
}

tasks {
// Set the JVM compatibility versions
properties("javaVersion").let {
withType<JavaCompile> {
sourceCompatibility = it
targetCompatibility = it
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = it
}
}

wrapper {
gradleVersion = properties("gradleVersion")
}
Expand Down Expand Up @@ -92,19 +69,6 @@ tasks {
})
}

runPluginVerifier {
ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty))
}

// Configure UI tests plugin
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
runIdeForUiTests {
systemProperty("robot-server.port", "8082")
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
systemProperty("jb.consents.confirmation.enabled", "false")
}

signPlugin {
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("PRIVATE_KEY"))
Expand Down
9 changes: 0 additions & 9 deletions detekt-config.yml

This file was deleted.

Loading

0 comments on commit ca22521

Please sign in to comment.