Skip to content

Commit 0312ab7

Browse files
committed
swtich over to gradle build
1 parent 5421ecb commit 0312ab7

File tree

118 files changed

+7242
-8671
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+7242
-8671
lines changed

.bzrignore

-23
This file was deleted.

.github/dependabot.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Dependabot configuration:
2+
# https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates
3+
4+
version: 2
5+
updates:
6+
- package-ecosystem: "gradle"
7+
directory: "/"
8+
schedule:
9+
interval: "daily"

.github/workflows/build.yml

+246
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
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 buildPlugin task and prepare artifact for the further tests,
5+
# - run IntelliJ Plugin Verifier,
6+
# - create a draft release.
7+
#
8+
# Workflow is triggered on push and pull_request events.
9+
#
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
13+
#
14+
## JBIJPPTPL
15+
16+
name: Build
17+
on: [push, pull_request]
18+
jobs:
19+
20+
# 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@v2
29+
30+
# Validate wrapper
31+
- name: Gradle Wrapper Validation
32+
uses: gradle/[email protected]
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 1.8 environment for the next steps
42+
- name: Setup Java
43+
uses: actions/setup-java@v1
44+
with:
45+
java-version: 1.8
46+
47+
# Check out current repository
48+
- name: Fetch Sources
49+
uses: actions/checkout@v2
50+
51+
# Cache Gradle dependencies
52+
- name: Setup Gradle Dependencies Cache
53+
uses: actions/cache@v2
54+
with:
55+
path: ~/.gradle/caches
56+
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
57+
58+
# Cache Gradle Wrapper
59+
- name: Setup Gradle Wrapper Cache
60+
uses: actions/cache@v2
61+
with:
62+
path: ~/.gradle/wrapper
63+
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
64+
65+
# Run detekt, ktlint and tests
66+
- name: Run Linters and Test
67+
run: ./gradlew check
68+
69+
# Run verifyPlugin Gradle task
70+
- name: Verify Plugin
71+
run: ./gradlew verifyPlugin
72+
73+
# Build plugin with buildPlugin Gradle task and provide the artifact for the next workflow jobs
74+
# Requires test job to be passed
75+
build:
76+
name: Build
77+
needs: test
78+
runs-on: ubuntu-latest
79+
outputs:
80+
name: ${{ steps.properties.outputs.name }}
81+
version: ${{ steps.properties.outputs.version }}
82+
changelog: ${{ steps.properties.outputs.changelog }}
83+
artifact: ${{ steps.properties.outputs.artifact }}
84+
steps:
85+
86+
# Setup Java 1.8 environment for the next steps
87+
- name: Setup Java
88+
uses: actions/setup-java@v1
89+
with:
90+
java-version: 1.8
91+
92+
# Check out current repository
93+
- name: Fetch Sources
94+
uses: actions/checkout@v2
95+
96+
# Cache Gradle Dependencies
97+
- name: Setup Gradle Dependencies Cache
98+
uses: actions/cache@v2
99+
with:
100+
path: ~/.gradle/caches
101+
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
102+
103+
# Cache Gradle Wrapper
104+
- name: Setup Gradle Wrapper Cache
105+
uses: actions/cache@v2
106+
with:
107+
path: ~/.gradle/wrapper
108+
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
109+
110+
# Set environment variables
111+
- name: Export Properties
112+
id: properties
113+
shell: bash
114+
run: |
115+
PROPERTIES="$(./gradlew properties --console=plain -q)"
116+
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
117+
NAME="$(echo "$PROPERTIES" | grep "^pluginName_:" | cut -f2- -d ' ')"
118+
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
119+
CHANGELOG="${CHANGELOG//'%'/'%25'}"
120+
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
121+
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
122+
ARTIFACT="${NAME}-${VERSION}.zip"
123+
124+
echo "::set-output name=version::$VERSION"
125+
echo "::set-output name=name::$NAME"
126+
echo "::set-output name=changelog::$CHANGELOG"
127+
echo "::set-output name=artifact::$ARTIFACT"
128+
129+
# Build artifact using buildPlugin Gradle task
130+
- name: Build Plugin
131+
run: ./gradlew buildPlugin
132+
133+
# Upload plugin artifact to make it available in the next jobs
134+
- name: Upload artifact
135+
uses: actions/upload-artifact@v1
136+
with:
137+
name: plugin-artifact
138+
path: ./build/distributions/${{ needs.build.outputs.artifact }}
139+
140+
# Verify built plugin using IntelliJ Plugin Verifier tool
141+
# Requires build job to be passed
142+
verify:
143+
name: Verify
144+
needs: build
145+
runs-on: ubuntu-latest
146+
steps:
147+
148+
# Setup Java 1.8 environment for the next steps
149+
- name: Setup Java
150+
uses: actions/setup-java@v1
151+
with:
152+
java-version: 1.8
153+
154+
# Check out current repository
155+
- name: Fetch Sources
156+
uses: actions/checkout@v2
157+
158+
# Cache Gradle Dependencies
159+
- name: Setup Gradle Dependencies Cache
160+
uses: actions/cache@v2
161+
with:
162+
path: ~/.gradle/caches
163+
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
164+
165+
# Cache Gradle Wrapper
166+
- name: Setup Gradle Wrapper Cache
167+
uses: actions/cache@v2
168+
with:
169+
path: ~/.gradle/wrapper
170+
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
171+
172+
# Set environment variables
173+
- name: Export Properties
174+
id: properties
175+
shell: bash
176+
run: |
177+
PROPERTIES="$(./gradlew properties --console=plain -q)"
178+
IDE_VERSIONS="$(echo "$PROPERTIES" | grep "^pluginVerifierIdeVersions:" | base64)"
179+
180+
echo "::set-output name=ideVersions::$IDE_VERSIONS"
181+
echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier"
182+
183+
# Cache Plugin Verifier IDEs
184+
- name: Setup Plugin Verifier IDEs Cache
185+
uses: actions/cache@v2
186+
with:
187+
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
188+
key: ${{ runner.os }}-plugin-verifier-${{ steps.properties.outputs.ideVersions }}
189+
190+
# Run IntelliJ Plugin Verifier action using GitHub Action
191+
- name: Verify Plugin
192+
run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
193+
194+
# Prepare a draft release for GitHub Releases page for the manual verification
195+
# If accepted and published, release workflow would be triggered
196+
releaseDraft:
197+
name: Release Draft
198+
if: github.event_name != 'pull_request'
199+
needs: [build, verify]
200+
runs-on: ubuntu-latest
201+
steps:
202+
203+
# Check out current repository
204+
- name: Fetch Sources
205+
uses: actions/checkout@v2
206+
207+
# Remove old release drafts by using the curl request for the available releases with draft flag
208+
- name: Remove Old Release Drafts
209+
env:
210+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
211+
run: |
212+
curl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
213+
| tr '\r\n' ' ' \
214+
| jq '.[] | select(.draft == true) | .id' \
215+
| xargs -I '{}' \
216+
curl -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases/{}
217+
218+
# Create new release draft - which is not publicly visible and requires manual acceptance
219+
- name: Create Release Draft
220+
id: createDraft
221+
uses: actions/create-release@v1
222+
env:
223+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
224+
with:
225+
tag_name: v${{ needs.build.outputs.version }}
226+
release_name: v${{ needs.build.outputs.version }}
227+
body: ${{ needs.build.outputs.changelog }}
228+
draft: true
229+
230+
# Download plugin artifact provided by the previous job
231+
- name: Download Artifact
232+
uses: actions/download-artifact@v2
233+
with:
234+
name: plugin-artifact
235+
236+
# Upload artifact as a release asset
237+
- name: Upload Release Asset
238+
id: upload-release-asset
239+
uses: actions/upload-release-asset@v1
240+
env:
241+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
242+
with:
243+
upload_url: ${{ steps.createDraft.outputs.upload_url }}
244+
asset_path: ./${{ needs.build.outputs.artifact }}
245+
asset_name: ${{ needs.build.outputs.artifact }}
246+
asset_content_type: application/zip

