1
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 '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.
8
8
#
9
- # Workflow is triggered on push and pull_request events.
9
+ # The workflow is triggered on push and pull_request events.
10
10
#
11
11
# GitHub Actions reference: https://help.github.com/en/actions
12
12
#
13
13
# # JBIJPPTPL
14
14
15
15
name : Build
16
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)
17
+ # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests)
18
18
push :
19
- branches : [main]
19
+ branches : [ main ]
20
20
# Trigger the workflow on any pull request
21
21
pull_request :
22
22
23
+ concurrency :
24
+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
25
+ cancel-in-progress : true
26
+
23
27
jobs :
24
28
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
28
30
build :
29
31
name : Build
30
32
runs-on : ubuntu-latest
31
33
outputs :
32
34
version : ${{ steps.properties.outputs.version }}
33
35
changelog : ${{ steps.properties.outputs.changelog }}
36
+ pluginVerifierHomeDir : ${{ steps.properties.outputs.pluginVerifierHomeDir }}
34
37
steps :
35
38
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
39
# Check out current repository
44
40
- name : Fetch Sources
45
41
uses : actions/checkout@v4
48
44
- name : Gradle Wrapper Validation
49
45
50
46
51
- # Setup Java 17 environment for the next steps
47
+ # Set up Java environment for the next steps
52
48
- name : Setup Java
53
49
uses : actions/setup-java@v4
54
50
with :
@@ -63,65 +59,33 @@ jobs:
63
59
restore-keys : |
64
60
${{ runner.os }}-pip-
65
61
62
+ # Setup Gradle
63
+ - name : Setup Gradle
64
+ uses : gradle/actions/setup-gradle@v3
65
+ with :
66
+ gradle-home-cache-cleanup : true
67
+
66
68
# Set environment variables
67
69
- name : Export Properties
68
70
id : properties
69
71
shell : bash
70
72
run : |
71
73
PROPERTIES="$(./gradlew properties --console=plain -q)"
72
74
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
73
- NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
74
75
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
76
+
75
77
echo "version=$VERSION" >> $GITHUB_OUTPUT
76
- echo "name=$NAME" >> $GITHUB_OUTPUT
77
78
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
78
79
79
80
echo "changelog<<EOF" >> $GITHUB_OUTPUT
80
81
echo "$CHANGELOG" >> $GITHUB_OUTPUT
81
82
echo "EOF" >> $GITHUB_OUTPUT
82
- ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
83
83
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
121
85
122
- # Run Qodana inspections
123
- - name : Qodana - Code Inspection
124
-
86
+ # Build plugin
87
+ - name : Build plugin
88
+ run : ./gradlew buildPlugin
125
89
126
90
# Prepare plugin archive content for creating artifact
127
91
- name : Prepare Plugin Artifact
@@ -131,9 +95,11 @@ jobs:
131
95
cd ${{ github.workspace }}/build/distributions
132
96
FILENAME=`ls *.zip`
133
97
unzip "$FILENAME" -d content
98
+
134
99
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
100
+
135
101
# Store already-built plugin as an artifact for downloading
136
- - name : Upload Artifact
102
+ - name : Upload artifact
137
103
uses : actions/upload-artifact@v4
138
104
with :
139
105
name : ${{ steps.artifact.outputs.filename }}
@@ -153,13 +119,139 @@ jobs:
153
119
cp CHANGELOG.md docs
154
120
mkdocs build --verbose --clean --strict
155
121
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
+
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
156
248
157
249
# Prepare a draft release for GitHub Releases page for the manual verification
158
250
# If accepted and published, release workflow would be triggered
159
251
releaseDraft :
160
- name : Release Draft
252
+ name : Release draft
161
253
if : github.event_name != 'pull_request'
162
- needs : build
254
+ needs : [ build, test, inspectCode, verify ]
163
255
runs-on : ubuntu-latest
164
256
permissions :
165
257
contents : write
@@ -169,6 +261,13 @@ jobs:
169
261
- name : Fetch Sources
170
262
uses : actions/checkout@v4
171
263
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
+
172
271
# Remove old release drafts by using the curl request for the available releases with a draft flag
173
272
- name : Remove Old Release Drafts
174
273
env :
@@ -177,12 +276,13 @@ jobs:
177
276
gh api repos/{owner}/{repo}/releases \
178
277
--jq '.[] | select(.draft == true) | .id' \
179
278
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
279
+
180
280
# Create a new release draft which is not publicly visible and requires manual acceptance
181
281
- name : Create Release Draft
182
282
env :
183
283
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
184
284
run : |
185
- gh release create v${{ needs.build.outputs.version }} \
285
+ gh release create " v${{ needs.build.outputs.version }}" \
186
286
--draft \
187
287
--title "v${{ needs.build.outputs.version }}" \
188
288
--notes "$(cat << 'EOM'
0 commit comments