Skip to content

Commit a48a55f

Browse files
committed
ci: update all workflows from upstream
1 parent 6f6f6a8 commit a48a55f

File tree

1 file changed

+86
-62
lines changed

1 file changed

+86
-62
lines changed

.github/workflows/build.yml

+86-62
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@ on:
2121
pull_request:
2222

2323
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
2825
build:
2926
name: Build
3027
runs-on: ubuntu-latest
3128
outputs:
3229
version: ${{ steps.properties.outputs.version }}
3330
changelog: ${{ steps.properties.outputs.changelog }}
31+
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
3432
steps:
33+
3534
# Check out current repository
3635
- name: Fetch Sources
3736
uses: actions/checkout@v4
@@ -61,16 +60,62 @@ jobs:
6160
PROPERTIES="$(./gradlew properties --console=plain -q)"
6261
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
6362
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
64-
63+
6564
echo "version=$VERSION" >> $GITHUB_OUTPUT
6665
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
6766
6867
echo "changelog<<EOF" >> $GITHUB_OUTPUT
6968
echo "$CHANGELOG" >> $GITHUB_OUTPUT
7069
echo "EOF" >> $GITHUB_OUTPUT
71-
70+
7271
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
7372
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+
74119
# Run tests
75120
- name: Run Tests
76121
run: ./gradlew check
@@ -83,22 +128,53 @@ jobs:
83128
name: tests-result
84129
path: ${{ github.workspace }}/build/reports/tests
85130

86-
# Upload Kover report to CodeCov
131+
# Upload the Kover report to CodeCov
87132
- name: Upload Code Coverage Report
88133
uses: codecov/codecov-action@v3
89134
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
91167

92168
# Cache Plugin Verifier IDEs
93169
- name: Setup Plugin Verifier IDEs Cache
94170
uses: actions/cache@v3
95171
with:
96-
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
172+
path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
97173
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
98174

99175
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
100176
- 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 }}
102178

103179
# Collect Plugin Verifier Result
104180
- name: Collect Plugin Verifier Result
@@ -107,55 +183,3 @@ jobs:
107183
with:
108184
name: pluginVerifier-result
109185
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

Comments
 (0)