Skip to content

Commit 610c69e

Browse files
committed
Merge branch 'master' into update-from-template-xdev-software/java-template-merged
2 parents 2310522 + e5c0702 commit 610c69e

26 files changed

+1417
-28
lines changed

.github/workflows/check-build.yml

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
name: Check Build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ develop ]
7+
paths-ignore:
8+
- '**.md'
9+
- '.config/**'
10+
- '.github/**'
11+
- '.idea/**'
12+
- 'assets/**'
13+
pull_request:
14+
branches: [ develop ]
15+
paths-ignore:
16+
- '**.md'
17+
- '.config/**'
18+
- '.github/**'
19+
- '.idea/**'
20+
- 'assets/**'
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 30
26+
strategy:
27+
matrix:
28+
java: [21]
29+
distribution: [temurin]
30+
steps:
31+
- uses: actions/checkout@v5
32+
33+
- name: Set up JDK
34+
uses: actions/setup-java@v5
35+
with:
36+
distribution: ${{ matrix.distribution }}
37+
java-version: ${{ matrix.java }}
38+
39+
- name: Cache Gradle
40+
uses: actions/cache@v4
41+
with:
42+
path: |
43+
~/.gradle/caches
44+
~/.gradle/wrapper
45+
key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
46+
restore-keys: |
47+
${{ runner.os }}-gradle-build-
48+
49+
- name: Build
50+
run: ./gradlew build buildPlugin --info --stacktrace
51+
52+
- name: Try upload test reports when failure occurs
53+
uses: actions/upload-artifact@v4
54+
if: failure()
55+
with:
56+
name: test-reports-${{ matrix.java }}
57+
path: build/reports/tests/test/**
58+
59+
- name: Check for uncommited changes
60+
run: |
61+
if [[ "$(git status --porcelain)" != "" ]]; then
62+
echo ----------------------------------------
63+
echo git status
64+
echo ----------------------------------------
65+
git status
66+
echo ----------------------------------------
67+
echo git diff
68+
echo ----------------------------------------
69+
git diff
70+
echo ----------------------------------------
71+
echo Troubleshooting
72+
echo ----------------------------------------
73+
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && mvn -B clean package"
74+
exit 1
75+
fi
76+
77+
- name: Upload plugin files
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: plugin-files-java-${{ matrix.java }}
81+
path: build/libs/template-placeholder-*.jar
82+
if-no-files-found: error
83+
84+
checkstyle:
85+
runs-on: ubuntu-latest
86+
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
87+
timeout-minutes: 15
88+
strategy:
89+
matrix:
90+
java: [21]
91+
distribution: [temurin]
92+
steps:
93+
- uses: actions/checkout@v5
94+
95+
- name: Set up JDK
96+
uses: actions/setup-java@v5
97+
with:
98+
distribution: ${{ matrix.distribution }}
99+
java-version: ${{ matrix.java }}
100+
101+
- name: Cache Gradle
102+
uses: actions/cache@v4
103+
with:
104+
path: |
105+
~/.gradle/caches
106+
~/.gradle/wrapper
107+
key: ${{ runner.os }}-gradle-checkstyle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
108+
restore-keys: |
109+
${{ runner.os }}-gradle-checkstyle-
110+
111+
- name: Run Checkstyle
112+
run: ./gradlew checkstyleMain checkstyleTest -PcheckstyleEnabled --stacktrace
113+
114+
pmd:
115+
runs-on: ubuntu-latest
116+
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
117+
timeout-minutes: 15
118+
strategy:
119+
matrix:
120+
java: [21]
121+
distribution: [temurin]
122+
steps:
123+
- uses: actions/checkout@v5
124+
125+
- name: Set up JDK
126+
uses: actions/setup-java@v5
127+
with:
128+
distribution: ${{ matrix.distribution }}
129+
java-version: ${{ matrix.java }}
130+
131+
- name: Run PMD
132+
run: ./gradlew pmdMain pmdTest -PpmdEnabled --stacktrace -x test
133+
134+
- name: Cache Gradle
135+
uses: actions/cache@v4
136+
with:
137+
path: |
138+
~/.gradle/caches
139+
~/.gradle/wrapper
140+
key: ${{ runner.os }}-gradle-pmd-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
141+
restore-keys: |
142+
${{ runner.os }}-gradle-pmd-
143+
144+
- name: Upload report
145+
if: always()
146+
uses: actions/upload-artifact@v4
147+
with:
148+
name: pmd-report
149+
if-no-files-found: ignore
150+
path: |
151+
build/reports/pmd/*.html
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Check IDE Compatibility
2+
3+
on:
4+
schedule:
5+
- cron: '55 8 * * 1'
6+
workflow_dispatch:
7+
8+
jobs:
9+
check-ide-compatibility:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 45
12+
steps:
13+
- name: Free up disk space
14+
run: |
15+
sudo df -h
16+
sudo docker system prune -af || true
17+
sudo rm -rf /usr/share/dotnet \
18+
/usr/local/.ghcup \
19+
/usr/local/swift \
20+
/usr/share/swift \
21+
/usr/lib/jvm \
22+
/usr/local/lib/android \
23+
/usr/lib/google-cloud-sdk \
24+
/usr/local/share/boost \
25+
/usr/local/share/powershell \
26+
/usr/local/share/chromium \
27+
/usr/local/lib/node_modules \
28+
/usr/lib/mono \
29+
/usr/lib/heroku \
30+
/usr/lib/firefox \
31+
/usr/share/miniconda \
32+
/opt/microsoft \
33+
/opt/chrome \
34+
/opt/pipx \
35+
"$AGENT_TOOLSDIRECTORY" || true
36+
sudo df -h
37+
38+
- uses: actions/checkout@v5
39+
40+
- name: Set up JDK
41+
uses: actions/setup-java@v5
42+
with:
43+
distribution: 'temurin'
44+
java-version: 21
45+
46+
- name: Cache Gradle
47+
uses: actions/cache@v4
48+
with:
49+
path: |
50+
~/.gradle/caches
51+
~/.gradle/wrapper
52+
key: ${{ runner.os }}-gradle-ide-compatibility-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
53+
restore-keys: |
54+
${{ runner.os }}-gradle-ide-compatibility-
55+
56+
- name: Check compatibility
57+
run: ./gradlew verifyPlugin --info --stacktrace
58+
59+
- name: Upload report
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: plugin-verifier-reports
63+
path: build/reports/pluginVerifier/**
64+
if-no-files-found: warn

.github/workflows/release.yml

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
check_code:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 30
15+
steps:
16+
- uses: actions/checkout@v5
17+
18+
- name: Set up JDK
19+
uses: actions/setup-java@v5
20+
with:
21+
java-version: '21'
22+
distribution: 'temurin'
23+
24+
- name: Try restore Gradle Cache
25+
uses: actions/cache/restore@v4
26+
with:
27+
path: |
28+
~/.gradle/caches
29+
~/.gradle/wrapper
30+
key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
31+
restore-keys: |
32+
${{ runner.os }}-gradle-build-
33+
34+
- name: Build
35+
run: ./gradlew build buildPlugin --info --stacktrace
36+
37+
- name: Check for uncommited changes
38+
run: |
39+
if [[ "$(git status --porcelain)" != "" ]]; then
40+
echo ----------------------------------------
41+
echo git status
42+
echo ----------------------------------------
43+
git status
44+
echo ----------------------------------------
45+
echo git diff
46+
echo ----------------------------------------
47+
git diff
48+
echo ----------------------------------------
49+
echo Troubleshooting
50+
echo ----------------------------------------
51+
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && mvn -B clean package"
52+
exit 1
53+
fi
54+
55+
prepare_release:
56+
runs-on: ubuntu-latest
57+
needs: [check_code]
58+
timeout-minutes: 10
59+
outputs:
60+
upload_url: ${{ steps.create_release.outputs.upload_url }}
61+
steps:
62+
- uses: actions/checkout@v5
63+
64+
- name: Configure Git
65+
run: |
66+
git config --global user.email "[email protected]"
67+
git config --global user.name "GitHub Actions"
68+
69+
- name: UN-Snap version and output
70+
id: version
71+
run: |
72+
originalVersion=$(grep -Po 'pluginVersion=\K.*' gradle.properties)
73+
newVersion="$(echo $originalVersion | cut -d '-' -f1)"
74+
echo "New version: $newVersion"
75+
sed -i "s/pluginVersion=$originalVersion/pluginVersion=$newVersion/" gradle.properties
76+
77+
version=$newVersion
78+
echo "release=$version" >> $GITHUB_OUTPUT
79+
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
80+
81+
echo "Contents of gradle.properties"
82+
cat gradle.properties
83+
84+
- name: Commit and Push
85+
run: |
86+
git add -A
87+
git commit -m "Release ${{ steps.version.outputs.release }}"
88+
git push origin
89+
git tag v${{ steps.version.outputs.release }}
90+
git push origin --tags
91+
92+
- name: Create Release
93+
id: create_release
94+
uses: shogo82148/actions-create-release@7b89596097b26731bda0852f1504f813499079ee # v1
95+
with:
96+
tag_name: v${{ steps.version.outputs.release }}
97+
release_name: v${{ steps.version.outputs.release }}
98+
commitish: master
99+
body: |
100+
## [Changelog](https://github.com/xdev-software/${{ github.event.repository.name }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }})
101+
See [Changelog#v${{ steps.version.outputs.release }}](https://github.com/xdev-software/${{ github.event.repository.name }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) for more information.
102+
103+
## Installation
104+
The plugin is listed on the [Marketplace](https://plugins.jetbrains.com/plugin/pluginId).
105+
106+
Open the plugin Marketplace in your IDE (``File > Settings > Plugins > Marketplace``), search for the plugin and hit the install button.
107+
108+
Alternatively you can also download the jar from the marketplace website.
109+
110+
publish:
111+
runs-on: ubuntu-latest
112+
needs: [prepare_release]
113+
timeout-minutes: 60
114+
steps:
115+
- uses: actions/checkout@v5
116+
117+
- name: Set up JDK
118+
uses: actions/setup-java@v5
119+
with:
120+
distribution: 'temurin'
121+
java-version: 21
122+
123+
- name: Init Git and pull
124+
run: |
125+
git config --global user.email "[email protected]"
126+
git config --global user.name "GitHub Actions"
127+
git pull
128+
129+
- name: Publish Plugin
130+
env:
131+
PUBLISH_TOKEN: ${{ secrets.JETBRAINS_MARKETPLACE_PUBLISH_TOKEN }}
132+
CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_MARKETPLACE_CERTIFICATE_CHAIN }}
133+
PRIVATE_KEY: ${{ secrets.JETBRAINS_MARKETPLACE_PRIVATE_KEY }}
134+
PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_MARKETPLACE_PRIVATE_KEY_PASSWORD }}
135+
run: ./gradlew publishPlugin --info --stacktrace
136+
137+
- name: Upload plugin files
138+
uses: actions/upload-artifact@v4
139+
with:
140+
name: plugin-files
141+
path: build/distributions/*
142+
143+
after_release:
144+
runs-on: ubuntu-latest
145+
needs: [publish]
146+
timeout-minutes: 10
147+
steps:
148+
- uses: actions/checkout@v5
149+
150+
- name: Init Git and pull
151+
run: |
152+
git config --global user.email "[email protected]"
153+
git config --global user.name "GitHub Actions"
154+
git pull
155+
156+
- name: Inc Version and SNAP root
157+
run: |
158+
originalVersion=$(grep -Po 'pluginVersion=\K.*' gradle.properties)
159+
newVersion="$(echo $originalVersion | cut -d '-' -f1 | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{$NF=sprintf("%0*d", length($NF), ($NF+1)); print}')-SNAPSHOT"
160+
echo "New version: $newVersion"
161+
sed -i "s/pluginVersion=$originalVersion/pluginVersion=$newVersion/" gradle.properties
162+
163+
echo "Contents of gradle.properties"
164+
cat gradle.properties
165+
166+
- name: Git Commit and Push
167+
run: |
168+
git add -A
169+
git commit -m "Preparing for next development iteration"
170+
git push origin
171+
172+
- name: pull-request
173+
env:
174+
GH_TOKEN: ${{ github.token }}
175+
run: |
176+
gh_pr_up() {
177+
gh pr create "$@" || gh pr edit "$@"
178+
}
179+
gh_pr_up -B "develop" \
180+
--title "Sync back" \
181+
--body "An automated PR to sync changes back"

0 commit comments

Comments
 (0)