Skip to content

Commit

Permalink
Update dependencies (#24)
Browse files Browse the repository at this point in the history
* Update dependencies

* Rename .yml to .yaml

* Sync workflows with template

* Update changelog and version
  • Loading branch information
Vechro authored Sep 16, 2023
1 parent c85fd5f commit 77dc244
Show file tree
Hide file tree
Showing 11 changed files with 171 additions and 68 deletions.
File renamed without changes.
27 changes: 27 additions & 0 deletions .github/actions/checkout-intellij-community/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Checkout intellij-community
description: Checkout intellij-community repository with the correct tag

inputs:
path:
description: Path where to checkout the repository
default: intellij-community
required: false

runs:
using: composite
steps:
# TODO: Fetch version number for regex from gradle properties
- name: Find latest tag for given IntelliJ version
uses: oprypin/[email protected]
id: intellij-tag
with:
repository: JetBrains/intellij-community
regex: ^idea\/222\.4554(?:\.\d+)?$

- name: Checkout intellij-community repository
uses: actions/checkout@v4
with:
fetch-depth: 1
repository: JetBrains/intellij-community
ref: ${{ steps.intellij-tag.outputs.tag }}
path: ${{ inputs.path }}
155 changes: 105 additions & 50 deletions .github/workflows/build.yml → .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,91 +24,161 @@ 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
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4

# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/[email protected]

# TODO: Fetch version number for regex from gradle properties
- name: Find latest tag for given IntelliJ version
uses: oprypin/[email protected]
id: intellij-tag
with:
repository: JetBrains/intellij-community
regex: ^idea\/222\.4554(?:\.\d+)?$
uses: gradle/wrapper-validation-action@v1

- name: Checkout intellij-community repository
uses: actions/checkout@v3
with:
fetch-depth: 1
repository: JetBrains/intellij-community
ref: ${{ steps.intellij-tag.outputs.tag }}
path: intellij-community
- name: Fetch intellij-community
uses: ./.github/actions/checkout-intellij-community

- name: Setup Java environment for the next steps
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true

# Set environment variables
- name: Export Properties
id: properties
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<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
- name: Run tests
# Build plugin
- name: Build plugin
run: ./gradlew buildPlugin

# Prepare plugin archive content for creating artifact
- name: Prepare Plugin Artifact
id: artifact
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@v4

- name: Fetch intellij-community
uses: ./.github/actions/checkout-intellij-community

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true

# Run tests
- name: Run Tests
run: ./gradlew check

- name: Collect test results of failed tests
# 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

- name: Add coverage report to PR
uses: mi-kas/kover-report@v1.6
uses: mi-kas/kover-report@v1.7
if: github.event_name == 'pull_request'
with:
path: ${{ github.workspace }}/build/reports/kover/report.xml
token: ${{ secrets.GITHUB_TOKEN }}
title: Code Coverage
update-comment: 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@main
with:
tool-cache: false
large-packages: false

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v4

- name: Fetch intellij-community
uses: ./.github/actions/checkout-intellij-community

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true

# 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 -Dplugin.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
Expand All @@ -118,36 +188,20 @@ jobs:
name: pluginVerifier-result
path: ${{ github.workspace }}/build/reports/pluginVerifier

# Prepare plugin archive content for creating artifact
- name: Prepare Plugin Artifact
id: artifact
working-directory: ${{ github.workspace }}/build/distributions
run: |
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 manual verification
# If accepted and published, release workflow would be triggered
release_draft:
name: Release Draft
name: Release draft
if: github.event_name != 'pull_request'
needs: build
needs: [build, test, verify]
runs-on: ubuntu-latest
permissions:
contents: write
steps:

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

# Remove old release drafts by using the curl request for the available releases with a draft flag
- name: Remove Old Release Drafts
Expand All @@ -157,6 +211,7 @@ jobs:
gh api repos/{owner}/{repo}/releases \
--jq '.[] | select(.draft == true) | .id' \
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
# Create a new release draft which is not publicly visible and requires manual acceptance
- name: Create Release Draft
env:
Expand Down
26 changes: 20 additions & 6 deletions .github/workflows/release.yml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defaults:
shell: bash

jobs:
# Prepare and publish the plugin to the Marketplace repository
# Prepare and publish the plugin to JetBrains Marketplace repository
release:
name: Publish plugin
runs-on: ubuntu-latest
Expand All @@ -19,16 +19,23 @@ jobs:

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

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true

# Set environment variables
- name: Export Properties
id: properties
Expand All @@ -50,7 +57,7 @@ jobs:
run: |
./gradlew patchChangelog --release-note="$CHANGELOG"
# Publish the plugin to the Marketplace
# Publish the plugin to JetBrains Marketplace
- name: Publish Plugin
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
Expand All @@ -65,23 +72,30 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*

# Create pull request
# Create a 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"
LABEL="release changelog"
git config user.email "[email protected]"
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 "$LABEL" \
--description "Pull requests with release changelog update" \
--force \
|| true
gh pr create \
--title "Changelog update - \`$VERSION\`" \
--body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
--label "$LABEL" \
--head $BRANCH
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
### Added

### Changed
- Update Kotlin to 1.9.10
- Update gradle-intellij-plugin to 1.15.0

### Removed

Expand All @@ -13,11 +15,11 @@
## [1.1.2] - 2023-06-11

### Changed
- Update Kotlin to 1.8.22
- Update OPENRNDR/ORX to 0.4.3
- Update Kotlin to 1.8.22
- Update OPENRNDR/ORX to 0.4.3

### Fixed
- Refactor extensions from `object` to `class` to avoid issues with Kotlin
- Refactor extensions from `object` to `class` to avoid issues with Kotlin
singletons https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#caution

## [1.1.1] - 2023-03-19
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ val defaultIntellijSourcesPath: String = File("$projectDir/../intellij-community

tasks {
wrapper {
gradleVersion = "8.1.1"
gradleVersion = "8.3"
}

val test by getting(Test::class) {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pluginName = OPENRNDR

pluginVersion = 1.1.2
pluginVersion = 1.1.3

# Opt-out flag for bundling Kotlin standard library -> https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library
kotlin.stdlib.default.dependency = false
Expand Down
Loading

0 comments on commit 77dc244

Please sign in to comment.