Skip to content

Commit 17bcba5

Browse files
authored
Merge pull request #93 from NixOS/buildtools
Remove `until-build` from `plugin.xml` and periodically check compatibility against future versions of IDEA
2 parents bd596d1 + fda0c9b commit 17bcba5

File tree

11 files changed

+240
-64
lines changed

11 files changed

+240
-64
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Commit and Push
2+
description: Commits all changes and pushes them back to the repository
3+
inputs:
4+
branch:
5+
description: The branch which shall be updated
6+
default: ${{ github.event_name == 'release' && 'refs/heads/master' || github.ref }}
7+
message:
8+
description: The comment message
9+
required: true
10+
runs:
11+
using: composite
12+
steps:
13+
- name: Commit files
14+
shell: bash
15+
env:
16+
COMMIT_MESSAGE: ${{ inputs.message }}
17+
run: |
18+
git -c user.name='github-actions[bot]' \
19+
-c user.email='41898282+github-actions[bot]@users.noreply.github.com' \
20+
commit -am "$COMMIT_MESSAGE"
21+
- name: Push changes
22+
shell: bash
23+
env:
24+
BASE_COMMIT: ${{ github.sha }}
25+
TARGET_BRANCH: ${{ inputs.branch }}
26+
run: |
27+
git push origin \
28+
--force-with-lease="$TARGET_BRANCH:$BASE_COMMIT" \
29+
"HEAD:$TARGET_BRANCH"

.github/workflows/build-main-branch.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ jobs:
3333
- name: Download build result
3434
uses: actions/download-artifact@v4
3535
with:
36-
name: ${{ needs.build.outputs.build-artifact }}
36+
artifact-ids: ${{ needs.build.outputs.build-artifact-id }}
3737
path: build/distributions/
38+
merge-multiple: true
3839
- name: Download metadata
3940
uses: actions/download-artifact@v4
4041
with:
41-
name: ${{ needs.build.outputs.metadata-artifact }}
42+
artifact-ids: ${{ needs.build.outputs.metadata-artifact-id }}
4243
path: build/metadata/
44+
merge-multiple: true
4345
# Read metadata
4446
- name: Read metadata
4547
id: metadata

.github/workflows/build.yml

Lines changed: 18 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ on:
44
pull_request:
55
workflow_call:
66
outputs:
7-
metadata-artifact:
8-
description: The name of the artifact containing the result of the metadata task
9-
value: metadata
10-
build-artifact:
11-
description: The name of the artifact containing the build result
12-
value: build-result
7+
metadata-artifact-id:
8+
description: The id of the artifact containing the result of the metadata task
9+
value: ${{ jobs.build.outputs.metadata-artifact-id }}
10+
build-artifact-id:
11+
description: The id of the artifact containing the build result
12+
value: ${{ jobs.build.outputs.build-result-artifact-id }}
1313
workflow_dispatch:
1414

1515
jobs:
@@ -30,7 +30,9 @@ jobs:
3030
runs-on: ubuntu-latest
3131
needs: gradle-wrapper-validation
3232
outputs:
33-
idea-releases: ${{ steps.metadata.outputs.products-releases }}
33+
build-result-artifact-id: ${{ steps.upload-build-result.outputs.artifact-id }}
34+
metadata-artifact-id: ${{ steps.upload-metadata.outputs.artifact-id }}
35+
products-releases: ${{ steps.get-products-releases.outputs.products-releases }}
3436

3537
steps:
3638
# Setup environment
@@ -42,10 +44,10 @@ jobs:
4244
publish-caches: true
4345
# Collect metadata
4446
- name: Collect metadata for upcoming steps and jobs
45-
id: metadata
46-
run: |
47-
./gradlew --stacktrace metadata
48-
echo "products-releases=$(./gradlew -q printProductsReleases | jq -Rnc '[inputs]')" >> "$GITHUB_OUTPUT"
47+
run: ./gradlew --stacktrace metadata
48+
- name: Read productsReleases.txt for compatibility testing matrix
49+
id: get-products-releases
50+
run: echo "products-releases=$(jq -Rnc '[inputs]' < gradle/productsReleases.txt)" >> "$GITHUB_OUTPUT"
4951
# Build
5052
- name: Build project
5153
run: ./gradlew --stacktrace assemble buildPlugin
@@ -62,12 +64,14 @@ jobs:
6264
path: build/reports/
6365
if-no-files-found: ignore
6466
- name: Upload build result
67+
id: upload-build-result
6568
uses: actions/upload-artifact@v4
6669
with:
6770
name: build-result
6871
path: build/distributions/
6972
if-no-files-found: error
7073
- name: Upload metadata
74+
id: upload-metadata
7175
uses: actions/upload-artifact@v4
7276
with:
7377
name: metadata
@@ -76,35 +80,7 @@ jobs:
7680

7781
check-compatibility:
7882

