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 : [master]
19+ branches : [ master ]
2020 # Trigger the workflow on any pull request
2121 pull_request :
2222
23+ concurrency :
24+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
25+ cancel-in-progress : true
26+
2327jobs :
2428
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
2830 build :
2931 name : Build
3032 runs-on : ubuntu-latest
3133 outputs :
3234 version : ${{ steps.properties.outputs.version }}
3335 changelog : ${{ steps.properties.outputs.changelog }}
36+ pluginVerifierHomeDir : ${{ steps.properties.outputs.pluginVerifierHomeDir }}
3437 steps :
3538
36-
37-
38- # Check out current repository
39+ # Check out the current repository
3940 - name : Fetch Sources
4041 uses : actions/checkout@v4
4142
4243 # Validate wrapper
4344 - name : Gradle Wrapper Validation
44- uses : gradle/wrapper-validation-action @v3
45+ uses : gradle/actions/ wrapper-validation@v3
4546
46- # Setup Java 17 environment for the next steps
47+ # Set up Java environment for the next steps
4748 - name : Setup Java
4849 uses : actions/setup-java@v4
4950 with :
5051 distribution : zulu
5152 java-version : 17
5253
54+ # Setup Gradle
55+ - name : Setup Gradle
56+ uses : gradle/actions/setup-gradle@v4
57+
5358 # Set environment variables
5459 - name : Export Properties
5560 id : properties
5661 shell : bash
5762 run : |
5863 PROPERTIES="$(./gradlew properties --console=plain -q)"
5964 VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
60- NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
6165 CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
62- CHANGELOG="${CHANGELOG//'%'/'%25'}"
63- CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
64- CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
6566
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
7073
71- ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
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 : 17
113+
114+ # Setup Gradle
115+ - name : Setup Gradle
116+ uses : gradle/actions/setup-gradle@v4
72117
73118 # Run tests
74119 - name : Run Tests
75- run : ./gradlew test
120+ run : ./gradlew check
76121
77122 # Collect Tests Result of failed tests
78123 - name : Collect Tests Result
@@ -82,31 +127,51 @@ jobs:
82127 name : tests-result
83128 path : ${{ github.workspace }}/build/reports/tests
84129
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 plugin structure verification along with IntelliJ Plugin Verifier
137+ verify :
138+ name : Verify plugin
139+ needs : [ build ]
140+ runs-on : ubuntu-latest
141+ steps :
142+
85143 # Free GitHub Actions Environment Disk Space
86144 - name : Maximize Build Space
87- uses : jlumbroso/free-disk-space@v1.3.1
145+ uses : jlumbroso/free-disk-space@main
88146 with :
89147 tool-cache : false
90148 large-packages : false
91149
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
150+ # Check out the current repository
151+ - name : Fetch Sources
152+ uses : actions/checkout@v4
153+
154+ # Set up Java environment for the next steps
155+ - name : Setup Java
156+ uses : actions/setup-java@v4
157+ with :
158+ distribution : zulu
159+ java-version : 17
160+
161+ # Setup Gradle
162+ - name : Setup Gradle
163+ uses : gradle/actions/setup-gradle@v4
97164
98165 # Cache Plugin Verifier IDEs
99166 - name : Setup Plugin Verifier IDEs Cache
100167 uses : actions/cache@v4
101168 with :
102- path : ${{ steps.properties .outputs.pluginVerifierHomeDir }}/ides
169+ path : ${{ needs.build .outputs.pluginVerifierHomeDir }}/ides
103170 key : plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
104171
105172 # Run Verify Plugin task and IntelliJ Plugin Verifier tool
106173 - name : Run Plugin Verification tasks
107- run : |
108- sudo df -h
109- ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
174+ run : ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
110175
111176 # Collect Plugin Verifier Result
112177 - name : Collect Plugin Verifier Result
@@ -116,40 +181,22 @@ jobs:
116181 name : pluginVerifier-result
117182 path : ${{ github.workspace }}/build/reports/pluginVerifier
118183
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-
137184 # Prepare a draft release for GitHub Releases page for the manual verification
138185 # If accepted and published, release workflow would be triggered
139186 releaseDraft :
140- name : Release Draft
187+ name : Release draft
141188 if : github.event_name != 'pull_request'
142- needs : build
189+ needs : [ build, test, verify ]
143190 runs-on : ubuntu-latest
144191 permissions :
145192 contents : write
146193 steps :
147194
148- # Check out current repository
195+ # Check out the current repository
149196 - name : Fetch Sources
150197 uses : actions/checkout@v4
151198
152- # Remove old release drafts by using the curl request for the available releases with draft flag
199+ # Remove old release drafts by using the curl request for the available releases with a draft flag
153200 - name : Remove Old Release Drafts
154201 env :
155202 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -158,15 +205,15 @@ jobs:
158205 --jq '.[] | select(.draft == true) | .id' \
159206 | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
160207
161- # Create new release draft - which is not publicly visible and requires manual acceptance
208+ # Create a new release draft which is not publicly visible and requires manual acceptance
162209 - name : Create Release Draft
163210 env :
164211 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
165212 run : |
166- gh release create v${{ needs.build.outputs.version }} \
213+ gh release create " v${{ needs.build.outputs.version }}" \
167214 --draft \
168215 --title "v${{ needs.build.outputs.version }}" \
169216 --notes "$(cat << 'EOM'
170217 ${{ needs.build.outputs.changelog }}
171218 EOM
172- )"
219+ )"
0 commit comments