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