79-
name: Test Plugin Compatibility (${{ matrix.idea-release }})
80-
runs-on: ubuntu-latest
83+
uses: ./.github/workflows/check-compatibility.yml
8184
needs: build
82-
83-
strategy:
84-
fail-fast: false
85-
matrix:
86-
idea-release: ${{ fromJSON(needs.build.outputs.idea-releases) }}
87-
88-
steps:
89-
# Setup environment
90-
- name: Checkout repository
91-
uses: actions/checkout@v4
92-
- name: Set up build tools
93-
uses: ./.github/actions/setup-tools
94-
# Setup caches for Plugin Verifier
95-
- name: Set up cache for IntelliJ Plugin Verifier
96-
uses: actions/cache@v4
97-
with:
98-
path: ~/.cache/pluginVerifier/ides
99-
key: pluginVerifier-${{ matrix.idea-release }}-${{ runner.os }}
100-
# Run checks
101-
- name: Check plugin compatibility
102-
run: ./gradlew --stacktrace -PverifierIdeVersionOverride="${{ matrix.idea-release }}" verifyPlugin
103-
# Upload artifacts
104-
- name: Upload build reports
105-
if: always()
106-
uses: actions/upload-artifact@v4
107-
with:
108-
name: compatibility-reports-${{ matrix.idea-release }}
109-
path: build/reports/
110-
if-no-files-found: ignore
85+
with:
86+
products_releases: ${{ needs.build.outputs.products-releases }}

