Skip to content

Commit 6a67606

Browse files
Merge pull request #108 from yusufugurozbek/next
Release 1.0.4 🔖
2 parents 98964dd + 9d9b70a commit 6a67606

19 files changed

+525
-406
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ updates:
66
# Maintain dependencies for Gradle dependencies
77
- package-ecosystem: "gradle"
88
directory: "/"
9+
target-branch: "next"
910
schedule:
1011
interval: "daily"
1112
# Maintain dependencies for GitHub Actions
1213
- package-ecosystem: "github-actions"
1314
directory: "/"
15+
target-branch: "next"
1416
schedule:
1517
interval: "daily"

.github/workflows/build.yml

Lines changed: 87 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,59 @@
11
# GitHub Actions Workflow created for testing and preparing the plugin release in following steps:
22
# - validate Gradle Wrapper,
3-
# - run test and verifyPlugin tasks,
4-
# - run buildPlugin task and prepare artifact for the further tests,
5-
# - run IntelliJ Plugin Verifier,
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,
67
# - create a draft release.
78
#
89
# Workflow is triggered on push and pull_request events.
910
#
10-
# Docs:
11-
# - GitHub Actions: https://help.github.com/en/actions
12-
# - IntelliJ Plugin Verifier GitHub Action: https://github.com/ChrisCarini/intellij-platform-plugin-verifier-action
11+
# GitHub Actions reference: https://help.github.com/en/actions
1312
#
1413
## JBIJPPTPL
1514

1615
name: Build
17-
on: [push, pull_request]
16+
on:
17+
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests)
18+
push:
19+
branches: [main]
20+
# Trigger the workflow on any pull request
21+
pull_request:
22+
1823
jobs:
1924

2025
# Run Gradle Wrapper Validation Action to verify the wrapper's checksum
21-
gradleValidation:
22-
name: Gradle Wrapper
23-
runs-on: ubuntu-latest
24-
steps:
25-
26-
# Check out current repository
27-
- name: Fetch Sources
28-
uses: actions/checkout@v3
29-
30-
# Validate wrapper
31-
- name: Gradle Wrapper Validation
32-
uses: gradle/wrapper-validation-action@v1.0.5
33-
34-
# Run verifyPlugin and test Gradle tasks
35-
test:
36-
name: Test
37-
needs: gradleValidation
38-
runs-on: ubuntu-latest
39-
steps:
40-
41-
# Setup Java 11 environment for the next steps
42-
- name: Setup Java
43-
uses: actions/setup-java@v3
44-
with:
45-
distribution: zulu
46-
java-version: 11
47-
48-
# Check out current repository
49-
- name: Fetch Sources
50-
uses: actions/checkout@v3
51-
52-
# Cache Gradle dependencies
53-
- name: Setup Gradle Dependencies Cache
54-
uses: actions/cache@v3
55-
with:
56-
path: ~/.gradle/caches
57-
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
58-
59-
# Cache Gradle Wrapper
60-
- name: Setup Gradle Wrapper Cache
61-
uses: actions/cache@v3
62-
with:
63-
path: ~/.gradle/wrapper
64-
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
65-
66-
# Run detekt, ktlint and tests
67-
- name: Run Linters and Test
68-
run: ./gradlew check
69-
70-
# Run verifyPlugin Gradle task
71-
- name: Verify Plugin
72-
run: ./gradlew verifyPlugin
73-
74-
# Build plugin with buildPlugin Gradle task and provide the artifact for the next workflow jobs
75-
# Requires test job to be passed
26+
# Run verifyPlugin, IntelliJ Plugin Verifier, and test Gradle tasks
27+
# Build plugin and provide the artifact for the next workflow jobs
7628
build:
7729
name: Build
78-
needs: test
7930
runs-on: ubuntu-latest
8031
outputs:
81-
name: ${{ steps.properties.outputs.name }}
8232
version: ${{ steps.properties.outputs.version }}
8333
changelog: ${{ steps.properties.outputs.changelog }}
84-
artifact: ${{ steps.properties.outputs.artifact }}
8534
steps:
8635

