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.
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
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
- uses : actions/checkout@v3
41
+ uses : actions/checkout@v4
46
42
47
43
# Validate wrapper
48
44
- name : Gradle Wrapper Validation
49
- uses : gradle/wrapper-validation-action@v1.0.5
45
+ uses : gradle/wrapper-validation-action@v2
50
46
51
- # Setup Java 11 environment for the next steps
47
+ # Set up Java environment for the next steps
52
48
- name : Setup Java
53
- uses : actions/setup-java@v3
49
+ uses : actions/setup-java@v4
54
50
with :
55
51
distribution : zulu
56
- java-version : 11
52
+ java-version : 17
53
+
54
+ # Setup Gradle
55
+ - name : Setup Gradle
56
+ uses : gradle/actions/setup-gradle@v3
57
+ with :
58
+ gradle-home-cache-cleanup : true
57
59
58
60
# Set environment variables
59
61
- name : Export Properties
@@ -62,37 +64,20 @@ jobs:
62
64
run : |
63
65
PROPERTIES="$(./gradlew properties --console=plain -q)"
64
66
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
65
- NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
66
67
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
67
- CHANGELOG="${CHANGELOG//'%'/'%25'}"
68
- CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
69
- CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
70
68
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"
69
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
70
+ echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
71
+
72
+ echo "changelog<<EOF" >> $GITHUB_OUTPUT
73
+ echo "$CHANGELOG" >> $GITHUB_OUTPUT
74
+ echo "EOF" >> $GITHUB_OUTPUT
75
75
76
76
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
77
77
78
- # Cache Plugin Verifier IDEs
79
- - name : Setup Plugin Verifier IDEs Cache
80
- uses : actions/cache@v3
81
- with :
82
- path : ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
83
- key : plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
84
-
85
- # Run Verify Plugin task and IntelliJ Plugin Verifier tool
86
- - name : Run Plugin Verification tasks
87
- run : ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
88
-
89
- # Collect Plugin Verifier Result
90
- - name : Collect Plugin Verifier Result
91
- if : ${{ always() }}
92
- uses : actions/upload-artifact@v3
93
- with :
94
- name : pluginVerifier-result
95
- path : ${{ github.workspace }}/build/reports/pluginVerifier
78
+ # Build plugin
79
+ - name : Build plugin
80
+ run : ./gradlew buildPlugin
96
81
97
82
# Prepare plugin archive content for creating artifact
98
83
- name : Prepare Plugin Artifact
@@ -103,31 +88,158 @@ jobs:
103
88
FILENAME=`ls *.zip`
104
89
unzip "$FILENAME" -d content
105
90
106
- echo "::set-output name= filename:: ${FILENAME:0:-4}"
91
+ echo "filename= ${FILENAME:0:-4}" >> $GITHUB_OUTPUT
107
92
108
93
# Store already-built plugin as an artifact for downloading
109
94
- name : Upload artifact
110
- uses : actions/upload-artifact@v3
95
+ uses : actions/upload-artifact@v4
111
96
with :
112
97
name : ${{ steps.artifact.outputs.filename }}
113
98
path : ./build/distributions/content/*/*
114
99
100
+ # Run tests and upload a code coverage report
101
+ test :
102
+ name : Test
103
+ needs : [ build ]
104
+ runs-on : ubuntu-latest
105
+ steps :
106
+
107
+ # Check out current repository
108
+ - name : Fetch Sources
109
+ uses : actions/checkout@v4
110
+
111
+ # Set up Java environment for the next steps
112
+ - name : Setup Java
113
+ uses : actions/setup-java@v4
114
+ with :
115
+ distribution : zulu
116
+ java-version : 17
117
+
118
+ # Setup Gradle
119
+ - name : Setup Gradle
120
+ uses : gradle/actions/setup-gradle@v3
121
+ with :
122
+ gradle-home-cache-cleanup : true
123
+
124
+ # Run tests
125
+ - name : Run Tests
126
+ run : ./gradlew check
127
+
128
+ # Collect Tests Result of failed tests
129
+ - name : Collect Tests Result
130
+ if : ${{ failure() }}
131
+ uses : actions/upload-artifact@v4
132
+ with :
133
+ name : tests-result
134
+ path : ${{ github.workspace }}/build/reports/tests
135
+
136
+ # Upload the Kover report to CodeCov
137
+ - name : Upload Code Coverage Report
138
+ uses : codecov/codecov-action@v4
139
+ with :
140
+ files : ${{ github.workspace }}/build/reports/kover/report.xml
141
+
142
+ # Run Qodana inspections and provide report
143
+ inspectCode :
144
+ name : Inspect code
145
+ needs : [ build ]
146
+ runs-on : ubuntu-latest
147
+ permissions :
148
+ contents : write
149
+ checks : write
150
+ pull-requests : write
151
+ steps :
152
+
153
+ # Free GitHub Actions Environment Disk Space
154
+ - name : Maximize Build Space
155
+ uses : jlumbroso/free-disk-space@main
156
+ with :
157
+ tool-cache : false
158
+ large-packages : false
159
+
160
+ # Check out current repository
161
+ - name : Fetch Sources
162
+ uses : actions/checkout@v4
163
+
164
+ # Set up Java environment for the next steps
165
+ - name : Setup Java
166
+ uses : actions/setup-java@v4
167
+ with :
168
+ distribution : zulu
169
+ java-version : 17
170
+
171
+ # Run Qodana inspections
172
+ - name : Qodana - Code Inspection
173
+
174
+ with :
175
+ cache-default-branch-only : true
176
+
177
+ # Run plugin structure verification along with IntelliJ Plugin Verifier
178
+ verify :
179
+ name : Verify plugin
180
+ needs : [ build ]
181
+ runs-on : ubuntu-latest
182
+ steps :
183
+
184
+ # Free GitHub Actions Environment Disk Space
185
+ - name : Maximize Build Space
186
+ uses : jlumbroso/free-disk-space@main
187
+ with :
188
+ tool-cache : false
189
+ large-packages : false
190
+
191
+ # Check out current repository
192
+ - name : Fetch Sources
193
+ uses : actions/checkout@v4
194
+
195
+ # Set up Java environment for the next steps
196
+ - name : Setup Java
197
+ uses : actions/setup-java@v4
198
+ with :
199
+ distribution : zulu
200
+ java-version : 17
201
+
202
+ # Setup Gradle
203
+ - name : Setup Gradle
204
+ uses : gradle/actions/setup-gradle@v3
205
+ with :
206
+ gradle-home-cache-cleanup : true
207
+
208
+ # Cache Plugin Verifier IDEs
209
+ - name : Setup Plugin Verifier IDEs Cache
210
+ uses : actions/cache@v4
211
+ with :
212
+ path : ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
213
+ key : plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
214
+
215
+ # Run Verify Plugin task and IntelliJ Plugin Verifier tool
216
+ - name : Run Plugin Verification tasks
217
+ run : ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
218
+
219
+ # Collect Plugin Verifier Result
220
+ - name : Collect Plugin Verifier Result
221
+ if : ${{ always() }}
222
+ uses : actions/upload-artifact@v4
223
+ with :
224
+ name : pluginVerifier-result
225
+ path : ${{ github.workspace }}/build/reports/pluginVerifier
226
+
115
227
# Prepare a draft release for GitHub Releases page for the manual verification
116
228
# If accepted and published, release workflow would be triggered
117
229
releaseDraft :
118
- name : Release Draft
230
+ name : Release draft
119
231
if : github.event_name != 'pull_request'
120
- needs : build
232
+ needs : [ build, test, inspectCode, verify ]
121
233
runs-on : ubuntu-latest
122
234
permissions :
123
235
contents : write
124
236
steps :
125
237
126
238
# Check out current repository
127
239
- name : Fetch Sources
128
- uses : actions/checkout@v3
240
+ uses : actions/checkout@v4
129
241
130
- # Remove old release drafts by using the curl request for the available releases with draft flag
242
+ # Remove old release drafts by using the curl request for the available releases with a draft flag
131
243
- name : Remove Old Release Drafts
132
244
env :
133
245
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -136,12 +248,12 @@ jobs:
136
248
--jq '.[] | select(.draft == true) | .id' \
137
249
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
138
250
139
- # Create new release draft - which is not publicly visible and requires manual acceptance
251
+ # Create a new release draft which is not publicly visible and requires manual acceptance
140
252
- name : Create Release Draft
141
253
env :
142
254
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
143
255
run : |
144
- gh release create v${{ needs.build.outputs.version }} \
256
+ gh release create " v${{ needs.build.outputs.version }}" \
145
257
--draft \
146
258
--title "v${{ needs.build.outputs.version }}" \
147
259
--notes "$(cat << 'EOM'
0 commit comments