.github/workflows/bump-version.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,10 @@ jobs:
5151
- name: Update files with Gradle
5252
run: ./gradlew --stacktrace metadata patchChangelog --release-note="$(<release_note.md)" bumpVersion
5353
# Commit and push
54-
- name: Commit files
55-
run: |
56-
version="$(cat build/metadata/version.txt)"
57-
git -c user.name='github-actions[bot]' \
58-
-c user.email='41898282+github-actions[bot]@users.noreply.github.com' \
59-
commit -am "Bump version after releasing v$version"
60-
- name: Push changes
61-
env:
62-
BASE_COMMIT: ${{ github.sha }}
63-
TARGET_BRANCH: ${{ github.event_name == 'release' && 'refs/heads/master' || github.ref }}
64-
run: |
65-
git push origin \
66-
--force-with-lease="$TARGET_BRANCH:$BASE_COMMIT" \
67-
"HEAD:$TARGET_BRANCH"
54+
- name: Read version
55+
id: get-version
56+
run: echo "version=$(cat build/metadata/version.txt)" >> "$GITHUB_OUTPUT"
57+
- name: Commit and push changes
58+
uses: ./.github/actions/commit-and-push
59+
with:
60+
message: Bump version after releasing v${{ steps.get-version.outputs.version }}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Check Against Latest Versions of IDEA
2+
3+
on:
4+
schedule:
5+
- cron: '35 14 * * 5' # Every Friday 14:35 UTC
6+
workflow_dispatch:
7+
inputs:
8+
update_repo:
9+
description: 'Push updated files to repository'
10+
default: false
11+
type: boolean
12+
13+
jobs:
14+
update-products-releases:
15+
16+
name: Check for New Product Releases of IDEA
17+
runs-on: ubuntu-latest
18+
outputs:
19+
artifact-id: ${{ steps.upload.outputs.artifact-id }}
20+
products-releases: ${{ steps.get-new-products-releases.outputs.products-releases }}
21+
has-changed: ${{ steps.diff.outputs.has-changes }}
22+
23+
steps:
24+
# Setup environment
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
- name: Set up build tools
28+
uses: ./.github/actions/setup-tools
29+
with:
30+
publish-caches: true
31+
# Update product releases (gradle/productsReleases.txt)
32+
- name: Update product releases
33+
run: ./gradlew --stacktrace updateProductsReleases
34+
# Prepare job output
35+
- name: Add resolved product releases to job summary
36+
run: |
37+
cat << EOF >> "$GITHUB_STEP_SUMMARY"
38+
### Product Releases
39+
40+
\`\`\`
41+
$(cat gradle/productsReleases.txt)
42+
\`\`\`
43+
44+
EOF
45+
- name: Check diff
46+
id: diff
47+
run: |
48+
diff_text=$(git diff)
49+
if [ -z "$diff_text" ]; then
50+
echo "has-changes=" >> "$GITHUB_OUTPUT"
51+
diff_text='No changes. File at `gradle/productsReleases.txt` is up-to-date.'
52+
else
53+
echo "has-changes=true" >> "$GITHUB_OUTPUT"
54+
diff_text=$'```diff\n'"$diff_text"$'\n```'
55+
fi
56+
57+
cat << EOF >> "$GITHUB_STEP_SUMMARY"
58+
### Difference
59+
60+
${diff_text}
61+
62+
### Gradle Summary
63+
64+
EOF
65+
- name: Read productsReleases.txt for compatibility testing matrix
66+
id: get-new-products-releases
67+
run: echo "products-releases=$(jq -Rnc '[inputs]' < gradle/productsReleases.txt)" >> "$GITHUB_OUTPUT"
68+
# Upload new product releases
69+
- name: Upload new product releases
70+
id: upload
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: products-releases
74+
path: gradle/productsReleases.txt
75+
if-no-files-found: error
76+
# Build the project to populate the build caches, and
77+
# to verify that the build is working.
78+
- name: Build project
79+
run: ./gradlew --stacktrace assemble buildPlugin verifyPluginStructure check
80+
81+
check-compatibility:
82+
83+
uses: ./.github/workflows/check-compatibility.yml
84+
needs: update-products-releases
85+
with:
86+
products_releases: ${{ needs.update-products-releases.outputs.products-releases }}
87+
88+
push-to-repository:
89+
90+
name: Push Updated Files To Repository
91+
runs-on: ubuntu-latest
92+
needs: [ update-products-releases, check-compatibility ]
93+
if: ${{ inputs.update_repo && needs.update-products-releases.outputs.has-changed }}
94+
95+
steps:
96+
- name: Checkout repository
97+
uses: actions/checkout@v4
98+
- name: Download new product releases
99+
uses: actions/download-artifact@v4
100+
with:
101+
artifact-ids: ${{ needs.update-products-releases.outputs.artifact-id }}
102+
path: gradle/
103+
merge-multiple: true
104+
- name: Commit and push changes
105+
uses: ./.github/actions/commit-and-push
106+
with:
107+
message: Update IDEA releases for testing compatibility
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Test Plugin Compatibility
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
products_releases:
7+
description: 'JSON list of releases to test'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
check-compatibility:
13+
14+
name: Test Plugin Compatibility (${{ matrix.idea-release }})
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
idea-release: ${{ fromJSON(inputs.products_releases) }}
21+
22+
steps:
23+
# Setup environment
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
- name: Set up build tools
27+
uses: ./.github/actions/setup-tools
28+
# Setup caches for Plugin Verifier
29+
- name: Set up cache for IntelliJ Plugin Verifier
30+
uses: actions/cache@v4
31+
with:
32+
path: ~/.cache/pluginVerifier/ides
33+
key: pluginVerifier-${{ matrix.idea-release }}-${{ runner.os }}
34+
# Run checks
35+
- name: Check plugin compatibility
36+
run: ./gradlew --stacktrace -PverifierIdeVersionOverride="${{ matrix.idea-release }}" verifyPlugin
37+
# Upload artifacts
38+
- name: Upload build reports
39+
if: always()
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: compatibility-reports-${{ matrix.idea-release }}
43+
path: build/reports/
44+
if-no-files-found: ignore

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44

55
### Added
66

7+
- Support for IDEA 2025.2 and potentially future versions
8+
79
### Changed
810

11+
- The `until-build` attribute has been removed from plugin configuration.
12+
The plugin should now continue to work with future versions of IDEA without
13+
requiring a new release as long as IDEA's API does not break.
914
- Settings have been refactored. Different pages are now merged into one hierarchy.
1015

1116
### Deprecated

build.gradle.kts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ val pluginGroup: String by project
1919
val pluginName: String by project
2020
val pluginVersion: String by project
2121
val pluginSinceBuild: String by project
22-
val pluginUntilBuild: String by project
2322

2423
val platformType: String by project
2524
val platformVersion: String by project
@@ -78,7 +77,6 @@ intellijPlatform {
7877
}
7978
ideaVersion {
8079
sinceBuild = pluginSinceBuild
81-
untilBuild = pluginUntilBuild
8280
}
8381
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
8482
description = providers.provider {
@@ -113,8 +111,12 @@ intellijPlatform {
113111
providers.gradleProperty("verifierIdeVersionOverride")
114112
// Verify only against the IDE specified by the property
115113
.map { listOf(it) }
116-
// If property is not set, verify against the recommended list of IDEs
117-
.orElse(ProductReleasesValueSource())
114+
// If property is not set, verify against the IDEs in gradle/productsReleases.txt
115+
.orElse(
116+
layout.projectDirectory.file("gradle/productsReleases.txt")
117+
.let { providers.fileContents(it).asText }
118+
.map { it.lines().map(String::trim).filter(String::isNotEmpty) }
119+
)
118120
)
119121
}
120122
}
@@ -172,7 +174,7 @@ tasks {
172174
systemProperty("plugin.testDataPath", rootProject.rootDir.resolve("src/test/testData").path)
173175
}
174176

175-
task<MetadataTask>("metadata") {
177+
register<MetadataTask>("metadata") {
176178
outputDir = layout.buildDirectory.dir("metadata")
177179
file("version.txt", pluginVersion)
178180
file("zipfile.txt") { buildPlugin.get().archiveFile.get().toString() }
@@ -188,6 +190,16 @@ tasks {
188190
}
189191
}
190192

193+
register<MetadataTask>("updateProductsReleases") {
194+
doNotTrackState("Updates files outside of build directory")
195+
outputDir = layout.projectDirectory.dir("gradle")
196+
file(
197+
"productsReleases.txt",
198+
intellijPlatform.pluginVerification.ides.ProductReleasesValueSource().map {
199+
it.joinToString("\n", "", "\n")
200+
})
201+
}
202+
191203
generateLexer {
192204
sourceFile = layout.projectDirectory.file("src/main/lang/Nix.flex")
193205
targetOutputDir = lexerSource.map { it.dir("org/nixos/idea/lang") }

0 commit comments

Comments
 (0)