-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into update-from-template-merged
- Loading branch information
Showing
18 changed files
with
1,160 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
name: Check Build | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ develop ] | ||
paths-ignore: | ||
- '**.md' | ||
- '.config/**' | ||
- '.github/**' | ||
- '.idea/**' | ||
- 'assets/**' | ||
pull_request: | ||
branches: [ develop ] | ||
paths-ignore: | ||
- '**.md' | ||
- '.config/**' | ||
- '.github/**' | ||
- '.idea/**' | ||
- 'assets/**' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
java: [21] | ||
distribution: [temurin] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: ${{ matrix.distribution }} | ||
java-version: ${{ matrix.java }} | ||
cache: 'gradle' | ||
|
||
- name: Build | ||
run: ./gradlew build buildPlugin --info | ||
|
||
- name: Try upload test reports when failure occurs | ||
uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: test-reports-${{ matrix.java }} | ||
path: build/reports/tests/test/** | ||
|
||
- name: Check for uncommited changes | ||
run: | | ||
if [[ "$(git status --porcelain)" != "" ]]; then | ||
echo ---------------------------------------- | ||
echo git status | ||
echo ---------------------------------------- | ||
git status | ||
echo ---------------------------------------- | ||
echo git diff | ||
echo ---------------------------------------- | ||
git diff | ||
echo ---------------------------------------- | ||
echo Troubleshooting | ||
echo ---------------------------------------- | ||
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && mvn -B clean package" | ||
exit 1 | ||
fi | ||
- name: Upload plugin files | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: plugin-files-java-${{ matrix.java }} | ||
path: build/libs/template-placeholder-*.jar | ||
if-no-files-found: error | ||
|
||
checkstyle: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }} | ||
|
||
strategy: | ||
matrix: | ||
java: [21] | ||
distribution: [temurin] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: ${{ matrix.distribution }} | ||
java-version: ${{ matrix.java }} | ||
cache: 'gradle' | ||
|
||
- name: Run Checkstyle | ||
run: ./gradlew checkstyleMain checkstyleTest -PcheckstyleEnabled | ||
|
||
pmd: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }} | ||
|
||
strategy: | ||
matrix: | ||
java: [21] | ||
distribution: [temurin] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: ${{ matrix.distribution }} | ||
java-version: ${{ matrix.java }} | ||
cache: 'gradle' | ||
|
||
- name: Run PMD | ||
run: ./gradlew pmdMain pmdTest -PpmdEnabled | ||
|
||
- name: Upload report | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: pmd-report | ||
if-no-files-found: ignore | ||
path: | | ||
build/reports/pmd/*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
check_code: # Validates the code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
cache: 'gradle' | ||
|
||
- name: Build | ||
run: ./gradlew build buildPlugin --info | ||
|
||
- name: Check for uncommited changes | ||
run: | | ||
if [[ "$(git status --porcelain)" != "" ]]; then | ||
echo ---------------------------------------- | ||
echo git status | ||
echo ---------------------------------------- | ||
git status | ||
echo ---------------------------------------- | ||
echo git diff | ||
echo ---------------------------------------- | ||
git diff | ||
echo ---------------------------------------- | ||
echo Troubleshooting | ||
echo ---------------------------------------- | ||
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && mvn -B clean package" | ||
exit 1 | ||
fi | ||
prepare_release: | ||
runs-on: ubuntu-latest | ||
needs: [check_code] | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
- name: UN-Snap version and output | ||
id: version | ||
run: | | ||
originalVersion=$(grep -Po 'pluginVersion=\K.*' gradle.properties) | ||
newVersion="$(echo $originalVersion | cut -d '-' -f1)" | ||
echo "New version: $newVersion" | ||
sed -i "s/pluginVersion=$originalVersion/pluginVersion=$newVersion/" gradle.properties | ||
version=$newVersion | ||
echo "release=$version" >> $GITHUB_OUTPUT | ||
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT | ||
echo "Contents of gradle.properties" | ||
cat gradle.properties | ||
- name: Commit and Push | ||
run: | | ||
git add -A | ||
git commit -m "Release ${{ steps.version.outputs.release }}" | ||
git push origin | ||
git tag v${{ steps.version.outputs.release }} | ||
git push origin --tags | ||
- name: Create Release | ||
id: create_release | ||
uses: shogo82148/actions-create-release@v1 | ||
with: | ||
tag_name: v${{ steps.version.outputs.release }} | ||
release_name: v${{ steps.version.outputs.release }} | ||
commitish: master | ||
body: | | ||
## [Changelog](https://github.com/xdev-software/${{ github.event.repository.name }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) | ||
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. | ||
## Installation | ||
The plugin is listed on the [Marketplace](https://plugins.jetbrains.com/plugin/pluginId). | ||
Open the plugin Marketplace in your IDE (``File > Settings > Plugins > Marketplace``), search for the plugin and hit the install button. | ||
Alternatively you can also download the jar from the marketplace website. | ||
publish: | ||
runs-on: ubuntu-latest | ||
needs: [prepare_release] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 21 | ||
cache: 'gradle' | ||
|
||
- name: Init Git and pull | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
git pull | ||
- name: Publish Plugin | ||
env: | ||
PUBLISH_TOKEN: ${{ secrets.JETBRAINS_MARKETPLACE_PUBLISH_TOKEN }} | ||
CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_MARKETPLACE_CERTIFICATE_CHAIN }} | ||
PRIVATE_KEY: ${{ secrets.JETBRAINS_MARKETPLACE_PRIVATE_KEY }} | ||
PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_MARKETPLACE_PRIVATE_KEY_PASSWORD }} | ||
run: ./gradlew publishPlugin --info --stacktrace | ||
|
||
- name: Upload plugin files | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: plugin-files | ||
path: build/distributions/* | ||
|
||
after_release: | ||
runs-on: ubuntu-latest | ||
needs: [publish] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Init Git and pull | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
git pull | ||
- name: Inc Version and SNAP root | ||
run: | | ||
originalVersion=$(grep -Po 'pluginVersion=\K.*' gradle.properties) | ||
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" | ||
echo "New version: $newVersion" | ||
sed -i "s/pluginVersion=$originalVersion/pluginVersion=$newVersion/" gradle.properties | ||
echo "Contents of gradle.properties" | ||
cat gradle.properties | ||
- name: Git Commit and Push | ||
run: | | ||
git add -A | ||
git commit -m "Preparing for next development iteration" | ||
git push origin | ||
- name: pull-request | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
gh_pr_up() { | ||
gh pr create "$@" || gh pr edit "$@" | ||
} | ||
gh_pr_up -B "develop" \ | ||
--title "Sync back" \ | ||
--body "An automated PR to sync changes back" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Sonar | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ develop ] | ||
paths-ignore: | ||
- '**.md' | ||
- '.config/**' | ||
- '.github/**' | ||
- '.idea/**' | ||
- 'assets/**' | ||
pull_request: | ||
branches: [ develop ] | ||
paths-ignore: | ||
- '**.md' | ||
- '.config/**' | ||
- '.github/**' | ||
- '.idea/**' | ||
- 'assets/**' | ||
|
||
env: | ||
SONARCLOUD_ORG: ${{ github.event.organization.login }} | ||
SONARCLOUD_HOST: https://sonarcloud.io | ||
|
||
jobs: | ||
token-check: | ||
runs-on: ubuntu-latest | ||
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'renovate/')) }} | ||
outputs: | ||
hasToken: ${{ steps.check-token.outputs.has }} | ||
steps: | ||
- id: check-token | ||
run: | | ||
[ -z $SONAR_TOKEN ] && echo "has=false" || echo "has=true" >> "$GITHUB_OUTPUT" | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
|
||
sonar-scan: | ||
runs-on: ubuntu-latest | ||
needs: token-check | ||
if: ${{ needs.token-check.outputs.hasToken }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 21 | ||
|
||
- name: Cache SonarCloud packages | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.sonar/cache | ||
key: ${{ runner.os }}-sonar | ||
restore-keys: ${{ runner.os }}-sonar | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: ${{ runner.os }}-gradle | ||
|
||
- name: Build | ||
run: | | ||
./gradlew build sonarqube -x test --info \ | ||
-Dsonar.projectKey=${{ env.SONARCLOUD_ORG }}_${{ github.event.repository.name }} \ | ||
-Dsonar.organization=${{ env.SONARCLOUD_ORG }} \ | ||
-Dsonar.host.url=${{ env.SONARCLOUD_HOST }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
Oops, something went wrong.