Skip to content

Commit 01769eb

Browse files
committed
sync changes from template
1 parent bf540dd commit 01769eb

17 files changed

+309
-151
lines changed

.github/workflows/build.yml

+167-67
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,41 @@
11
# 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 'buildPlugin' task and prepare artifact for the further tests,
6-
# - run 'runPluginVerifier' task,
7-
# - create a draft release.
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.
88
#
9-
# Workflow is triggered on push and pull_request events.
9+
# The workflow is triggered on push and pull_request events.
1010
#
1111
# GitHub Actions reference: https://help.github.com/en/actions
1212
#
1313
## JBIJPPTPL
1414

1515
name: Build
1616
on:
17-
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests)
17+
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests)
1818
push:
19-
branches: [main]
19+
branches: [ main ]
2020
# Trigger the workflow on any pull request
2121
pull_request:
2222

23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
25+
cancel-in-progress: true
26+
2327
jobs:
2428

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
29+
# Prepare environment and build the plugin
2830
build:
2931
name: Build
3032
runs-on: ubuntu-latest
3133
outputs:
3234
version: ${{ steps.properties.outputs.version }}
3335
changelog: ${{ steps.properties.outputs.changelog }}
36+
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
3437
steps:
3538

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-
4339
# Check out current repository
4440
- name: Fetch Sources
4541
uses: actions/checkout@v4
@@ -48,7 +44,7 @@ jobs:
4844
- name: Gradle Wrapper Validation
4945
uses: gradle/[email protected]
5046

51-
# Setup Java 17 environment for the next steps
47+
# Set up Java environment for the next steps
5248
- name: Setup Java
5349
uses: actions/setup-java@v4
5450
with:
@@ -63,65 +59,33 @@ jobs:
6359
restore-keys: |
6460
${{ runner.os }}-pip-
6561
62+
# Setup Gradle
63+
- name: Setup Gradle
64+
uses: gradle/actions/setup-gradle@v3
65+
with:
66+
gradle-home-cache-cleanup: true
67+
6668
# Set environment variables
6769
- name: Export Properties
6870
id: properties
6971
shell: bash
7072
run: |
7173
PROPERTIES="$(./gradlew properties --console=plain -q)"
7274
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
73-
NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
7475
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
76+
7577
echo "version=$VERSION" >> $GITHUB_OUTPUT
76-
echo "name=$NAME" >> $GITHUB_OUTPUT
7778
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
7879
7980
echo "changelog<<EOF" >> $GITHUB_OUTPUT
8081
echo "$CHANGELOG" >> $GITHUB_OUTPUT
8182
echo "EOF" >> $GITHUB_OUTPUT
82-
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
8383
84-
# Run tests
85-
- name: Run Tests
86-
run: ./gradlew check
87-
88-
# Collect Tests Result of failed tests
89-
- name: Collect Tests Result
90-
if: ${{ failure() }}
91-
uses: actions/upload-artifact@v4
92-
with:
93-
name: tests-result
94-
path: ${{ github.workspace }}/build/reports/tests
95-
96-
# Upload Kover report to CodeCov
97-
#- name: Upload Code Coverage Report
98-
# uses: codecov/codecov-action@v3
99-
# with:
100-
# files: ${{ github.workspace }}/build/reports/kover/xml/report.xml
101-
# fail_ci_if_error: true
102-
103-
# Cache Plugin Verifier IDEs
104-
- name: Setup Plugin Verifier IDEs Cache
105-
uses: actions/cache@v4
106-
with:
107-
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
108-
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
109-
110-
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
111-
- name: Run Plugin Verification tasks
112-
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
113-
114-
# Collect Plugin Verifier Result
115-
- name: Collect Plugin Verifier Result
116-
if: ${{ always() }}
117-
uses: actions/upload-artifact@v4
118-
with:
119-
name: pluginVerifier-result
120-
path: ${{ github.workspace }}/build/reports/pluginVerifier
84+
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
12185
122-
# Run Qodana inspections
123-
- name: Qodana - Code Inspection
124-
uses: JetBrains/[email protected]
86+
# Build plugin
87+
- name: Build plugin
88+
run: ./gradlew buildPlugin
12589

