Skip to content

Commit

Permalink
fix: better browser performance + fixed settings panel + pulled upstr…
Browse files Browse the repository at this point in the history
…eam plugin template (upgraded gradle and build tools) (#193)
  • Loading branch information
ramonvermeulen authored Oct 19, 2024
1 parent be1f28e commit 368dc12
Show file tree
Hide file tree
Showing 22 changed files with 407 additions and 158 deletions.
28 changes: 10 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:

# Prepare environment and build the plugin
Expand All @@ -36,13 +36,13 @@ jobs:
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
steps:

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

# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v3
uses: gradle/actions/wrapper-validation@v3

# Set up Java environment for the next steps
- name: Setup Java
Expand All @@ -54,8 +54,6 @@ jobs:
# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true

# Set environment variables
- name: Export Properties
Expand All @@ -73,8 +71,6 @@ jobs:
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
Expand Down Expand Up @@ -104,7 +100,7 @@ jobs:
runs-on: ubuntu-latest
steps:

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

Expand All @@ -118,8 +114,6 @@ jobs:
# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true

# Run tests
- name: Run Tests
Expand Down Expand Up @@ -158,7 +152,7 @@ jobs:
tool-cache: false
large-packages: false

# Check out current repository
# Check out the current repository
- name: Fetch Sources
uses: actions/checkout@v4
with:
Expand All @@ -174,7 +168,7 @@ jobs:

# Run Qodana inspections
- name: Qodana - Code Inspection
uses: JetBrains/[email protected].3
uses: JetBrains/[email protected]
with:
upload-result: true # upload results as github action artifacts
cache-default-branch-only: true
Expand All @@ -193,7 +187,7 @@ jobs:
tool-cache: false
large-packages: false

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

Expand All @@ -207,8 +201,6 @@ jobs:
# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true

# Cache Plugin Verifier IDEs
- name: Setup Plugin Verifier IDEs Cache
Expand All @@ -219,7 +211,7 @@ jobs:

# Run Verify Plugin task and IntelliJ Plugin Verifier tool
- name: Run Plugin Verification tasks
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}

# Collect Plugin Verifier Result
- name: Collect Plugin Verifier Result
Expand All @@ -240,7 +232,7 @@ jobs:
contents: write
steps:

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

Expand All @@ -264,4 +256,4 @@ jobs:
--notes "$(cat << 'EOM'
${{ needs.build.outputs.changelog }}
EOM
)"
)"
8 changes: 3 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
pull-requests: write
steps:

# Check out current repository
# Check out the current repository
- name: Fetch Sources
uses: actions/checkout@v4
with:
Expand All @@ -34,8 +34,6 @@ jobs:
# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true

# Set environment variables
- name: Export Properties
Expand All @@ -51,7 +49,7 @@ jobs:
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# Update Unreleased section with the current release note
# Update the Unreleased section with the current release note
- name: Patch Changelog
if: ${{ steps.properties.outputs.changelog != '' }}
env:
Expand Down Expand Up @@ -100,4 +98,4 @@ jobs:
--title "Changelog update - \`$VERSION\`" \
--body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
--label "$LABEL" \
--head $BRANCH
--head $BRANCH
6 changes: 2 additions & 4 deletions .github/workflows/run-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

steps:

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

Expand All @@ -45,8 +45,6 @@ jobs:
# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true

# Run IDEA prepared for UI testing
- name: Run IDE
Expand All @@ -62,4 +60,4 @@ jobs:

# Run tests
- name: Tests
run: ./gradlew test
run: ./gradlew test
80 changes: 80 additions & 0 deletions .github/workflows/template-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# GitHub Actions Workflow responsible for cleaning up the IntelliJ Platform Plugin Template repository from the template-specific files and configurations.
# This workflow is supposed to be triggered automatically when a new template-based repository has been created.

name: Template Cleanup
on:
push:
branches: [main]

jobs:

# Run a cleaning process only if the workflow is triggered by the non-"intellij-platform-plugin-template" repository.
template-cleanup:
name: Template Cleanup
runs-on: ubuntu-latest
if: github.event.repository.name != 'intellij-platform-plugin-template'
permissions:
contents: write
steps:

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

# Cleanup project
- name: Cleanup
run: |
export LC_CTYPE=C
export LANG=C
# Prepare variables
NAME="${GITHUB_REPOSITORY##*/}"
ACTOR=$(echo $GITHUB_ACTOR | tr '[:upper:]' '[:lower:]')
SAFE_NAME=$(echo $NAME | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
SAFE_ACTOR=$(echo $ACTOR | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
GROUP="com.github.$SAFE_ACTOR.$SAFE_NAME"
# Replace placeholders in the template-cleanup files
sed -i "s/%NAME%/$NAME/g" .github/template-cleanup/*
sed -i "s/%REPOSITORY%/${GITHUB_REPOSITORY/\//\\/}/g" .github/template-cleanup/*
sed -i "s/%GROUP%/$GROUP/g" .github/template-cleanup/*
# Replace template package name in project files with $GROUP
find src -type f -exec sed -i "s/org.jetbrains.plugins.template/$GROUP/g" {} +
find src -type f -exec sed -i "s/IntelliJ Platform Plugin Template/$NAME/g" {} +
find src -type f -exec sed -i "s/JetBrains/$ACTOR/g" {} +
# Move content
mkdir -p src/main/kotlin/${GROUP//.//}
mkdir -p src/test/kotlin/${GROUP//.//}
cp -R .github/template-cleanup/. .
cp -R src/main/kotlin/org/jetbrains/plugins/template/* src/main/kotlin/${GROUP//.//}/
cp -R src/test/kotlin/org/jetbrains/plugins/template/* src/test/kotlin/${GROUP//.//}/
# Cleanup
rm -rf \
.github/ISSUE_TEMPLATE \
.github/readme \
.github/template-cleanup \
.github/workflows/template-cleanup.yml \
.github/workflows/template-verify.yml \
.idea/icon.png \
src/main/kotlin/org \
src/test/kotlin/org \
CODE_OF_CONDUCT.md \
LICENSE
# Commit modified files
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Template cleanup"
# Push changes
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: main
github_token: ${{ secrets.GITHUB_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/template-verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# GitHub Actions Workflow verifies if the template repository is consistent with all provided content.

name: Template Verify
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]
paths: ['**/gradle.properties']
# Trigger the workflow on any pull request
pull_request:
paths: ['**/gradle.properties']

jobs:

build:
name: Template Verify
if: github.event.repository.name == 'intellij-platform-plugin-template'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}
steps:

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

# Compare `gradle.properties` with `.github/template-cleanup/gradle.properties`
- name: Verify gradle.properties
run: |
echo "\`\`\`diff" >> $GITHUB_STEP_SUMMARY
diff -U 0 \
-I '^pluginVersion' \
-I '^pluginGroup' \
-I '^pluginName' \
-I '^pluginRepositoryUrl' \
--label .github/template-cleanup/gradle.properties \
--label gradle.properties \
.github/template-cleanup/gradle.properties gradle.properties \
>> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
Loading

0 comments on commit 368dc12

Please sign in to comment.