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 the 'buildPlugin' task and prepare artifact for further tests.
5- # - Run the 'runPluginVerifier' task.
6- # - Create a draft release.
7- #
8- # The workflow is triggered on push and pull_request events.
9- #
10- # GitHub Actions reference: https://help.github.com/en/actions
11- #
12- # # JBIJPPTPL
13-
14- name : Build
1+ name : Build and verify. Publish plugin on workflow dispatch
152on :
16- # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests)
173 push :
18- branches : [ main ]
19- # Trigger the workflow on any pull request
4+ branches :
5+ - main
6+
207 pull_request :
8+ workflow_dispatch :
9+
10+ permissions :
11+ contents : read
2112
2213jobs :
2314
24- # Prepare environment and build the plugin
2515 build :
2616 name : Build
2717 runs-on : ubuntu-latest
@@ -30,29 +20,27 @@ jobs:
3020 changelog : ${{ steps.properties.outputs.changelog }}
3121 pluginVerifierHomeDir : ${{ steps.properties.outputs.pluginVerifierHomeDir }}
3222 steps :
23+ - name : Maximize Build Space
24+ run : |
25+ sudo rm -rf /usr/share/dotnet
26+ sudo rm -rf /usr/local/lib/android
27+ sudo rm -rf /opt/ghc
28+ sudo rm -rf /usr/local/.ghcup
3329
34- # Check out current repository
3530 - name : Fetch Sources
36- uses : actions/checkout@v6
37-
38- # Validate wrapper
39- - name : Gradle Wrapper Validation
40- 31+ uses : actions/checkout@v4
4132
42- # Set up Java environment for the next steps
4333 - name : Setup Java
44- uses : actions/setup-java@v5
34+ uses : actions/setup-java@v3
4535 with :
4636 distribution : zulu
4737 java-version : 17
4838
49- # Setup Gradle
5039 - name : Setup Gradle
51- 40+ uses : gradle/actions/setup-gradle@v4
5241 with :
53- gradle-home-cache-cleanup : true
42+ validate-wrappers : true
5443
55- # Set environment variables
5644 - name : Export Properties
5745 id : properties
5846 shell : bash
@@ -63,18 +51,16 @@ jobs:
6351
6452 echo "version=$VERSION" >> $GITHUB_OUTPUT
6553 echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
66-
54+
6755 echo "changelog<<EOF" >> $GITHUB_OUTPUT
6856 echo "$CHANGELOG" >> $GITHUB_OUTPUT
6957 echo "EOF" >> $GITHUB_OUTPUT
7058
71- ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
59+ ./gradlew printProductsReleases # prepare list of IDEs for Plugin Verifier
7260
73- # Build plugin
7461 - name : Build plugin
7562 run : ./gradlew buildPlugin
7663
77- # Prepare plugin archive content for creating artifact
7864 - name : Prepare Plugin Artifact
7965 id : artifact
8066 shell : bash
@@ -85,166 +71,68 @@ jobs:
8571
8672 echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
8773
88- # Store already-built plugin as an artifact for downloading
8974 - name : Upload artifact
90- uses : actions/upload-artifact@v6
75+ uses : actions/upload-artifact@v4
9176 with :
9277 name : ${{ steps.artifact.outputs.filename }}
9378 path : ./build/distributions/content/*/*
9479
95- # Run tests and upload a code coverage report
96- test :
97- name : Test
98- needs : [ build ]
99- runs-on : ubuntu-latest
100- steps :
101-
102- # Check out current repository
103- - name : Fetch Sources
104- uses : actions/checkout@v6
105-
106- # Set up Java environment for the next steps
107- - name : Setup Java
108- uses : actions/setup-java@v5
109- with :
110- distribution : zulu
111- java-version : 17
112-
113- # Setup Gradle
114- - name : Setup Gradle
115- 116- with :
117- gradle-home-cache-cleanup : true
118-
119- # Run tests
120- - name : Run Tests
121- run : ./gradlew check
122-
123- # Collect Tests Result of failed tests
124- - name : Collect Tests Result
125- if : ${{ failure() }}
126- uses : actions/upload-artifact@v6
127- with :
128- name : tests-result
129- path : ${{ github.workspace }}/build/reports/tests
130-
131- # Upload the Kover report to CodeCov
132- - name : Upload Code Coverage Report
133- uses : codecov/codecov-action@v5
134- with :
135- files : ${{ github.workspace }}/build/reports/kover/report.xml
136-
137- # Run Qodana inspections and provide report
138- inspectCode :
139- name : Inspect code
140- needs : [ build ]
141- runs-on : ubuntu-latest
142- permissions :
143- contents : write
144- checks : write
145- pull-requests : write
146- steps :
147-
148- # Check out current repository
149- - name : Fetch Sources
150- uses : actions/checkout@v6
151-
152- # Set up Java environment for the next steps
153- - name : Setup Java
154- uses : actions/setup-java@v5
155- with :
156- distribution : zulu
157- java-version : 17
158-
159- # Run Qodana inspections
160- - name : Qodana - Code Inspection
161- 162- with :
163- cache-default-branch-only : true
164-
165- # Run plugin structure verification along with IntelliJ Plugin Verifier
16680 verify :
16781 name : Verify plugin
16882 needs : [ build ]
16983 runs-on : ubuntu-latest
17084 steps :
17185
172- # Check out current repository
86+ - name : Maximize Build Space
87+ run : |
88+ sudo docker image prune --all --force || true
89+
90+ sudo rm -rf /usr/share/dotnet
91+ sudo rm -rf /usr/local/lib/android
92+ sudo rm -rf /opt/ghc
93+ sudo rm -rf /usr/local/.ghcup
94+ sudo rm -rf /opt/hostedtoolcache
95+ sudo rm -rf /usr/share/swift
96+ sudo rm -rf /usr/local/share/powershell
97+
98+ sudo apt-get remove -y '^aspnetcore-.*' || echo "::warning::The command [sudo apt-get remove -y '^aspnetcore-.*'] failed to complete successfully. Proceeding..."
99+ sudo apt-get remove -y '^dotnet-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^dotnet-.*' --fix-missing] failed to complete successfully. Proceeding..."
100+ sudo apt-get remove -y '^llvm-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^llvm-.*' --fix-missing] failed to complete successfully. Proceeding..."
101+ sudo apt-get remove -y 'php.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y 'php.*' --fix-missing] failed to complete successfully. Proceeding..."
102+ sudo apt-get remove -y '^mongodb-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mongodb-.*' --fix-missing] failed to complete successfully. Proceeding..."
103+ sudo apt-get remove -y '^mysql-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mysql-.*' --fix-missing] failed to complete successfully. Proceeding..."
104+ sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing || echo "::warning::The command [sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing] failed to complete successfully. Proceeding..."
105+ sudo apt-get remove -y google-cloud-sdk --fix-missing || echo "::debug::The command [sudo apt-get remove -y google-cloud-sdk --fix-missing] failed to complete successfully. Proceeding..."
106+ sudo apt-get remove -y google-cloud-cli --fix-missing || echo "::debug::The command [sudo apt-get remove -y google-cloud-cli --fix-missing] failed to complete successfully. Proceeding..."
107+ sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed to complete successfully. Proceeding..."
108+ sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed to complete successfully. Proceeding..."
109+
173110 - name : Fetch Sources
174- uses : actions/checkout@v6
111+ uses : actions/checkout@v4
175112
176- # Set up Java environment for the next steps
177113 - name : Setup Java
178- uses : actions/setup-java@v5
114+ uses : actions/setup-java@v3
179115 with :
180116 distribution : zulu
181117 java-version : 17
182118
183- # Setup Gradle
184119 - name : Setup Gradle
185- 120+ uses : gradle/actions/setup-gradle@v4
186121 with :
187- gradle-home-cache-cleanup : true
122+ validate-wrappers : true
188123
189- # Cache Plugin Verifier IDEs
190124 - name : Setup Plugin Verifier IDEs Cache
191- uses : actions/cache@v5
125+ uses : actions/cache@v3
192126 with :
193127 path : ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
194- key : plugin-verifier-${{ hashFiles('build/listProductsReleases .txt') }}
128+ key : plugin-verifier-${{ hashFiles('build/printProductsReleases .txt') }}
195129
196- # Run Verify Plugin task and IntelliJ Plugin Verifier tool
197130 - name : Run Plugin Verification tasks
198- run : ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
131+ run : ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
199132
200- # Collect Plugin Verifier Result
201133 - name : Collect Plugin Verifier Result
202134 if : ${{ always() }}
203- uses : actions/upload-artifact@v6
135+ uses : actions/upload-artifact@v4
204136 with :
205137 name : pluginVerifier-result
206138 path : ${{ github.workspace }}/build/reports/pluginVerifier
207-
208- # Prepare a draft release for GitHub Releases page for the manual verification
209- # If accepted and published, release workflow would be triggered
210- releaseDraft :
211- name : Release draft
212- if : github.event_name != 'pull_request'
213- needs : [ build, test, inspectCode, verify ]
214- runs-on : ubuntu-latest
215- permissions :
216- contents : write
217- steps :
218-
219- # Check out current repository
220- - name : Fetch Sources
221- uses : actions/checkout@v6
222-
223- # Set up Java environment for the next steps
224- - name : Setup Java
225- uses : actions/setup-java@v5
226- with :
227- distribution : zulu
228- java-version : 17
229-
230- # Remove old release drafts by using the curl request for the available releases with a draft flag
231- - name : Remove Old Release Drafts
232- env :
233- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
234- run : |
235- gh api repos/{owner}/{repo}/releases \
236- --jq '.[] | select(.draft == true) | .id' \
237- | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
238-
239- # Create a new release draft which is not publicly visible and requires manual acceptance
240- - name : Create Release Draft
241- env :
242- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
243- run : |
244- gh release create v${{ needs.build.outputs.version }} \
245- --draft \
246- --title "v${{ needs.build.outputs.version }}" \
247- --notes "$(cat << 'EOM'
248- ${{ needs.build.outputs.changelog }}
249- EOM
250- )"
0 commit comments