1- # GitHub Actions Workflow created for testing and preparing the plugin release in following steps:
1+ # GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps:
22# - validate Gradle Wrapper,
33# - run 'test' and 'verifyPlugin' tasks,
44# - run Qodana inspections,
@@ -16,38 +16,47 @@ name: Build
1616on :
1717 # 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, master ]
19+ branches : [ main ]
2020 # Trigger the workflow on any pull request
2121 pull_request :
2222
2323jobs :
2424
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
25+ # Prepare environment and build the plugin
2826 build :
2927 name : Build
3028 runs-on : ubuntu-latest
3129 outputs :
3230 version : ${{ steps.properties.outputs.version }}
3331 changelog : ${{ steps.properties.outputs.changelog }}
32+ pluginVerifierHomeDir : ${{ steps.properties.outputs.pluginVerifierHomeDir }}
3433 steps :
3534
35+ # Free GitHub Actions Environment Disk Space
36+ - name : Maximize Build Space
37+ run : |
38+ sudo rm -rf /usr/share/dotnet
39+ sudo rm -rf /usr/local/lib/android
40+ sudo rm -rf /opt/ghc
41+
3642 # Check out current repository
3743 - name : Fetch Sources
38- uses : actions/checkout@v2.4.0
44+ uses : actions/checkout@v3
3945
4046 # Validate wrapper
4147 - name : Gradle Wrapper Validation
42- 48+ 4349
44- # Setup Java 11 environment for the next steps
50+ # Setup Java environment for the next steps
4551 - name : Setup Java
46- uses : actions/setup-java@v2
52+ uses : actions/setup-java@v3
4753 with :
4854 distribution : zulu
49- java-version : 11
50- cache : gradle
55+ java-version : 17
56+
57+ # Setup Gradle
58+ - name : Setup Gradle
59+ uses : gradle/gradle-build-action@v2
5160
5261 # Set environment variables
5362 - name : Export Properties
@@ -56,86 +65,171 @@ jobs:
5665 run : |
5766 PROPERTIES="$(./gradlew properties --console=plain -q)"
5867 VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
59- NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
6068 CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
61- CHANGELOG="${CHANGELOG//'%'/'%25'}"
62- CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
63- CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
6469
65- echo "::set-output name=version::$VERSION"
66- echo "::set-output name=name::$NAME"
67- echo "::set-output name=changelog::$CHANGELOG"
68- echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier"
70+ echo "version=$VERSION" >> $GITHUB_OUTPUT
71+ echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
72+
73+ echo "changelog<<EOF" >> $GITHUB_OUTPUT
74+ echo "$CHANGELOG" >> $GITHUB_OUTPUT
75+ echo "EOF" >> $GITHUB_OUTPUT
6976
7077 ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
7178
79+ # Build plugin
80+ - name : Build plugin
81+ run : ./gradlew buildPlugin
82+
83+ # Prepare plugin archive content for creating artifact
84+ - name : Prepare Plugin Artifact
85+ id : artifact
86+ shell : bash
87+ run : |
88+ cd ${{ github.workspace }}/build/distributions
89+ FILENAME=`ls *.zip`
90+ unzip "$FILENAME" -d content
91+
92+ echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
93+
94+ # Store already-built plugin as an artifact for downloading
95+ - name : Upload artifact
96+ uses : actions/upload-artifact@v3
97+ with :
98+ name : ${{ steps.artifact.outputs.filename }}
99+ path : ./build/distributions/content/*/*
100+
101+ # Run tests and upload a code coverage report
102+ test :
103+ name : Test
104+ needs : [ build ]
105+ runs-on : ubuntu-latest
106+ steps :
107+
108+ # Check out current repository
109+ - name : Fetch Sources
110+ uses : actions/checkout@v3
111+
112+ # Setup Java environment for the next steps
113+ - name : Setup Java
114+ uses : actions/setup-java@v3
115+ with :
116+ distribution : zulu
117+ java-version : 17
118+
119+ # Setup Gradle
120+ - name : Setup Gradle
121+ uses : gradle/gradle-build-action@v2
122+
72123 # Run tests
73124 - name : Run Tests
74- run : ./gradlew test
125+ run : ./gradlew check
75126
76127 # Collect Tests Result of failed tests
77128 - name : Collect Tests Result
78129 if : ${{ failure() }}
79- uses : actions/upload-artifact@v2
130+ uses : actions/upload-artifact@v3
80131 with :
81132 name : tests-result
82133 path : ${{ github.workspace }}/build/reports/tests
83134
135+ # Upload Kover report to CodeCov
136+ - name : Upload Code Coverage Report
137+ uses : codecov/codecov-action@v3
138+ with :
139+ files : ${{ github.workspace }}/build/reports/kover/xml/report.xml
140+
141+ # Run Qodana inspections and provide report
142+ inspectCode :
143+ name : Inspect code
144+ needs : [ build ]
145+ runs-on : ubuntu-latest
146+ permissions :
147+ contents : write
148+ checks : write
149+ pull-requests : write
150+ steps :
151+
152+ # Check out current repository
153+ - name : Fetch Sources
154+ uses : actions/checkout@v3
155+
156+ # Setup Java environment for the next steps
157+ - name : Setup Java
158+ uses : actions/setup-java@v3
159+ with :
160+ distribution : zulu
161+ java-version : 17
162+
163+ # Run Qodana inspections
164+ - name : Qodana - Code Inspection
165+ 166+ with :
167+ cache-default-branch-only : true
168+
169+ # Run plugin structure verification along with IntelliJ Plugin Verifier
170+ verify :
171+ name : Verify plugin
172+ needs : [ build, test, inspectCode ]
173+ runs-on : ubuntu-latest
174+ steps :
175+
176+ # Check out current repository
177+ - name : Fetch Sources
178+ uses : actions/checkout@v3
179+
180+ # Setup Java environment for the next steps
181+ - name : Setup Java
182+ uses : actions/setup-java@v3
183+ with :
184+ distribution : zulu
185+ java-version : 17
186+
187+ # Setup Gradle
188+ - name : Setup Gradle
189+ uses : gradle/gradle-build-action@v2
190+
84191 # Cache Plugin Verifier IDEs
85192 - name : Setup Plugin Verifier IDEs Cache
86- uses : actions/cache@v2.1.7
193+ uses : actions/cache@v3
87194 with :
88- path : ${{ steps.properties .outputs.pluginVerifierHomeDir }}/ides
195+ path : ${{ needs.build .outputs.pluginVerifierHomeDir }}/ides
89196 key : plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
90197
91198 # Run Verify Plugin task and IntelliJ Plugin Verifier tool
92199 - name : Run Plugin Verification tasks
93- run : ./gradlew runPluginVerifier -Pplugin .verifier.home.dir=${{ steps.properties .outputs.pluginVerifierHomeDir }}
200+ run : ./gradlew runPluginVerifier -Dplugin .verifier.home.dir=${{ needs.build .outputs.pluginVerifierHomeDir }}
94201
95202 # Collect Plugin Verifier Result
96203 - name : Collect Plugin Verifier Result
97204 if : ${{ always() }}
98- uses : actions/upload-artifact@v2
205+ uses : actions/upload-artifact@v3
99206 with :
100207 name : pluginVerifier-result
101208 path : ${{ github.workspace }}/build/reports/pluginVerifier
102209
103- # Run Qodana inspections
104- - name : Qodana - Code Inspection
105- 106-
107- # Prepare plugin archive content for creating artifact
108- - name : Prepare Plugin Artifact
109- id : artifact
110- shell : bash
111- run : |
112- cd ${{ github.workspace }}/build/distributions
113- FILENAME=`ls *.zip`
114- unzip "$FILENAME" -d content
115-
116- echo "::set-output name=filename::${FILENAME:0:-4}"
117-
118- # Store already-built plugin as an artifact for downloading
119- - name : Upload artifact
120- 121- with :
122- name : ${{ steps.artifact.outputs.filename }}
123- path : ./build/distributions/content/*/*
124-
125210 # Prepare a draft release for GitHub Releases page for the manual verification
126211 # If accepted and published, release workflow would be triggered
127212 releaseDraft :
128- name : Release Draft
213+ name : Release draft
129214 if : github.event_name != 'pull_request'
130- needs : build
215+ needs : [ build, verify ]
131216 runs-on : ubuntu-latest
217+ permissions :
218+ contents : write
132219 steps :
133220
134221 # Check out current repository
135222 - name : Fetch Sources
136- 223+ uses : actions/checkout@v3
224+
225+ # Setup Java environment for the next steps
226+ - name : Setup Java
227+ uses : actions/setup-java@v3
228+ with :
229+ distribution : zulu
230+ java-version : 17
137231
138- # Remove old release drafts by using the curl request for the available releases with draft flag
232+ # Remove old release drafts by using the curl request for the available releases with a draft flag
139233 - name : Remove Old Release Drafts
140234 env :
141235 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -144,7 +238,7 @@ jobs:
144238 --jq '.[] | select(.draft == true) | .id' \
145239 | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
146240
147- # Create new release draft - which is not publicly visible and requires manual acceptance
241+ # Create a new release draft which is not publicly visible and requires manual acceptance
148242 - name : Create Release Draft
149243 env :
150244 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -155,4 +249,4 @@ jobs:
155249 --notes "$(cat << 'EOM'
156250 ${{ needs.build.outputs.changelog }}
157251 EOM
158- )"
252+ )"
0 commit comments