21
21
pull_request :
22
22
23
23
jobs :
24
-
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
24
+ # Prepare environment and build the plugin
28
25
build :
29
26
name : Build
30
27
runs-on : ubuntu-latest
31
28
outputs :
32
29
version : ${{ steps.properties.outputs.version }}
33
30
changelog : ${{ steps.properties.outputs.changelog }}
31
+ pluginVerifierHomeDir : ${{ steps.properties.outputs.pluginVerifierHomeDir }}
34
32
steps :
33
+
35
34
# Check out current repository
36
35
- name : Fetch Sources
37
36
uses : actions/checkout@v4
@@ -61,16 +60,62 @@ jobs:
61
60
PROPERTIES="$(./gradlew properties --console=plain -q)"
62
61
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
63
62
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
64
-
63
+
65
64
echo "version=$VERSION" >> $GITHUB_OUTPUT
66
65
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
67
66
68
67
echo "changelog<<EOF" >> $GITHUB_OUTPUT
69
68
echo "$CHANGELOG" >> $GITHUB_OUTPUT
70
69
echo "EOF" >> $GITHUB_OUTPUT
71
-
70
+
72
71
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
73
72
73
+ # Build plugin
74
+ - name : Build plugin
75
+ run : ./gradlew buildPlugin
76
+
77
+ # Prepare plugin archive content for creating artifact
78
+ - name : Prepare Plugin Artifact
79
+ id : artifact
80
+ shell : bash
81
+ run : |
82
+ cd ${{ github.workspace }}/build/distributions
83
+ FILENAME=`ls *.zip`
84
+ unzip "$FILENAME" -d content
85
+
86
+ echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
87
+
88
+ # Store already-built plugin as an artifact for downloading
89
+ - name : Upload artifact
90
+ uses : actions/upload-artifact@v3
91
+ with :
92
+ name : ${{ steps.artifact.outputs.filename }}
93
+ path : ./build/distributions/content/*/*
94
+
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@v4
105
+
106
+ # Set up Java environment for the next steps
107
+ - name : Setup Java
108
+ uses : actions/setup-java@v3
109
+ with :
110
+ distribution : zulu
111
+ java-version : 17
112
+
113
+ # Setup Gradle
114
+ - name : Setup Gradle
115
+ uses : gradle/gradle-build-action@v2
116
+ with :
117
+ gradle-home-cache-cleanup : true
118
+
74
119
# Run tests
75
120
- name : Run Tests
76
121
run : ./gradlew check
@@ -83,22 +128,53 @@ jobs:
83
128
name : tests-result
84
129
path : ${{ github.workspace }}/build/reports/tests
85
130
86
- # Upload Kover report to CodeCov
131
+ # Upload the Kover report to CodeCov
87
132
- name : Upload Code Coverage Report
88
133
uses : codecov/codecov-action@v3
89
134
with :
90
- files : ${{ github.workspace }}/build/reports/kover/xml/report.xml
135
+ files : ${{ github.workspace }}/build/reports/kover/report.xml
136
+
137
+ # Run plugin structure verification along with IntelliJ Plugin Verifier
138
+ verify :
139
+ name : Verify plugin
140
+ needs : [ build ]
141
+ runs-on : ubuntu-latest
142
+ steps :
143
+
144
+ # Free GitHub Actions Environment Disk Space
145
+ - name : Maximize Build Space
146
+ uses : jlumbroso/free-disk-space@main
147
+ with :
148
+ tool-cache : false
149
+ large-packages : false
150
+
151
+ # Check out current repository
152
+ - name : Fetch Sources
153
+ uses : actions/checkout@v4
154
+
155
+ # Set up Java environment for the next steps
156
+ - name : Setup Java
157
+ uses : actions/setup-java@v3
158
+ with :
159
+ distribution : zulu
160
+ java-version : 17
161
+
162
+ # Setup Gradle
163
+ - name : Setup Gradle
164
+ uses : gradle/gradle-build-action@v2
165
+ with :
166
+ gradle-home-cache-cleanup : true
91
167
92
168
# Cache Plugin Verifier IDEs
93
169
- name : Setup Plugin Verifier IDEs Cache
94
170
uses : actions/cache@v3
95
171
with :
96
- path : ${{ steps.properties .outputs.pluginVerifierHomeDir }}/ides
172
+ path : ${{ needs.build .outputs.pluginVerifierHomeDir }}/ides
97
173
key : plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
98
174
99
175
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
100
176
- name : Run Plugin Verification tasks
101
- run : ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ steps.properties .outputs.pluginVerifierHomeDir }}
177
+ run : ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build .outputs.pluginVerifierHomeDir }}
102
178
103
179
# Collect Plugin Verifier Result
104
180
- name : Collect Plugin Verifier Result
@@ -107,55 +183,3 @@ jobs:
107
183
with :
108
184
name : pluginVerifier-result
109
185
path : ${{ github.workspace }}/build/reports/pluginVerifier
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 "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
120
- # Store already-built plugin as an artifact for downloading
121
- - name : Upload artifact
122
- uses : actions/upload-artifact@v3
123
- with :
124
- name : ${{ steps.artifact.outputs.filename }}
125
- path : ./build/distributions/content/*/*
126
-
127
- # Prepare a draft release for GitHub Releases page for the manual verification
128
- # If accepted and published, release workflow would be triggered
129
- releaseDraft :
130
- name : Release Draft
131
- if : github.event_name != 'pull_request'
132
- needs : build
133
- runs-on : ubuntu-latest
134
- permissions :
135
- contents : write
136
- steps :
137
-
138
- # Check out current repository
139
- - name : Fetch Sources
140
- uses : actions/checkout@v4
141
-
142
- # Remove old release drafts by using the curl request for the available releases with a draft flag
143
- - name : Remove Old Release Drafts
144
- env :
145
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
146
- run : |
147
- gh api repos/{owner}/{repo}/releases \
148
- --jq '.[] | select(.draft == true) | .id' \
149
- | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
150
- # Create a new release draft which is not publicly visible and requires manual acceptance
151
- - name : Create Release Draft
152
- env :
153
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
154
- run : |
155
- gh release create v${{ needs.build.outputs.version }} \
156
- --draft \
157
- --title "v${{ needs.build.outputs.version }}" \
158
- --notes "$(cat << 'EOM'
159
- ${{ needs.build.outputs.changelog }}
160
- EOM
161
- )"
0 commit comments