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.
88#
9- # Workflow is triggered on push and pull_request events.
9+ # The workflow is triggered on push and pull_request events.
1010#
1111# GitHub Actions reference: https://help.github.com/en/actions
1212#
1313# # JBIJPPTPL
1414
1515name : Build
1616on :
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)
1818 push :
19- branches : [main, dev, '213']
20- # Skip md and SQL files
21- paths-ignore :
22- - ' **/*.md'
23- - ' **/*.sql'
24- - ' **/*.xml'
25- - ' **/*.yml'
19+ branches : [ main ]
2620 # Trigger the workflow on any pull request
2721 pull_request :
28- branches : [maim, dev]
22+
23+ concurrency :
24+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
25+ cancel-in-progress : true
2926
3027jobs :
3128
32- # Run Gradle Wrapper Validation Action to verify the wrapper's checksum
33- # Run verifyPlugin, IntelliJ Plugin Verifier, and test Gradle tasks
34- # Build plugin and provide the artifact for the next workflow jobs
29+ # Prepare environment and build the plugin
3530 build :
3631 name : Build
3732 runs-on : ubuntu-latest
3833 outputs :
3934 version : ${{ steps.properties.outputs.version }}
4035 changelog : ${{ steps.properties.outputs.changelog }}
36+ pluginVerifierHomeDir : ${{ steps.properties.outputs.pluginVerifierHomeDir }}
4137 steps :
4238
43- # Check out current repository
39+ # Check out the current repository
4440 - name : Fetch Sources
45- uses : actions/checkout@v2.4.0
41+ uses : actions/checkout@v4
4642
4743 # Validate wrapper
4844 - name : Gradle Wrapper Validation
49- uses : gradle/wrapper-validation-action@v1.0.4
45+ uses : gradle/actions/ wrapper-validation@v4
5046
51- # Setup Java 11 environment for the next steps
47+ # Set up Java environment for the next steps
5248 - name : Setup Java
53- uses : actions/setup-java@v2
49+ uses : actions/setup-java@v4
5450 with :
5551 distribution : zulu
56- java-version : 11
57- cache : gradle
52+ java-version : 21
53+
54+ # Setup Gradle
55+ - name : Setup Gradle
56+ uses : gradle/actions/setup-gradle@v4
5857
5958 # Set environment variables
6059 - name : Export Properties
@@ -63,94 +62,194 @@ jobs:
6362 run : |
6463 PROPERTIES="$(./gradlew properties --console=plain -q)"
6564 VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
66- NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
6765 CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
68- CHANGELOG="${CHANGELOG//'%'/'%25'}"
69- CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
70- CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
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"
75- ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
66+
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
106+
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 : 21
113+
114+ # Setup Gradle
115+ - name : Setup Gradle
116+ uses : gradle/actions/setup-gradle@v4
117+
76118 # Run tests
77119 - name : Run Tests
78- run : ./gradlew test
120+ run : ./gradlew check
79121
80122 # Collect Tests Result of failed tests
81123 - name : Collect Tests Result
82124 if : ${{ failure() }}
83- uses : actions/upload-artifact@v2
125+ uses : actions/upload-artifact@v4
84126 with :
85127 name : tests-result
86128 path : ${{ github.workspace }}/build/reports/tests
87129
130+ # Upload the Kover report to CodeCov
131+ - name : Upload Code Coverage Report
132+ uses : codecov/codecov-action@v5
133+ with :
134+ files : ${{ github.workspace }}/build/reports/kover/report.xml
135+
136+ # Run Qodana inspections and provide report
137+ inspectCode :
138+ if : false
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+ # Free GitHub Actions Environment Disk Space
149+ - name : Maximize Build Space
150+ uses : jlumbroso/free-disk-space@main
151+ with :
152+ tool-cache : false
153+ large-packages : false
154+
155+ # Check out the current repository
156+ - name : Fetch Sources
157+ uses : actions/checkout@v4
158+ with :
159+ ref : ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
160+ fetch-depth : 0 # a full history is required for pull request analysis
161+
162+ # Set up Java environment for the next steps
163+ - name : Setup Java
164+ uses : actions/setup-java@v4
165+ with :
166+ distribution : zulu
167+ java-version : 21
168+
169+ # Run Qodana inspections
170+ - name : Qodana - Code Inspection
171+ uses : JetBrains/qodana-action@v2024.2
172+ with :
173+ cache-default-branch-only : true
174+
175+ # Run plugin structure verification along with IntelliJ Plugin Verifier
176+ verify :
177+ name : Verify plugin
178+ needs : [ build ]
179+ runs-on : ubuntu-latest
180+ steps :
181+
182+ # Free GitHub Actions Environment Disk Space
183+ - name : Maximize Build Space
184+ uses : jlumbroso/free-disk-space@main
185+ with :
186+ tool-cache : false
187+ large-packages : false
188+
189+ # Check out the current repository
190+ - name : Fetch Sources
191+ uses : actions/checkout@v4
192+
193+ # Set up Java environment for the next steps
194+ - name : Setup Java
195+ uses : actions/setup-java@v4
196+ with :
197+ distribution : zulu
198+ java-version : 21
199+
200+ # Setup Gradle
201+ - name : Setup Gradle
202+ uses : gradle/actions/setup-gradle@v4
203+
88204 # Cache Plugin Verifier IDEs
89205 - name : Setup Plugin Verifier IDEs Cache
90- uses : actions/cache@v2.1.7
206+ uses : actions/cache@v4
91207 with :
92- path : ${{ steps.properties .outputs.pluginVerifierHomeDir }}/ides
208+ path : ${{ needs.build .outputs.pluginVerifierHomeDir }}/ides
93209 key : plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
94210
95211 # Run Verify Plugin task and IntelliJ Plugin Verifier tool
96212 - name : Run Plugin Verification tasks
97- run : ./gradlew runPluginVerifier -Pplugin .verifier.home.dir=${{ steps.properties .outputs.pluginVerifierHomeDir }}
213+ run : ./gradlew verifyPlugin -Dplugin .verifier.home.dir=${{ needs.build .outputs.pluginVerifierHomeDir }}
98214
99215 # Collect Plugin Verifier Result
100216 - name : Collect Plugin Verifier Result
101217 if : ${{ always() }}
102- uses : actions/upload-artifact@v2
218+ uses : actions/upload-artifact@v4
103219 with :
104220 name : pluginVerifier-result
105221 path : ${{ github.workspace }}/build/reports/pluginVerifier
106222
107- # Run Qodana inspections
108- # - name: Qodana - Code Inspection
109- # uses: JetBrains/qodana-action@v4.1.0
110-
111- # Prepare plugin archive content for creating artifact
112- - name : Prepare Plugin Artifact
113- id : artifact
114- shell : bash
115- run : |
116- cd ${{ github.workspace }}/build/distributions
117- FILENAME=`ls *.zip`
118- unzip "$FILENAME" -d content
119- echo "::set-output name=filename::${FILENAME:0:-4}"
120- # Store already-built plugin as an artifact for downloading
121- - name : Upload artifact
122- uses : actions/upload-artifact@v2.2.4
123- with :
124- name : ${{ steps.artifact.outputs.filename }}
125- path : ./build/distributions/content/*/*
126-
127223 # Prepare a draft release for GitHub Releases page for the manual verification
128224 # If accepted and published, release workflow would be triggered
129225 releaseDraft :
130- name : Release Draft
226+ name : Release draft
131227 if : github.event_name != 'pull_request'
132- needs : build
228+ needs : [ build, test, inspectCode, verify ]
133229 runs-on : ubuntu-latest
230+ permissions :
231+ contents : write
134232 steps :
135233
136- # Check out current repository
234+ # Check out the current repository
137235 - name : Fetch Sources
138- uses : actions/checkout@v2.4.0
236+ uses : actions/checkout@v4
139237
140- # Remove old release drafts by using the curl request for the available releases with draft flag
238+ # Remove old release drafts by using the curl request for the available releases with a draft flag
141239 - name : Remove Old Release Drafts
142240 env :
143241 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
144242 run : |
145243 gh api repos/{owner}/{repo}/releases \
146244 --jq '.[] | select(.draft == true) | .id' \
147245 | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
148- # Create new release draft - which is not publicly visible and requires manual acceptance
246+
247+ # Create a new release draft which is not publicly visible and requires manual acceptance
149248 - name : Create Release Draft
150249 env :
151250 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
152251 run : |
153- gh release create v${{ needs.build.outputs.version }} \
252+ gh release create " v${{ needs.build.outputs.version }}" \
154253 --draft \
155254 --title "v${{ needs.build.outputs.version }}" \
156255 --notes "$(cat << 'EOM'
0 commit comments