Skip to content

Commit 7893cb5

Browse files
committed
feat: initial working version
0 parents  commit 7893cb5

27 files changed

Lines changed: 1327 additions & 0 deletions

.github/workflows/build.yml

Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps:
2+
# - Validate Gradle Wrapper.
3+
# - Run 'test' and 'verifyPlugin' tasks.
4+
# - Run Qodana inspections.
5+
# - Run the 'buildPlugin' task and prepare artifact for further tests.
6+
# - Run the 'runPluginVerifier' task.
7+
# - Create a draft release.
8+
#
9+
# The 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: [ main ]
20+
# Trigger the workflow on any pull request
21+
pull_request:
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
29+
# Prepare environment and build the plugin
30+
build:
31+
name: Build
32+
runs-on: ubuntu-latest
33+
outputs:
34+
version: ${{ steps.properties.outputs.version }}
35+
changelog: ${{ steps.properties.outputs.changelog }}
36+
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
37+
steps:
38+
39+
# Check out the current repository
40+
- name: Fetch Sources
41+
uses: actions/checkout@v4
42+
43+
# Set up Java environment for the next steps
44+
- name: Setup Java
45+
uses: actions/setup-java@v4
46+
with:
47+
distribution: zulu
48+
java-version: 21
49+
50+
# Setup Gradle
51+
- name: Setup Gradle
52+
uses: gradle/actions/setup-gradle@v4
53+
54+
# Set environment variables
55+
- name: Export Properties
56+
id: properties
57+
shell: bash
58+
run: |
59+
PROPERTIES="$(./gradlew properties --console=plain -q)"
60+
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
61+
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
62+
63+
echo "version=$VERSION" >> $GITHUB_OUTPUT
64+
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
65+
66+
echo "changelog<<EOF" >> $GITHUB_OUTPUT
67+
echo "$CHANGELOG" >> $GITHUB_OUTPUT
68+
echo "EOF" >> $GITHUB_OUTPUT
69+
70+
# Build plugin
71+
- name: Build plugin
72+
run: ./gradlew buildPlugin
73+
74+
# Prepare plugin archive content for creating artifact
75+
- name: Prepare Plugin Artifact
76+
id: artifact
77+
shell: bash
78+
run: |
79+
cd ${{ github.workspace }}/build/distributions
80+
FILENAME=`ls *.zip`
81+
unzip "$FILENAME" -d content
82+
83+
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
84+
85+
# Store already-built plugin as an artifact for downloading
86+
- name: Upload artifact
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: ${{ steps.artifact.outputs.filename }}
90+
path: ./build/distributions/content/*/*
91+
92+
# Run tests and upload a code coverage report
93+
test:
94+
name: Test
95+
needs: [ build ]
96+
runs-on: ubuntu-latest
97+
steps:
98+
99+
# Check out the current repository
100+
- name: Fetch Sources
101+
uses: actions/checkout@v4
102+
103+
# Set up Java environment for the next steps
104+
- name: Setup Java
105+
uses: actions/setup-java@v4
106+
with:
107+
distribution: zulu
108+
java-version: 21
109+
110+
# Setup Gradle
111+
- name: Setup Gradle
112+
uses: gradle/actions/setup-gradle@v4
113+
114+
# Run tests
115+
- name: Run Tests
116+
run: ./gradlew check
117+
118+
# Collect Tests Result of failed tests
119+
- name: Collect Tests Result
120+
if: ${{ failure() }}
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: tests-result
124+
path: ${{ github.workspace }}/build/reports/tests
125+
126+
# Upload the Kover report to CodeCov
127+
- name: Upload Code Coverage Report
128+
uses: codecov/codecov-action@v5
129+
with:
130+
files: ${{ github.workspace }}/build/reports/kover/report.xml
131+
132+
# Run Qodana inspections and provide report
133+
inspectCode:
134+
name: Inspect code
135+
needs: [ build ]
136+
runs-on: ubuntu-latest
137+
permissions:
138+
contents: write
139+
checks: write
140+
pull-requests: write
141+
steps:
142+
143+
# Free GitHub Actions Environment Disk Space
144+
- name: Maximize Build Space
145+
uses: jlumbroso/free-disk-space@main
146+
with:
147+
tool-cache: false
148+
large-packages: false
149+
150+
# Check out the current repository
151+
- name: Fetch Sources
152+
uses: actions/checkout@v4
153+
with:
154+
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
155+
fetch-depth: 0 # a full history is required for pull request analysis
156+
157+
# Set up Java environment for the next steps
158+
- name: Setup Java
159+
uses: actions/setup-java@v4
160+
with:
161+
distribution: zulu
162+
java-version: 21
163+
164+
# Run Qodana inspections
165+
- name: Qodana - Code Inspection
166+
uses: JetBrains/qodana-action@v2024.2
167+
with:
168+
cache-default-branch-only: true
169+
170+
# Run plugin structure verification along with IntelliJ Plugin Verifier
171+
verify:
172+
name: Verify plugin
173+
needs: [ build ]
174+
runs-on: ubuntu-latest
175+
steps:
176+
177+
# Free GitHub Actions Environment Disk Space
178+
- name: Maximize Build Space
179+
uses: jlumbroso/free-disk-space@main
180+
with:
181+
tool-cache: false
182+
large-packages: false
183+
184+
# Check out the current repository
185+
- name: Fetch Sources
186+
uses: actions/checkout@v4
187+
188+
# Set up Java environment for the next steps
189+
- name: Setup Java
190+
uses: actions/setup-java@v4
191+
with:
192+
distribution: zulu
193+
java-version: 21
194+
195+
# Setup Gradle
196+
- name: Setup Gradle
197+
uses: gradle/actions/setup-gradle@v4
198+
199+
# Cache Plugin Verifier IDEs
200+
- name: Setup Plugin Verifier IDEs Cache
201+
uses: actions/cache@v4
202+
with:
203+
path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
204+
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
205+
206+
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
207+
- name: Run Plugin Verification tasks
208+
run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
209+
210+
# Collect Plugin Verifier Result
211+
- name: Collect Plugin Verifier Result
212+
if: ${{ always() }}
213+
uses: actions/upload-artifact@v4
214+
with:
215+
name: pluginVerifier-result
216+
path: ${{ github.workspace }}/build/reports/pluginVerifier
217+
218+
# Prepare a draft release for GitHub Releases page for the manual verification
219+
# If accepted and published, release workflow would be triggered
220+
releaseDraft:
221+
name: Release draft
222+
if: github.event_name != 'pull_request'
223+
needs: [ build, test, inspectCode, verify ]
224+
runs-on: ubuntu-latest
225+
permissions:
226+
contents: write
227+
steps:
228+
229+
# Check out the current repository
230+
- name: Fetch Sources
231+
uses: actions/checkout@v4
232+
233+
# Remove old release drafts by using the curl request for the available releases with a draft flag
234+
- name: Remove Old Release Drafts
235+
env:
236+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
237+
run: |
238+
gh api repos/{owner}/{repo}/releases \
239+
--jq '.[] | select(.draft == true) | .id' \
240+
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
241+
242+
# Create a new release draft which is not publicly visible and requires manual acceptance
243+
- name: Create Release Draft
244+
env:
245+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
246+
run: |
247+
gh release create "v${{ needs.build.outputs.version }}" \
248+
--draft \
249+
--title "v${{ needs.build.outputs.version }}" \
250+
--notes "$(cat << 'EOM'
251+
${{ needs.build.outputs.changelog }}
252+
EOM
253+
)"
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# GitHub Actions Workflow created for handling the release process based on the draft release prepared with the Build workflow.
2+
# Running the publishPlugin task requires all following secrets to be provided: PUBLISH_TOKEN, PRIVATE_KEY, PRIVATE_KEY_PASSWORD, CERTIFICATE_CHAIN.
3+
# See https://plugins.jetbrains.com/docs/intellij/plugin-signing.html for more information.
4+
5+
name: Continuous Release
6+
on:
7+
push:
8+
branches:
9+
- master
10+
11+
jobs:
12+
release:
13+
name: Publish Plugin
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
steps:
19+
- name: Fetch Sources
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0 # Required to get all history for versioning
23+
24+
- name: Setup Java
25+
uses: actions/setup-java@v4
26+
with:
27+
distribution: zulu
28+
java-version: 21
29+
30+
- name: Setup Gradle
31+
uses: gradle/actions/setup-gradle@v4
32+
33+
- name: Get current version
34+
id: get_version
35+
run: |
36+
CURRENT_VERSION=$(grep 'pluginVersion' gradle.properties | cut -d'=' -f2 | tr -d '[:space:]')
37+
echo "Current version: $CURRENT_VERSION"
38+
MAJOR=$(echo $CURRENT_VERSION | cut -d'.' -f1)
39+
MINOR=$(echo $CURRENT_VERSION | cut -d'.' -f2)
40+
PATCH=$(echo $CURRENT_VERSION | cut -d'.' -f3)
41+
NEW_PATCH=$((PATCH + 1))
42+
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
43+
echo "New version: $NEW_VERSION"
44+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
45+
46+
- name: Update plugin version in gradle.properties
47+
run: |
48+
sed -i "s/^pluginVersion = .*/pluginVersion = ${{ env.NEW_VERSION }}/" gradle.properties
49+
cat gradle.properties
50+
51+
- name: Commit and Push new version
52+
run: |
53+
git config user.email "action@github.com"
54+
git config user.name "GitHub Action"
55+
git add gradle.properties
56+
git commit -m "Bump version to ${{ env.NEW_VERSION }} [skip ci]"
57+
git push
58+
59+
- name: Publish Plugin
60+
env:
61+
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
62+
CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }}
63+
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
64+
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
65+
run: ./gradlew publishPlugin
66+
67+
- name: Create GitHub Release
68+
uses: softprops/action-gh-release@v1
69+
with:
70+
tag_name: v${{ env.NEW_VERSION }}
71+
name: Release v${{ env.NEW_VERSION }}
72+
body: |
73+
Automated release for version ${{ env.NEW_VERSION }}.
74+
See CHANGELOG.md for details.
75+
files: |
76+
./build/distributions/*.zip
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.gradle
2+
.idea
3+
.intellijPlatform
4+
.qodana
5+
build

.run/Run Plugin.run.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run Plugin" type="GradleRunConfiguration" factoryName="Gradle">
3+
<log_file alias="IDE logs" path="$PROJECT_DIR$/build/idea-sandbox/*/log/idea.log" show_all="true" />
4+
<ExternalSystemSettings>
5+
<option name="executionName" />
6+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
7+
<option name="externalSystemIdString" value="GRADLE" />
8+
<option name="scriptParameters" value="" />
9+
<option name="taskDescriptions">
10+
<list />
11+
</option>
12+
<option name="taskNames">
13+
<list>
14+
<option value="runIde" />
15+
</list>
16+
</option>
17+
<option name="vmOptions" value="" />
18+
</ExternalSystemSettings>
19+
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
20+
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
21+
<DebugAllEnabled>false</DebugAllEnabled>
22+
<RunAsTest>false</RunAsTest>
23+
<method v="2" />
24+
</configuration>
25+
</component>

.run/Run Tests.run.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run Tests" type="GradleRunConfiguration" factoryName="Gradle">
3+
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
4+
<ExternalSystemSettings>
5+
<option name="executionName" />
6+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
7+
<option name="externalSystemIdString" value="GRADLE" />
8+
<option name="scriptParameters" value="" />
9+
<option name="taskDescriptions">
10+
<list />
11+
</option>
12+
<option name="taskNames">
13+
<list>
14+
<option value="check" />
15+
</list>
16+
</option>
17+
<option name="vmOptions" value="" />
18+
</ExternalSystemSettings>
19+
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
20+
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
21+
<DebugAllEnabled>false</DebugAllEnabled>
22+
<RunAsTest>true</RunAsTest>
23+
<method v="2" />
24+
</configuration>
25+
</component>

0 commit comments

Comments
 (0)