12690
# Prepare plugin archive content for creating artifact
12791
- name: Prepare Plugin Artifact
@@ -131,9 +95,11 @@ jobs:
13195
cd ${{ github.workspace }}/build/distributions
13296
FILENAME=`ls *.zip`
13397
unzip "$FILENAME" -d content
98+
13499
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
100+
135101
# Store already-built plugin as an artifact for downloading
136-
- name: Upload Artifact
102+
- name: Upload artifact
137103
uses: actions/upload-artifact@v4
138104
with:
139105
name: ${{ steps.artifact.outputs.filename }}
@@ -153,13 +119,139 @@ jobs:
153119
cp CHANGELOG.md docs
154120
mkdocs build --verbose --clean --strict
155121
122+
# Run tests and upload a code coverage report
123+
test:
124+
name: Test
125+
needs: [ build ]
126+
runs-on: ubuntu-latest
127+
steps:
128+
129+
# Check out current repository
130+
- name: Fetch Sources
131+
uses: actions/checkout@v4
132+
133+
# Set up Java environment for the next steps
134+
- name: Setup Java
135+
uses: actions/setup-java@v4
136+
with:
137+
distribution: zulu
138+
java-version: 17
139+
140+
# Setup Gradle
141+
- name: Setup Gradle
142+
uses: gradle/actions/setup-gradle@v3
143+
with:
144+
gradle-home-cache-cleanup: true
145+
146+
# Run tests
147+
- name: Run Tests
148+
run: ./gradlew check
149+
150+
# Collect Tests Result of failed tests
151+
- name: Collect Tests Result
152+
if: ${{ failure() }}
153+
uses: actions/upload-artifact@v4
154+
with:
155+
name: tests-result
156+
path: ${{ github.workspace }}/build/reports/tests
157+
158+
# Upload the Kover report to CodeCov
159+
# - name: Upload Code Coverage Report
160+
# uses: codecov/codecov-action@v3
161+
# with:
162+
# files: ${{ github.workspace }}/build/reports/kover/report.xml
163+
164+
# Run Qodana inspections and provide report
165+
inspectCode:
166+
name: Inspect code
167+
needs: [ build ]
168+
runs-on: ubuntu-latest
169+
permissions:
170+
contents: write
171+
checks: write
172+
pull-requests: write
173+
steps:
174+
175+
# Free GitHub Actions Environment Disk Space
176+
- name: Maximize Build Space
177+
uses: jlumbroso/free-disk-space@main
178+
with:
179+
tool-cache: false
180+
large-packages: false
181+
182+
# Check out current repository
183+
- name: Fetch Sources
184+
uses: actions/checkout@v4
185+
186+
# Set up Java environment for the next steps
187+
- name: Setup Java
188+
uses: actions/setup-java@v4
189+
with:
190+
distribution: zulu
191+
java-version: 17
192+
193+
# Run Qodana inspections
194+
- name: Qodana - Code Inspection
195+
uses: JetBrains/[email protected]
196+
with:
197+
cache-default-branch-only: true
198+
199+
# Run plugin structure verification along with IntelliJ Plugin Verifier
200+
verify:
201+
name: Verify plugin
202+
needs: [ build ]
203+
runs-on: ubuntu-latest
204+
steps:
205+
206+
# Free GitHub Actions Environment Disk Space
207+
- name: Maximize Build Space
208+
uses: jlumbroso/free-disk-space@main
209+
with:
210+
tool-cache: false
211+
large-packages: false
212+
213+
# Check out current repository
214+
- name: Fetch Sources
215+
uses: actions/checkout@v4
216+
217+
# Set up Java environment for the next steps
218+
- name: Setup Java
219+
uses: actions/setup-java@v4
220+
with:
221+
distribution: zulu
222+
java-version: 17
223+
224+
# Setup Gradle
225+
- name: Setup Gradle
226+
uses: gradle/actions/setup-gradle@v3
227+
with:
228+
gradle-home-cache-cleanup: true
229+
230+
# Cache Plugin Verifier IDEs
231+
- name: Setup Plugin Verifier IDEs Cache
232+
uses: actions/cache@v4
233+
with:
234+
path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
235+
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
236+
237+
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
238+
- name: Run Plugin Verification tasks
239+
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
240+
241+
# Collect Plugin Verifier Result
242+
- name: Collect Plugin Verifier Result
243+
if: ${{ always() }}
244+
uses: actions/upload-artifact@v4
245+
with:
246+
name: pluginVerifier-result
247+
path: ${{ github.workspace }}/build/reports/pluginVerifier
156248

