Skip to content

Commit 9b45ac8

Browse files
committed
Merge branch 'master' into update-from-template-merged
2 parents 7e9fd4e + 44e70e2 commit 9b45ac8

18 files changed

+1169
-2
lines changed

.github/workflows/check-build.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
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+
27+
strategy:
28+
matrix:
29+
java: [21]
30+
distribution: [temurin]
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Set up JDK
36+
uses: actions/setup-java@v4
37+
with:
38+
distribution: ${{ matrix.distribution }}
39+
java-version: ${{ matrix.java }}
40+
cache: 'gradle'
41+
42+
- name: Build
43+
run: ./gradlew build buildPlugin --info
44+
45+
- name: Try upload test reports when failure occurs
46+
uses: actions/upload-artifact@v4
47+
if: failure()
48+
with:
49+
name: test-reports-${{ matrix.java }}
50+
path: build/reports/tests/test/**
51+
52+
- name: Check for uncommited changes
53+
run: |
54+
if [[ "$(git status --porcelain)" != "" ]]; then
55+
echo ----------------------------------------
56+
echo git status
57+
echo ----------------------------------------
58+
git status
59+
echo ----------------------------------------
60+
echo git diff
61+
echo ----------------------------------------
62+
git diff
63+
echo ----------------------------------------
64+
echo Troubleshooting
65+
echo ----------------------------------------
66+
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && mvn -B clean package"
67+
exit 1
68+
fi
69+
70+
- name: Upload plugin files
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: plugin-files-java-${{ matrix.java }}
74+
path: build/libs/template-placeholder-*.jar
75+
if-no-files-found: error
76+
77+
checkstyle:
78+
runs-on: ubuntu-latest
79+
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
80+
timeout-minutes: 15
81+
82+
strategy:
83+
matrix:
84+
java: [21]
85+
distribution: [temurin]
86+
87+
steps:
88+
- uses: actions/checkout@v4
89+
90+
- name: Set up JDK
91+
uses: actions/setup-java@v4
92+
with:
93+
distribution: ${{ matrix.distribution }}
94+
java-version: ${{ matrix.java }}
95+
cache: 'gradle'
96+
97+
- name: Run Checkstyle
98+
run: ./gradlew checkstyleMain checkstyleTest -PcheckstyleEnabled
99+
100+
pmd:
101+
runs-on: ubuntu-latest
102+
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
103+
timeout-minutes: 15
104+
105+
strategy:
106+
matrix:
107+
java: [21]
108+
distribution: [temurin]
109+
110+
steps:
111+
- uses: actions/checkout@v4
112+
113+
- name: Set up JDK
114+
uses: actions/setup-java@v4
115+
with:
116+
distribution: ${{ matrix.distribution }}
117+
java-version: ${{ matrix.java }}
118+
cache: 'gradle'
119+
120+
- name: Run PMD
121+
run: ./gradlew pmdMain pmdTest -PpmdEnabled
122+
123+
- name: Upload report
124+
if: always()
125+
uses: actions/upload-artifact@v4
126+
with:
127+
name: pmd-report
128+
if-no-files-found: ignore
129+
path: |
130+
build/reports/pmd/*.html

.github/workflows/release.yml

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

.github/workflows/sonar.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Sonar
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+
env:
23+
SONARCLOUD_ORG: ${{ github.event.organization.login }}
24+
SONARCLOUD_HOST: https://sonarcloud.io
25+
26+
jobs:
27+
token-check:
28+
runs-on: ubuntu-latest
29+
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'renovate/')) }}
30+
timeout-minutes: 5
31+
outputs:
32+
hasToken: ${{ steps.check-token.outputs.has }}
33+
steps:
34+
- id: check-token
35+
run: |
36+
[ -z $SONAR_TOKEN ] && echo "has=false" || echo "has=true" >> "$GITHUB_OUTPUT"
37+
env:
38+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
39+
40+
sonar-scan:
41+
runs-on: ubuntu-latest
42+
needs: token-check
43+
if: ${{ needs.token-check.outputs.hasToken }}
44+
timeout-minutes: 30
45+
steps:
46+
- uses: actions/checkout@v4
47+
with:
48+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
49+
50+
- name: Set up JDK
51+
uses: actions/setup-java@v4
52+
with:
53+
distribution: 'temurin'
54+
java-version: 21
55+
56+
- name: Cache SonarCloud packages
57+
uses: actions/cache@v4
58+
with:
59+
path: ~/.sonar/cache
60+
key: ${{ runner.os }}-sonar
61+
restore-keys: ${{ runner.os }}-sonar
62+
63+
- name: Cache Gradle packages
64+
uses: actions/cache@v4
65+
with:
66+
path: ~/.gradle/caches
67+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
68+
restore-keys: ${{ runner.os }}-gradle
69+
70+
- name: Build
71+
run: |
72+
./gradlew build sonarqube -x test --info \
73+
-Dsonar.projectKey=${{ env.SONARCLOUD_ORG }}_${{ github.event.repository.name }} \
74+
-Dsonar.organization=${{ env.SONARCLOUD_ORG }} \
75+
-Dsonar.host.url=${{ env.SONARCLOUD_HOST }}
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
78+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)