11name : Build
22on :
3- # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests)
3+ # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests)
44 push :
55 branches : [ main ]
66 paths :
2525
2626jobs :
2727
28- # Run Gradle Wrapper Validation Action to verify the wrapper's checksum
29- # Run verifyPlugin, IntelliJ Plugin Verifier, and test Gradle tasks
30- # Build plugin and provide the artifact for the next workflow jobs
28+ # Prepare environment and build the plugin
3129 build :
3230 name : Build
3331 runs-on : ubuntu-latest
3432 outputs :
3533 version : ${{ steps.properties.outputs.version }}
3634 changelog : ${{ steps.properties.outputs.changelog }}
35+ pluginVerifierHomeDir : ${{ steps.properties.outputs.pluginVerifierHomeDir }}
3736 steps :
3837
39- # Free GitHub Actions Environment Disk Space
40- - name : Maximize Build Space
41- run : |
42- sudo rm -rf /usr/share/dotnet
43- sudo rm -rf /usr/local/lib/android
44- sudo rm -rf /opt/ghc
4538 # Check out current repository
4639 - name : Fetch Sources
47- uses : actions/checkout@v3
40+ uses : actions/checkout@v4
4841
4942 # Validate wrapper
5043 - name : Gradle Wrapper Validation
51- uses : gradle/wrapper-validation-action@v1.0.5
44+ uses : gradle/wrapper-validation-action@v1.1.0
5245
53- # Setup Java 11 environment for the next steps
46+ # Set up Java environment for the next steps
5447 - name : Setup Java
55- uses : actions/setup-java@v3
48+ uses : actions/setup-java@v4
5649 with :
5750 distribution : zulu
58- java-version : 11
51+ java-version : 17
52+
53+ # Setup Gradle
54+ - name : Setup Gradle
55+ uses : gradle/gradle-build-action@v2
56+ with :
57+ gradle-home-cache-cleanup : true
5958
6059 # Set environment variables
6160 - name : Export Properties
@@ -64,39 +63,116 @@ jobs:
6463 run : |
6564 PROPERTIES="$(./gradlew properties --console=plain -q)"
6665 VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
67- NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
6866 CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
67+
6968 echo "version=$VERSION" >> $GITHUB_OUTPUT
70- echo "name=$NAME" >> $GITHUB_OUTPUT
7169 echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
7270
7371 echo "changelog<<EOF" >> $GITHUB_OUTPUT
7472 echo "$CHANGELOG" >> $GITHUB_OUTPUT
7573 echo "EOF" >> $GITHUB_OUTPUT
74+
7675 ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
7776
78- # Run tests
79- - name : Run Tests
80- run : ./gradlew check
77+ # Build plugin
78+ - name : Build plugin
79+ run : ./gradlew buildPlugin
8180
82- # Collect Tests Result of failed tests
83- - name : Collect Tests Result
84- if : ${{ failure() }}
81+ # Prepare plugin archive content for creating artifact
82+ - name : Prepare Plugin Artifact
83+ id : artifact
84+ shell : bash
85+ run : |
86+ cd ${{ github.workspace }}/build/distributions
87+ FILENAME=`ls *.zip`
88+ unzip "$FILENAME" -d content
89+
90+ echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
91+
92+ # Store already-built plugin as an artifact for downloading
93+ - name : Upload artifact
8594 uses : actions/upload-artifact@v3
8695 with :
87- name : tests-result
88- path : ${{ github.workspace }}/build/reports/tests
96+ name : ${{ steps.artifact.outputs.filename }}
97+ path : ./build/distributions/content/*/*
98+
99+ # Run tests and upload a code coverage report
100+ test :
101+ name : Test
102+ needs : [ build ]
103+ runs-on : ubuntu-latest
104+ steps :
105+
106+ # Check out current repository
107+ - name : Fetch Sources
108+ uses : actions/checkout@v4
109+
110+ # Set up Java environment for the next steps
111+ - name : Setup Java
112+ uses : actions/setup-java@v4
113+ with :
114+ distribution : zulu
115+ java-version : 17
116+
117+ # Setup Gradle
118+ - name : Setup Gradle
119+ uses : gradle/gradle-build-action@v2
120+ with :
121+ gradle-home-cache-cleanup : true
122+
123+ # Run tests
124+ - name : Run Tests
125+ run : ./gradlew check
126+
127+ # Collect Tests Result of failed tests
128+ - name : Collect Tests Result
129+ if : ${{ failure() }}
130+ uses : actions/upload-artifact@v3
131+ with :
132+ name : tests-result
133+ path : ${{ github.workspace }}/build/reports/tests
134+
135+ # Run plugin structure verification along with IntelliJ Plugin Verifier
136+ verify :
137+ name : Verify plugin
138+ needs : [ build ]
139+ runs-on : ubuntu-latest
140+ steps :
141+
142+ # Free GitHub Actions Environment Disk Space
143+ - name : Maximize Build Space
144+ uses : jlumbroso/free-disk-space@main
145+ with :
146+ tool-cache : false
147+ large-packages : false
148+
149+ # Check out current repository
150+ - name : Fetch Sources
151+ uses : actions/checkout@v4
152+
153+ # Set up Java environment for the next steps
154+ - name : Setup Java
155+ uses : actions/setup-java@v4
156+ with :
157+ distribution : zulu
158+ java-version : 17
159+
160+ # Setup Gradle
161+ - name : Setup Gradle
162+ uses : gradle/gradle-build-action@v2
163+ with :
164+ gradle-home-cache-cleanup : true
89165
90166 # Cache Plugin Verifier IDEs
91167 - name : Setup Plugin Verifier IDEs Cache
92168 uses : actions/cache@v3
93169 with :
94- path : ${{ steps.properties .outputs.pluginVerifierHomeDir }}/ides
170+ path : ${{ needs.build .outputs.pluginVerifierHomeDir }}/ides
95171 key : plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
96172
97173 # Run Verify Plugin task and IntelliJ Plugin Verifier tool
98174 - name : Run Plugin Verification tasks
99- run : ./gradlew runPluginVerifier -Plugin .verifier.home.dir=${{ steps.properties .outputs.pluginVerifierHomeDir }}
175+ run : ./gradlew runPluginVerifier -Dplugin .verifier.home.dir=${{ needs.build .outputs.pluginVerifierHomeDir }}
100176
101177 # Collect Plugin Verifier Result
102178 - name : Collect Plugin Verifier Result
@@ -106,36 +182,27 @@ jobs:
106182 name : pluginVerifier-result
107183 path : ${{ github.workspace }}/build/reports/pluginVerifier
108184
109- # Prepare plugin archive content for creating artifact
110- - name : Prepare Plugin Artifact
111- id : artifact
112- shell : bash
113- run : |
114- cd ${{ github.workspace }}/build/distributions
115- FILENAME=`ls *.zip`
116- unzip "$FILENAME" -d content
117- echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
118- # Store already-built plugin as an artifact for downloading
119- - name : Upload artifact
120- uses : actions/upload-artifact@v3
121- with :
122- name : ${{ steps.artifact.outputs.filename }}
123- path : ./build/distributions/content/*/*
124-
125185 # Prepare a draft release for GitHub Releases page for the manual verification
126186 # If accepted and published, release workflow would be triggered
127187 releaseDraft :
128- name : Release Draft
188+ name : Release draft
129189 if : github.event_name != 'pull_request'
130- needs : build
190+ needs : [ build, test, verify ]
131191 runs-on : ubuntu-latest
132192 permissions :
133193 contents : write
134194 steps :
135195
136196 # Check out current repository
137197 - name : Fetch Sources
138- uses : actions/checkout@v3
198+ uses : actions/checkout@v4
199+
200+ # Set up Java environment for the next steps
201+ - name : Setup Java
202+ uses : actions/setup-java@v4
203+ with :
204+ distribution : zulu
205+ java-version : 17
139206
140207 # Remove old release drafts by using the curl request for the available releases with a draft flag
141208 - name : Remove Old Release Drafts
@@ -145,6 +212,7 @@ jobs:
145212 gh api repos/{owner}/{repo}/releases \
146213 --jq '.[] | select(.draft == true) | .id' \
147214 | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
215+
148216 # Create a new release draft which is not publicly visible and requires manual acceptance
149217 - name : Create Release Draft
150218 env :
0 commit comments