157249
# Prepare a draft release for GitHub Releases page for the manual verification
158250
# If accepted and published, release workflow would be triggered
159251
releaseDraft:
160-
name: Release Draft
252+
name: Release draft
161253
if: github.event_name != 'pull_request'
162-
needs: build
254+
needs: [ build, test, inspectCode, verify ]
163255
runs-on: ubuntu-latest
164256
permissions:
165257
contents: write
@@ -169,6 +261,13 @@ jobs:
169261
- name: Fetch Sources
170262
uses: actions/checkout@v4
171263

264+
# Set up Java environment for the next steps
265+
- name: Setup Java
266+
uses: actions/setup-java@v4
267+
with:
268+
distribution: zulu
269+
java-version: 17
270+
172271
# Remove old release drafts by using the curl request for the available releases with a draft flag
173272
- name: Remove Old Release Drafts
174273
env:
@@ -177,12 +276,13 @@ jobs:
177276
gh api repos/{owner}/{repo}/releases \
178277
--jq '.[] | select(.draft == true) | .id' \
179278
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
279+
180280
# Create a new release draft which is not publicly visible and requires manual acceptance
181281
- name: Create Release Draft
182282
env:
183283
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
184284
run: |
185-
gh release create v${{ needs.build.outputs.version }} \
285+
gh release create "v${{ needs.build.outputs.version }}" \
186286
--draft \
187287
--title "v${{ needs.build.outputs.version }}" \
188288
--notes "$(cat << 'EOM'

.github/workflows/release.yml

+11-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111

12-
# Prepare and publish the plugin to the Marketplace repository
12+
# Prepare and publish the plugin to JetBrains Marketplace repository
1313
release:
1414
name: Publish Plugin
1515
runs-on: ubuntu-latest
@@ -24,13 +24,19 @@ jobs:
2424
with:
2525
ref: ${{ github.event.release.tag_name }}
2626

27-
# Setup Java 17 environment for the next steps
27+
# Set up Java environment for the next steps
2828
- name: Setup Java
2929
uses: actions/setup-java@v4
3030
with:
3131
distribution: zulu
3232
java-version: 17
3333

34+
# Setup Gradle
35+
- name: Setup Gradle
36+
uses: gradle/actions/setup-gradle@v3
37+
with:
38+
gradle-home-cache-cleanup: true
39+
3440
# Set environment variables
3541
- name: Export Properties
3642
id: properties
@@ -53,7 +59,7 @@ jobs:
5359
run: |
5460
./gradlew patchChangelog --release-note="$CHANGELOG"
5561
56-
# Publish the plugin to the Marketplace
62+
# Publish the plugin to JetBrains Marketplace
5763
- name: Publish Plugin
5864
env:
5965
JETBRAINS_TOKEN: ${{ secrets.JETBRAINS_TOKEN }}
@@ -68,7 +74,7 @@ jobs:
6874
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6975
run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
7076

71-
# Create pull request
77+
# Create a pull request
7278
- name: Create Pull Request
7379
if: ${{ steps.properties.outputs.changelog != '' }}
7480
env:
@@ -87,6 +93,7 @@ jobs:
8793
8894
gh label create "$LABEL" \
8995
--description "Pull requests with release changelog update" \
96+
--force \
9097
|| true
9198
9299
gh pr create \

0 commit comments

Comments
 (0)