87-
# Setup Java 11 environment for the next steps
88-
- name: Setup Java
89-
uses: actions/setup-java@v3
90-
with:
91-
distribution: zulu
92-
java-version: 11
36+
# Free GitHub Actions Environment Disk Space
37+
- name: Maximize Build Space
38+
run: |
39+
sudo rm -rf /usr/share/dotnet
40+
sudo rm -rf /usr/local/lib/android
41+
sudo rm -rf /opt/ghc
9342
9443
# Check out current repository
9544
- name: Fetch Sources
9645
uses: actions/checkout@v3
9746

98-
# Cache Gradle Dependencies
99-
- name: Setup Gradle Dependencies Cache
100-
uses: actions/cache@v3
101-
with:
102-
path: ~/.gradle/caches
103-
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
47+
# Validate wrapper
48+
- name: Gradle Wrapper Validation
49+
uses: gradle/wrapper-validation-action@v1.0.5
10450

105-
# Cache Gradle Wrapper
106-
- name: Setup Gradle Wrapper Cache
107-
uses: actions/cache@v3
51+
# Setup Java 17 environment for the next steps
52+
- name: Setup Java
53+
uses: actions/setup-java@v3
10854
with:
109-
path: ~/.gradle/wrapper
110-
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
55+
distribution: zulu
56+
java-version: 17
11157

11258
# Set environment variables
11359
- name: Export Properties
@@ -121,86 +67,82 @@ jobs:
12167
CHANGELOG="${CHANGELOG//'%'/'%25'}"
12268
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
12369
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
124-
ARTIFACT="${NAME}-${VERSION}.zip"
12570
12671
echo "::set-output name=version::$VERSION"
12772
echo "::set-output name=name::$NAME"
12873
echo "::set-output name=changelog::$CHANGELOG"
129-
echo "::set-output name=artifact::$ARTIFACT"
74+
echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier"
13075
131-
# Build artifact using buildPlugin Gradle task
132-
- name: Build Plugin
133-
run: ./gradlew buildPlugin
76+
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
13477
135-
# Upload plugin artifact to make it available in the next jobs
136-
- name: Upload artifact
78+
# Run tests
79+
- name: Run Tests
80+
run: ./gradlew check
81+
82+
# Collect Tests Result of failed tests
83+
- name: Collect Tests Result
84+
if: ${{ failure() }}
13785
uses: actions/upload-artifact@v3
13886
with:
139-
name: plugin-artifact
140-
path: ./build/distributions/${{ steps.properties.outputs.artifact }}
141-
142-
# Verify built plugin using IntelliJ Plugin Verifier tool
143-
# Requires build job to be passed
144-
verify:
145-
name: Verify
146-
needs: build
147-
runs-on: ubuntu-latest
148-
steps:
87+
name: tests-result
88+
path: ${{ github.workspace }}/build/reports/tests
14989

150-
# Setup Java 11 environment for the next steps
151-
- name: Setup Java
152-
uses: actions/setup-java@v3
90+
# Upload Kover report to CodeCov
91+
- name: Upload Code Coverage Report
92+
uses: codecov/codecov-action@v3
15393
with:
154-
distribution: zulu
155-
java-version: 11
94+
files: ${{ github.workspace }}/build/reports/kover/xml/report.xml
15695

157-
# Check out current repository
158-
- name: Fetch Sources
159-
uses: actions/checkout@v3
160-
161-
# Cache Gradle Dependencies
162-
- name: Setup Gradle Dependencies Cache
96+
# Cache Plugin Verifier IDEs
97+
- name: Setup Plugin Verifier IDEs Cache
16398
uses: actions/cache@v3
16499
with:
165-
path: ~/.gradle/caches
166-
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
100+
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
101+
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
167102

168-
# Cache Gradle Wrapper
169-
- name: Setup Gradle Wrapper Cache
170-
uses: actions/cache@v3
103+
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
104+
- name: Run Plugin Verification tasks
105+
run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
106+
107+
# Collect Plugin Verifier Result
108+
- name: Collect Plugin Verifier Result
109+
if: ${{ always() }}
110+
uses: actions/upload-artifact@v3
171111
with:
172-
path: ~/.gradle/wrapper
173-
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
112+
name: pluginVerifier-result
113+
path: ${{ github.workspace }}/build/reports/pluginVerifier
174114

