Skip to content

Commit acf26e6

Browse files
author
Alexandr Devyatkin
committed
init commit
0 parents  commit acf26e6

File tree

20 files changed

+880
-0
lines changed

20 files changed

+880
-0
lines changed

.github/dependabot.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Dependabot configuration:
2+
# https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates
3+
4+
version: 2
5+
updates:
6+
# Maintain dependencies for Gradle dependencies
7+
- package-ecosystem: "gradle"
8+
directory: "/"
9+
target-branch: "next"
10+
schedule:
11+
interval: "daily"
12+
# Maintain dependencies for GitHub Actions
13+
- package-ecosystem: "github-actions"
14+
directory: "/"
15+
target-branch: "next"
16+
schedule:
17+
interval: "daily"

.github/workflows/build.yml

+166
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# GitHub Actions Workflow created for testing and preparing the plugin release in following steps:
2+
# - validate Gradle Wrapper,
3+
# - run 'test' and 'verifyPlugin' tasks,
4+
# - run Qodana inspections,
5+
# - run 'buildPlugin' task and prepare artifact for the further tests,
6+
# - run 'runPluginVerifier' task,
7+
# - create a draft release.
8+
#
9+
# Workflow is triggered on push and pull_request events.
10+
#
11+
# GitHub Actions reference: https://help.github.com/en/actions
12+
#
13+
## JBIJPPTPL
14+
15+
name: Build
16+
on:
17+
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests)
18+
push:
19+
branches: [master]
20+
# Trigger the workflow on any pull request
21+
pull_request:
22+
23+
jobs:
24+
25+
# Run Gradle Wrapper Validation Action to verify the wrapper's checksum
26+
# Run verifyPlugin, IntelliJ Plugin Verifier, and test Gradle tasks
27+
# Build plugin and provide the artifact for the next workflow jobs
28+
build:
29+
name: Build
30+
runs-on: ubuntu-latest
31+
outputs:
32+
version: ${{ steps.properties.outputs.version }}
33+
changelog: ${{ steps.properties.outputs.changelog }}
34+
steps:
35+
36+
# Free GitHub Actions Environment Disk Space
37+
- name: Maximize Build Space
38+
run: |
39+
sudo rm -rf /usr/share/dotnet
40+
sudo rm -rf /usr/local/lib/android
41+
sudo rm -rf /opt/ghc
42+
43+
# Check out current repository
44+
- name: Fetch Sources
45+
uses: actions/checkout@v3
46+
47+
# Validate wrapper
48+
- name: Gradle Wrapper Validation
49+
uses: gradle/[email protected]
50+
51+
# Setup Java 11 environment for the next steps
52+
- name: Setup Java
53+
uses: actions/setup-java@v3
54+
with:
55+
distribution: zulu
56+
java-version: 11
57+
58+
# Set environment variables
59+
- name: Export Properties
60+
id: properties
61+
shell: bash
62+
run: |
63+
PROPERTIES="$(./gradlew properties --console=plain -q)"
64+
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
65+
NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
66+
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
67+
CHANGELOG="${CHANGELOG//'%'/'%25'}"
68+
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
69+
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
70+
71+
echo "::set-output name=version::$VERSION"
72+
echo "::set-output name=name::$NAME"
73+
echo "::set-output name=changelog::$CHANGELOG"
74+
echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier"
75+
76+
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
77+
78+
# Run tests
79+
- name: Run Tests
80+
run: ./gradlew test
81+
82+
# Collect Tests Result of failed tests
83+
- name: Collect Tests Result
84+
if: ${{ failure() }}
85+
uses: actions/upload-artifact@v3
86+
with:
87+
name: tests-result
88+
path: ${{ github.workspace }}/build/reports/tests
89+
90+
# Cache Plugin Verifier IDEs
91+
- name: Setup Plugin Verifier IDEs Cache
92+
uses: actions/cache@v3
93+
with:
94+
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
95+
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
96+
97+
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
98+
- name: Run Plugin Verification tasks
99+
run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
100+
101+
# Collect Plugin Verifier Result
102+
- name: Collect Plugin Verifier Result
103+
if: ${{ always() }}
104+
uses: actions/upload-artifact@v3
105+
with:
106+
name: pluginVerifier-result
107+
path: ${{ github.workspace }}/build/reports/pluginVerifier
108+
109+
# Run Qodana inspections
110+
- name: Qodana - Code Inspection
111+
uses: JetBrains/[email protected]
112+
113+
# Prepare plugin archive content for creating artifact
114+
- name: Prepare Plugin Artifact
115+
id: artifact
116+
shell: bash
117+
run: |
118+
cd ${{ github.workspace }}/build/distributions
119+
FILENAME=`ls *.zip`
120+
unzip "$FILENAME" -d content
121+
122+
echo "::set-output name=filename::${FILENAME:0:-4}"
123+
124+
# Store already-built plugin as an artifact for downloading
125+
- name: Upload artifact
126+
uses: actions/upload-artifact@v3
127+
with:
128+
name: ${{ steps.artifact.outputs.filename }}
129+
path: ./build/distributions/content/*/*
130+
131+
# Prepare a draft release for GitHub Releases page for the manual verification
132+
# If accepted and published, release workflow would be triggered
133+
releaseDraft:
134+
name: Release Draft
135+
if: github.event_name != 'pull_request'
136+
needs: build
137+
runs-on: ubuntu-latest
138+
permissions:
139+
contents: write
140+
steps:
141+
142+
# Check out current repository
143+
- name: Fetch Sources
144+
uses: actions/checkout@v3
145+
146+
# Remove old release drafts by using the curl request for the available releases with draft flag
147+
- name: Remove Old Release Drafts
148+
env:
149+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
150+
run: |
151+
gh api repos/{owner}/{repo}/releases \
152+
--jq '.[] | select(.draft == true) | .id' \
153+
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
154+
155+
# Create new release draft - which is not publicly visible and requires manual acceptance
156+
- name: Create Release Draft
157+
env:
158+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
159+
run: |
160+
gh release create v${{ needs.build.outputs.version }} \
161+
--draft \
162+
--title "v${{ needs.build.outputs.version }}" \
163+
--notes "$(cat << 'EOM'
164+
${{ needs.build.outputs.changelog }}
165+
EOM
166+
)"

.github/workflows/release.yml

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# GitHub Actions Workflow created for handling the release process based on the draft release prepared
2+
# with the Build workflow. Running the publishPlugin task requires the PUBLISH_TOKEN secret provided.
3+
4+
name: Release
5+
on:
6+
release:
7+
types: [prereleased, released]
8+
9+
jobs:
10+
11+
# Prepare and publish the plugin to the Marketplace repository
12+
release:
13+
name: Publish Plugin
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
steps:
19+
20+
# Check out current repository
21+
- name: Fetch Sources
22+
uses: actions/checkout@v3
23+
with:
24+
ref: ${{ github.event.release.tag_name }}
25+
26+
# Setup Java 11 environment for the next steps
27+
- name: Setup Java
28+
uses: actions/setup-java@v3
29+
with:
30+
distribution: zulu
31+
java-version: 11
32+
33+
# Set environment variables
34+
- name: Export Properties
35+
id: properties
36+
shell: bash
37+
run: |
38+
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
39+
${{ github.event.release.body }}
40+
EOM
41+
)"
42+
43+
CHANGELOG="${CHANGELOG//'%'/'%25'}"
44+
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
45+
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
46+
47+
echo "::set-output name=changelog::$CHANGELOG"
48+
49+
# Update Unreleased section with the current release note
50+
- name: Patch Changelog
51+
if: ${{ steps.properties.outputs.changelog != '' }}
52+
env:
53+
CHANGELOG: ${{ steps.properties.outputs.changelog }}
54+
run: |
55+
./gradlew patchChangelog --release-note="$CHANGELOG"
56+
57+
# Publish the plugin to the Marketplace
58+
- name: Publish Plugin
59+
env:
60+
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
61+
CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }}
62+
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
63+
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
64+
run: ./gradlew publishPlugin
65+
66+
# Upload artifact as a release asset
67+
- name: Upload Release Asset
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
71+
72+
# Create pull request
73+
- name: Create Pull Request
74+
if: ${{ steps.properties.outputs.changelog != '' }}
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
run: |
78+
VERSION="${{ github.event.release.tag_name }}"
79+
BRANCH="changelog-update-$VERSION"
80+
81+
git config user.email "[email protected]"
82+
git config user.name "GitHub Action"
83+
84+
git checkout -b $BRANCH
85+
git commit -am "Changelog update - $VERSION"
86+
git push --set-upstream origin $BRANCH
87+
88+
gh pr create \
89+
--title "Changelog update - \`$VERSION\`" \
90+
--body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
91+
--base main \
92+
--head $BRANCH

.github/workflows/run-ui-tests.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# GitHub Actions Workflow for launching UI tests on Linux, Windows, and Mac in the following steps:
2+
# - prepare and launch IDE with your plugin and robot-server plugin, which is needed to interact with UI
3+
# - wait for IDE to start
4+
# - run UI tests with separate Gradle task
5+
#
6+
# Please check https://github.com/JetBrains/intellij-ui-test-robot for information about UI tests with IntelliJ Platform
7+
#
8+
# Workflow is triggered manually.
9+
10+
name: Run UI Tests
11+
on:
12+
workflow_dispatch
13+
14+
jobs:
15+
16+
testUI:
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- os: ubuntu-latest
23+
runIde: |
24+
export DISPLAY=:99.0
25+
Xvfb -ac :99 -screen 0 1920x1080x16 &
26+
gradle runIdeForUiTests &
27+
- os: windows-latest
28+
runIde: start gradlew.bat runIdeForUiTests
29+
- os: macos-latest
30+
runIde: ./gradlew runIdeForUiTests &
31+
32+
steps:
33+
34+
# Check out current repository
35+
- name: Fetch Sources
36+
uses: actions/checkout@v3
37+
38+
# Setup Java 11 environment for the next steps
39+
- name: Setup Java
40+
uses: actions/setup-java@v3
41+
with:
42+
distribution: zulu
43+
java-version: 11
44+
45+
# Run IDEA prepared for UI testing
46+
- name: Run IDE
47+
run: ${{ matrix.runIde }}
48+
49+
# Wait for IDEA to be started
50+
- name: Health Check
51+
uses: jtalk/url-health-check-action@v2
52+
with:
53+
url: http://127.0.0.1:8082
54+
max-attempts: 15
55+
retry-delay: 30s
56+
57+
# Run tests
58+
- name: Tests
59+
run: ./gradlew test

.gitignore

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
.gradle
2+
build/
3+
!gradle/wrapper/gradle-wrapper.jar
4+
!**/src/main/**/build/
5+
!**/src/test/**/build/
6+
7+
target/
8+
9+
### STS ###
10+
.apt_generated
11+
.classpath
12+
.factorypath
13+
.project
14+
.settings
15+
.springBeans
16+
.sts4-cache
17+
bin/
18+
!**/src/main/**/bin/
19+
!**/src/test/**/bin/
20+
21+
### IntelliJ IDEA ###
22+
.idea
23+
/.idea/
24+
*.iws
25+
*.iml
26+
*.ipr
27+
out/
28+
!**/src/main/**/out/
29+
!**/src/test/**/out/
30+
31+
### NetBeans ###
32+
/nbproject/private/
33+
/nbbuild/
34+
/dist/
35+
/nbdist/
36+
/.nb-gradle/
37+
38+
### VS Code ###
39+
.vscode/

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!-- Keep a Changelog guide -> https://keepachangelog.com -->
2+
3+
# rideplugin Changelog
4+
5+
## [Unreleased]
6+
### Added
7+
- Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template)

0 commit comments

Comments
 (0)