.github/workflows/release.yml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# GitHub Actions Workflow created for handling the release process based on the draft release prepared
2+
# with the Build workflow. Running the publishPlugin task requires the PUBLISH_TOKEN secret provided.
3+
4+
name: Release
5+
on:
6+
release:
7+
types: [prereleased, released]
8+
9+
jobs:
10+
11+
# Prepare and publish the plugin to the Marketplace repository
12+
release:
13+
name: Publish Plugin
14+
runs-on: ubuntu-latest
15+
steps:
16+
17+
# Setup Java 1.8 environment for the next steps
18+
- name: Setup Java
19+
uses: actions/setup-java@v1
20+
with:
21+
java-version: 1.8
22+
23+
# Check out current repository
24+
- name: Fetch Sources
25+
uses: actions/checkout@v2
26+
with:
27+
ref: ${{ github.event.release.tag_name }}
28+
29+
# Publish the plugin to the Marketplace
30+
- name: Publish Plugin
31+
env:
32+
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
33+
run: ./gradlew publishPlugin
34+
35+
# Patch changelog, commit and push to the current repository
36+
changelog:
37+
name: Update Changelog
38+
needs: release
39+
runs-on: ubuntu-latest
40+
steps:
41+
42+
# Setup Java 1.8 environment for the next steps
43+
- name: Setup Java
44+
uses: actions/setup-java@v1
45+
with:
46+
java-version: 1.8
47+
48+
# Check out current repository
49+
- name: Fetch Sources
50+
uses: actions/checkout@v2
51+
with:
52+
ref: ${{ github.event.release.tag_name }}
53+
54+
# Update Unreleased section with the current version
55+
- name: Patch Changelog
56+
run: ./gradlew patchChangelog
57+
58+
# Commit patched Changelog
59+
- name: Commit files
60+
run: |
61+
git config --local user.email "[email protected]"
62+
git config --local user.name "GitHub Action"
63+
git commit -m "Update changelog" -a
64+
65+
# Push changes
66+
- name: Push changes
67+
uses: ad-m/github-push-action@master
68+
with:
69+
branch: main
70+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.gradle
2+
.idea
3+
build

.run/Run IDE with Plugin.run.xml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run Plugin" type="GradleRunConfiguration" factoryName="Gradle">
3+
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
4+
<ExternalSystemSettings>
5+
<option name="executionName" />
6+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
7+
<option name="externalSystemIdString" value="GRADLE" />
8+
<option name="scriptParameters" value="" />
9+
<option name="taskDescriptions">
10+
<list />
11+
</option>
12+
<option name="taskNames">
13+
<list>
14+
<option value="runIde" />
15+
</list>
16+
</option>
17+
<option name="vmOptions" value="" />
18+
</ExternalSystemSettings>
19+
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
20+
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
21+
<DebugAllEnabled>false</DebugAllEnabled>
22+
<method v="2" />
23+
</configuration>
24+
</component>

0 commit comments

Comments
 (0)