Skip to content

Commit e36a572

Browse files
committed
IJMP-1844 and IJMP-1874 Added new GitHub Actions, added support for the latest version of IntelliJ IDEA, fix annotator text
Signed-off-by: Uladzislau <leksilonchikk@gmail.com>
1 parent 8e564d0 commit e36a572

File tree

8 files changed

+406
-73
lines changed

8 files changed

+406
-73
lines changed

.github/workflows/build.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Build
2+
3+
on: [push, workflow_dispatch]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout the plugin GitHub repository
10+
uses: actions/checkout@v4
11+
12+
- name: Setup Java
13+
uses: actions/setup-java@v4
14+
with:
15+
distribution: zulu
16+
java-version: 17
17+
18+
- name: Setup Gradle
19+
uses: gradle/actions/setup-gradle@v3
20+
with:
21+
gradle-home-cache-cleanup: true
22+
23+
- name: Check repository content
24+
shell: bash
25+
run: pwd && ls -la
26+
27+
- name: Build plugin's binary
28+
shell: bash
29+
run: ./gradlew build
30+
31+
- name: Prepare Plugin Artifact
32+
id: artifact
33+
shell: bash
34+
run: |
35+
cd ${{ github.workspace }}/build/distributions
36+
FILENAME=`ls *.zip`
37+
unzip "$FILENAME" -d content
38+
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
39+
echo "zip artifact name:"
40+
echo "$FILENAME"
41+
42+
- name: Publish built plugin to artifacts
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: ${{ steps.artifact.outputs.filename }}
46+
path: ./build/distributions/content/*/*
47+
test:
48+
needs: [build]
49+
runs-on: ubuntu-latest
50+
steps:
51+
52+
- name: Checkout the plugin GitHub repository
53+
uses: actions/checkout@v4
54+
55+
- name: Setup Java
56+
uses: actions/setup-java@v4
57+
with:
58+
distribution: zulu
59+
java-version: 17
60+
61+
- name: Setup Gradle
62+
uses: gradle/actions/setup-gradle@v3
63+
with:
64+
gradle-home-cache-cleanup: true
65+
66+
- name: Run tests
67+
shell: bash
68+
run: ./gradlew test
69+
70+
- name: Publish tests result to artifacts
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: tests-report
74+
path: ${{ github.workspace }}/build/reports/tests
75+
76+
- name: Publish code coverage report to artifacts
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: code-coverage-report
80+
path: ${{ github.workspace }}/build/reports/kover/html
81+
82+
verify:
83+
if: ${{ contains(github.ref, 'refs/heads/release/') }}
84+
needs: [build]
85+
runs-on: ubuntu-latest
86+
steps:
87+
88+
- name: Maximize Build Space
89+
uses: jlumbroso/free-disk-space@main
90+
with:
91+
tool-cache: false
92+
large-packages: false
93+
94+
- name: Checkout the plugin GitHub repository
95+
uses: actions/checkout@v4
96+
97+
- name: Setup Java
98+
uses: actions/setup-java@v4
99+
with:
100+
distribution: zulu
101+
java-version: 17
102+
103+
- name: Setup Gradle
104+
uses: gradle/actions/setup-gradle@v3
105+
with:
106+
gradle-home-cache-cleanup: true
107+
108+
- name: Setup Plugin Verifier IDEs Cache
109+
uses: actions/cache@v4
110+
with:
111+
path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
112+
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
113+
114+
- name: Verify plugin against IntelliJ IDEA IDE's
115+
continue-on-error: true
116+
shell: bash
117+
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
118+
119+
- name: Collect Plugin Verifier Result
120+
uses: actions/upload-artifact@v4
121+
with:
122+
name: plugin-verifier-report
123+
path: ${{ github.workspace }}/build/reports/pluginVerifier

.github/workflows/release.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
steps:
13+
14+
- name: Checkout the plugin GitHub repository
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Java
18+
uses: actions/setup-java@v4
19+
with:
20+
distribution: zulu
21+
java-version: 17
22+
23+
- name: Setup Gradle
24+
uses: gradle/actions/setup-gradle@v3
25+
with:
26+
gradle-home-cache-cleanup: true
27+
28+
- name: Fetch Gradle properties
29+
id: properties
30+
shell: bash
31+
run: |
32+
PROPERTIES="$(./gradlew properties --console=plain -q)"
33+
PLUGIN_VERSION_FULL="$(echo "$PROPERTIES" | grep "^pluginVersion:" | cut -f2- -d ' ')"
34+
CURR_COMMIT="$(git rev-parse HEAD)"
35+
36+
echo "pluginVersionFull: $PLUGIN_VERSION_FULL"
37+
echo "currCommit: $CURR_COMMIT"
38+
39+
echo "pluginVersionFull=$PLUGIN_VERSION_FULL" >> $GITHUB_OUTPUT
40+
echo "currCommit=$CURR_COMMIT" >> $GITHUB_OUTPUT
41+
42+
- name: Publish Plugin
43+
env:
44+
ZOWE_INTELLIJ_MARKET_TOKEN: ${{ secrets.ZOWE_INTELLIJ_MARKET_TOKEN }}
45+
INTELLIJ_SIGNING_CERTIFICATE_CHAIN: ${{ secrets.INTELLIJ_SIGNING_CERTIFICATE_CHAIN }}
46+
INTELLIJ_SIGNING_PRIVATE_KEY: ${{ secrets.INTELLIJ_SIGNING_PRIVATE_KEY }}
47+
INTELLIJ_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.INTELLIJ_SIGNING_PRIVATE_KEY_PASSWORD }}
48+
run: ./gradlew publishPlugin
49+
50+
- name: Prepare release notes
51+
id: release_notes
52+
shell: bash
53+
run: |
54+
CHANGELOG="$(./gradlew getChangelog -q)"
55+
56+
echo 'version_release_notes<<EOF' >> $GITHUB_OUTPUT
57+
echo "$CHANGELOG" >> $GITHUB_OUTPUT
58+
echo 'EOF' >> $GITHUB_OUTPUT
59+
60+
echo "Release notes to be added:"
61+
echo "$CHANGELOG"
62+
63+
- name: Create new tag and release
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
run: |
67+
git tag ${{ steps.properties.outputs.pluginVersionFull }}
68+
git push origin ${{ steps.properties.outputs.pluginVersionFull }}
69+
gh release create ${{ steps.properties.outputs.pluginVersionFull }} --title ${{ steps.properties.outputs.pluginVersionFull }} --target ${{ steps.properties.outputs.currCommit }} -F- <<EOF
70+
${{ steps.release_notes.outputs.version_release_notes }}
71+
EOF
72+
73+
- name: Upload Release Built Artifact
74+
continue-on-error: true
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
run: gh release upload ${{ steps.properties.outputs.pluginVersionFull }} ./build/distributions/*
78+
79+
- name: Create Pull Request
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
run: |
83+
VERSION="${{ steps.properties.outputs.pluginVersionFull }}"
84+
BRANCH="release-changelog-update-$VERSION"
85+
86+
git config user.email "action@github.com"
87+
git config user.name "GitHub Action"
88+
89+
git checkout -b $BRANCH
90+
git commit -am ":moyai: ${VERSION}" -m "[skip ci]"
91+
git push --set-upstream origin $BRANCH
92+
93+
gh pr create \
94+
--title ":moyai: \`$VERSION\`" \
95+
--body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
96+
--base "release/v$VERSION" \
97+
--head $BRANCH
98+
99+
- name: Close Milestone
100+
continue-on-error: true
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
run: |
104+
gh api repos/{owner}/{repo}/milestones \
105+
--jq '.[] | select(.title == "${{ steps.properties.outputs.pluginVersionFull }}") | .number' \
106+
| xargs -I '{}' gh api -X PATCH repos/{owner}/{repo}/milestones/{} -F state='closed'

build.gradle.kts

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import java.time.ZoneId
1414
import java.time.format.DateTimeFormatter
1515

1616
fun properties(key: String) = providers.gradleProperty(key)
17+
fun environment(key: String) = providers.environmentVariable(key)
1718
fun dateValue(pattern: String): String =
1819
LocalDate.now(ZoneId.of("Europe/Warsaw")).format(DateTimeFormatter.ofPattern(pattern))
1920

@@ -49,7 +50,7 @@ intellij {
4950
version.set("2023.1")
5051

5152
// To have a dependency on zowe explorer from the marketplace
52-
plugins.set(listOf("org.zowe.explorer:1.2.1-231"))
53+
plugins.set(listOf("org.zowe.explorer:1.2.2-231"))
5354

5455
// To have a dependency on built-in plugin from \Project_dir\libs\for-mainframe
5556
// plugins.set(listOf("${projectDir}\\libs\\for-mainframe"))
@@ -83,7 +84,8 @@ tasks {
8384

8485
patchPluginXml {
8586
version.set("${properties("pluginVersion").get()}-${properties("sinceBuildVersion").get().substringBefore(".")}")
86-
sinceBuild.set(properties("sinceBuildVersion").get())
87+
sinceBuild = properties("sinceBuildVersion")
88+
untilBuild = properties("untilBuildVersion")
8789

8890
val changelog = project.changelog // local variable for configuration cache compatibility
8991
// Get the latest available change notes from the changelog file
@@ -125,8 +127,19 @@ tasks {
125127
purgeOldFiles.set(true)
126128
}
127129

130+
// needed until it becomes possible to set encoding of .flex file using the generateLexer task
131+
// see https://github.com/JetBrains/gradle-grammar-kit-plugin/issues/127
132+
val generateJclLexer = task<JavaExec>("generateJclLexer") {
133+
val jflexJar = "jflex-${jflexVersion}.jar"
134+
val source = "src/main/kotlin/org/zowe/jcl/lang/Jcl.flex"
135+
val targetDir = "src/main/java/org/zowe/jcl/lang"
136+
val encoding = "UTF-8"
137+
classpath = files(jflexJar)
138+
args("-d", targetDir, "--encoding", encoding, source)
139+
}
140+
128141
compileKotlin {
129-
dependsOn(generateLexer, generateParser)
142+
dependsOn(generateJclLexer, generateParser)
130143

131144
kotlinOptions {
132145
jvmTarget = JavaVersion.VERSION_17.toString()
@@ -140,6 +153,30 @@ tasks {
140153
jvmTarget = JavaVersion.VERSION_17.toString()
141154
}
142155
}
156+
157+
signPlugin {
158+
certificateChain.set(environment("INTELLIJ_SIGNING_CERTIFICATE_CHAIN").map { it })
159+
privateKey.set(environment("INTELLIJ_SIGNING_PRIVATE_KEY").map { it })
160+
password.set(environment("INTELLIJ_SIGNING_PRIVATE_KEY_PASSWORD").map { it })
161+
}
162+
163+
publishPlugin {
164+
dependsOn("patchChangelog")
165+
token.set(environment("ZOWE_INTELLIJ_MARKET_TOKEN").map { it })
166+
// The pluginVersion is based on the SemVer (https://semver.org)
167+
// Read more: https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
168+
channels.set(
169+
properties("pluginVersion")
170+
.map {
171+
listOf(
172+
it.substringAfter('-', "")
173+
.substringAfter('-', "")
174+
.substringBefore('.')
175+
.ifEmpty { "stable" }
176+
)
177+
}
178+
.map { it })
179+
}
143180
}
144181

145182
sourceSets {
@@ -159,14 +196,3 @@ grammarKit {
159196
// release version of Grammar-Kit - https://github.com/JetBrains/Grammar-Kit
160197
grammarKitRelease.set("2021.1.2")
161198
}
162-
163-
// needed until it becomes possible to set encoding of .flex file using the generateLexer task
164-
// see https://github.com/JetBrains/gradle-grammar-kit-plugin/issues/127
165-
val generateJclLexer = task<JavaExec>("generateJclLexer") {
166-
val jflexJar = "jflex-${jflexVersion}.jar"
167-
val source = "src/main/kotlin/org/zowe/jcl/lang/Jcl.flex"
168-
val targetDir = "src/main/java/org/zowe/jcl/lang"
169-
val encoding = "UTF-8"
170-
classpath = files(jflexJar)
171-
args("-d", targetDir, "--encoding", encoding, source)
172-
}

gradlew

100644100755
File mode changed.

0 commit comments

Comments
 (0)