Skip to content

Commit dbb02f5

Browse files
committed
Merge branch 'master' into update-from-template-merged
2 parents eeb917d + 7cf4f90 commit dbb02f5

18 files changed

+1160
-2
lines changed

.github/workflows/check-build.yml

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

.github/workflows/release.yml

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

.github/workflows/sonar.yml

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

0 commit comments

Comments
 (0)