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.
8
+ #
9
+ # Workflow is triggered on push and pull_request events.
10
+ #
11
+ # GitHub Actions reference: https://help.github.com/en/actions
12
+
1
13
name : Build
2
14
on :
3
15
# Trigger the workflow on pushes to only the 'master', 'support' and 'release' branches
14
26
15
27
jobs :
16
28
17
- # Run Gradle Wrapper Validation Action to verify the wrapper's checksum
18
- # Run verifyPlugin, and IntelliJ Plugin Verifier
19
- # Build plugin and provide the artifact for the next workflow jobs
29
+ # Prepare environment and build the plugin
20
30
build :
21
31
name : Build
22
32
runs-on : ubuntu-latest
23
33
outputs :
24
34
version : ${{ steps.properties.outputs.version }}
25
35
changelog : ${{ steps.changelog.outputs.changelog }}
36
+ pluginVerifierHomeDir : ${{ steps.properties.outputs.pluginVerifierHomeDir }}
26
37
steps :
27
38
28
39
# Free GitHub Actions Environment Disk Space
40
51
- name : Gradle Wrapper Validation
41
52
uses : gradle/wrapper-validation-action@v1.0.6
42
53
43
- # Setup Java 11 environment for the next steps
44
- - name : Setup Java
45
- uses : actions/setup-java@v3.11.0
46
- with :
47
- distribution : zulu
48
- java-version : 11
49
- cache : gradle
54
+ # Setup Gradle
55
+ - name : Setup Gradle
56
+ uses : gradle/gradle-build-action@v2.4.2
50
57
51
58
# Set environment variables
52
59
- name : Export Properties
57
64
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
58
65
NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
59
66
60
- echo "::set-output name= version:: $VERSION"
61
- echo "::set-output name=name:: $NAME"
62
- echo "::set-output name= pluginVerifierHomeDir:: ~/.pluginVerifier"
67
+ echo "version= $VERSION" >> $GITHUB_OUTPUT
68
+ echo "name=$NAME" >> $GITHUB_OUTPUT
69
+ echo "pluginVerifierHomeDir= ~/.pluginVerifier" >> $GITHUB_OUTPUT
63
70
64
71
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
65
72
@@ -78,16 +85,58 @@ jobs:
78
85
echo "$CHANGELOG" >> $GITHUB_OUTPUT
79
86
echo "EOF" >> $GITHUB_OUTPUT
80
87
88
+ # Build plugin
89
+ - name : Build plugin
90
+ run : ./gradlew buildPlugin
91
+
92
+ # Prepare plugin archive content for creating artifact
93
+ - name : Prepare Plugin Artifact
94
+ id : artifact
95
+ shell : bash
96
+ run : |
97
+ cd ${{ github.workspace }}/build/distributions
98
+ FILENAME=`ls *.zip`
99
+ unzip "$FILENAME" -d content
100
+
101
+ echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
102
+
103
+ # Store already-built plugin as an artifact for downloading
104
+ - name : Upload artifact
105
+ uses : actions/upload-artifact@v3.1.2
106
+ with :
107
+ name : ${{ steps.artifact.outputs.filename }}
108
+ path : ./build/distributions/content/*/*
109
+
110
+ # Run plugin structure verification along with IntelliJ Plugin Verifier
111
+ verify :
112
+ name : Verify plugin
113
+ needs : build
114
+ runs-on : ubuntu-latest
115
+ steps :
116
+ # Remove files to save space
117
+ - name : Remove unnecessary files
118
+ run : |
119
+ sudo rm -rf /usr/share/dotnet
120
+ sudo rm -rf "$AGENT_TOOLSDIRECTORY"
121
+
122
+ # Check out current repository
123
+ - name : Fetch Sources
124
+ uses : actions/checkout@v3.5.3
125
+
126
+ # Setup Gradle
127
+ - name : Setup Gradle
128
+ uses : gradle/gradle-build-action@v2.4.2
129
+
81
130
# Cache Plugin Verifier IDEs
82
131
- name : Setup Plugin Verifier IDEs Cache
83
132
uses : actions/cache@v3.3.1
84
133
with :
85
- path : ${{ steps.properties .outputs.pluginVerifierHomeDir }}/ides
134
+ path : ${{ needs.build .outputs.pluginVerifierHomeDir }}/ides
86
135
key : plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
87
136
88
137
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
89
138
- name : Run Plugin Verification tasks
90
- run : ./gradlew runPluginVerifier -Pplugin .verifier.home.dir=${{ steps.properties .outputs.pluginVerifierHomeDir }}
139
+ run : ./gradlew runPluginVerifier -Dplugin .verifier.home.dir=${{ needs.build .outputs.pluginVerifierHomeDir }}
91
140
92
141
# Collect Plugin Verifier Result
93
142
- name : Collect Plugin Verifier Result
@@ -97,38 +146,44 @@ jobs:
97
146
name : pluginVerifier-result
98
147
path : ${{ github.workspace }}/build/reports/pluginVerifier
99
148
100
- # Prepare plugin archive content for creating artifact
101
- - name : Prepare Plugin Artifact
102
- id : artifact
103
- shell : bash
104
- run : |
105
- cd ${{ github.workspace }}/build/distributions
106
- FILENAME=`ls *.zip`
107
- unzip "$FILENAME" -d content
108
-
109
- echo "::set-output name=filename::${FILENAME:0:-4}"
149
+ # Run Qodana inspections and provide report
150
+ inspectCode :
151
+ name : Inspect code
152
+ needs : build
153
+ runs-on : ubuntu-latest
154
+ permissions :
155
+ contents : write
156
+ checks : write
157
+ pull-requests : write
158
+ steps :
110
159
111
- # Store already-built plugin as an artifact for downloading
112
- - name : Upload artifact
113
- uses : actions/upload-artifact@v3.1.2
160
+ # Check out current repository
161
+ - name : Fetch Sources
162
+ uses : actions/checkout@v3.5.3
163
+
164
+ # Run Qodana inspections
165
+ - name : Qodana - Code Inspection
166
+ if : ${{ github.actor != 'dependabot[bot]' }}
167
+ uses : JetBrains/qodana-action@v2023.1.5
114
168
with :
115
- name : ${{ steps.artifact.outputs.filename }}
116
- path : ./build/distributions/content/*/*
169
+ cache-default-branch-only : true
117
170
118
171
# Prepare a draft release for GitHub Releases page for the manual verification
119
172
# If accepted and published, release workflow would be triggered
120
173
releaseDraft :
121
- name : Release Draft
174
+ name : Release draft
122
175
if : github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/support/')
123
- needs : build
176
+ needs : [ build, verify, inspectCode ]
124
177
runs-on : ubuntu-latest
178
+ permissions :
179
+ contents : write
125
180
steps :
126
181
127
182
# Check out current repository
128
183
- name : Fetch Sources
129
184
uses : actions/checkout@v3.5.2
130
185
131
- # Remove old release drafts by using the curl request for the available releases with draft flag
186
+ # Remove old release drafts by using the curl request for the available releases with a draft flag
132
187
- name : Remove Old Release Drafts
133
188
env :
134
189
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -137,7 +192,7 @@ jobs:
137
192
--jq '.[] | select(.draft == true) | .id' \
138
193
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
139
194
140
- # Create new release draft - which is not publicly visible and requires manual acceptance
195
+ # Create a new release draft which is not publicly visible and requires manual acceptance
141
196
- name : Create Release Draft
142
197
env :
143
198
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -150,7 +205,6 @@ jobs:
150
205
EOM
151
206
)"
152
207
153
-
154
208
concurrency :
155
209
group : ${{ github.workflow }}-${{ github.ref }}
156
210
cancel-in-progress : true
0 commit comments