175-
# Set environment variables
176-
- name: Export Properties
177-
id: properties
115+
# Run Qodana inspections
116+
- name: Qodana - Code Inspection
117+
uses: JetBrains/qodana-action@v2022.2.3
118+
119+
# Prepare plugin archive content for creating artifact
120+
- name: Prepare Plugin Artifact
121+
id: artifact
178122
shell: bash
179123
run: |
180-
PROPERTIES="$(./gradlew properties --console=plain -q)"
181-
IDE_VERSIONS="$(echo "$PROPERTIES" | grep "^pluginVerifierIdeVersions:" | base64)"
124+
cd ${{ github.workspace }}/build/distributions
125+
FILENAME=`ls *.zip`
126+
unzip "$FILENAME" -d content
182127
183-
echo "::set-output name=ideVersions::$IDE_VERSIONS"
184-
echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier"
128+
echo "::set-output name=filename::${FILENAME:0:-4}"
185129
186-
# Cache Plugin Verifier IDEs
187-
- name: Setup Plugin Verifier IDEs Cache
188-
uses: actions/cache@v3
130+
# Store already-built plugin as an artifact for downloading
131+
- name: Upload artifact
132+
uses: actions/upload-artifact@v3
189133
with:
190-
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
191-
key: ${{ runner.os }}-plugin-verifier-${{ steps.properties.outputs.ideVersions }}
192-
193-
# Run IntelliJ Plugin Verifier action using GitHub Action
194-
- name: Verify Plugin
195-
run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
134+
name: ${{ steps.artifact.outputs.filename }}
135+
path: ./build/distributions/content/*/*
196136

197137
# Prepare a draft release for GitHub Releases page for the manual verification
198138
# If accepted and published, release workflow would be triggered
199139
releaseDraft:
200140
name: Release Draft
201141
if: github.event_name != 'pull_request'
202-
needs: [build, verify]
142+
needs: build
203143
runs-on: ubuntu-latest
144+
permissions:
145+
contents: write
204146
steps:
205147

206148
# Check out current repository
@@ -212,38 +154,19 @@ jobs:
212154
env:
213155
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
214156
run: |
215-
curl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
216-
| tr '\r\n' ' ' \
217-
| jq '.[] | select(.draft == true) | .id' \
218-
| xargs -I '{}' \
219-
curl -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases/{}
157+
gh api repos/{owner}/{repo}/releases \
158+
--jq '.[] | select(.draft == true) | .id' \
159+
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
220160
221161
# Create new release draft - which is not publicly visible and requires manual acceptance
222162
- name: Create Release Draft
223-
id: createDraft
224-
uses: actions/create-release@v1.1.4
225163
env:
226164
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
227-
with:
228-
tag_name: v${{ needs.build.outputs.version }}
229-
release_name: v${{ needs.build.outputs.version }}
230-
body: ${{ needs.build.outputs.changelog }}
231-
draft: true
232-
233-
# Download plugin artifact provided by the previous job
234-
- name: Download Artifact
235-
uses: actions/download-artifact@v3
236-
with:
237-
name: plugin-artifact
238-
239-
# Upload artifact as a release asset
240-
- name: Upload Release Asset
241-
id: upload-release-asset
242-
uses: actions/upload-release-asset@v1.0.2
243-
env:
244-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
245-
with:
246-
upload_url: ${{ steps.createDraft.outputs.upload_url }}
247-
asset_path: ./${{ needs.build.outputs.artifact }}
248-
asset_name: ${{ needs.build.outputs.artifact }}
249-
asset_content_type: application/zip
165+
run: |
166+
gh release create v${{ needs.build.outputs.version }} \
167+
--draft \
168+
--title "v${{ needs.build.outputs.version }}" \
169+
--notes "$(cat << 'EOM'
170+
${{ needs.build.outputs.changelog }}
171+
EOM
172+
)"

0 commit comments

Comments
 (0)