Skip to content

Commit 24a2b05

Browse files
authored
Add bump kotlin shadow job (#28)
1 parent 5d86b23 commit 24a2b05

File tree

2 files changed

+215
-0
lines changed

2 files changed

+215
-0
lines changed
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
name: Bump kotlin shadow
2+
3+
on:
4+
schedule:
5+
- cron: '0 2 * * *'
6+
workflow_dispatch:
7+
8+
env:
9+
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
10+
11+
# Cancel any current or previous job from the same PR
12+
concurrency:
13+
group: ${{ github.head_ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
tests-gradle:
18+
if: "!startsWith(github.head_ref, 'release-')"
19+
runs-on: macos-14
20+
steps:
21+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7
22+
- name: Bump Kotlin in libraries.toml
23+
run: |
24+
./scripts/bump-kotlin-in-libraries-toml.main.kts
25+
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #v4.2.1
26+
with:
27+
distribution: 'temurin'
28+
java-version: 17
29+
- uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda #v3.4.2
30+
with:
31+
gradle-home-cache-cleanup: true
32+
- name: Build with Gradle
33+
run: |
34+
./gradlew ciTestsGradle
35+
- name: Collect Diagnostics
36+
if: always()
37+
run: ./scripts/collect-diagnostics.main.kts
38+
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3
39+
if: always()
40+
with:
41+
name: tests-gradle.zip
42+
path: diagnostics.zip
43+
44+
tests-no-gradle:
45+
if: "!startsWith(github.head_ref, 'release-')"
46+
runs-on: macos-14
47+
steps:
48+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7
49+
- name: Bump Kotlin in libraries.toml
50+
run: |
51+
./scripts/bump-kotlin-in-libraries-toml.main.kts
52+
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #v4.2.1
53+
with:
54+
distribution: 'temurin'
55+
java-version: 17
56+
- uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda #v3.4.2
57+
with:
58+
gradle-home-cache-cleanup: true
59+
- name: Build with Gradle
60+
run: |
61+
./gradlew ciTestsNoGradle --stacktrace
62+
- name: Collect Diagnostics
63+
if: always()
64+
run: ./scripts/collect-diagnostics.main.kts
65+
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3
66+
if: always()
67+
with:
68+
name: tests-no-gradle.zip
69+
path: diagnostics.zip
70+
71+
tests-integration:
72+
if: "!startsWith(github.head_ref, 'release-')"
73+
runs-on: macos-14
74+
steps:
75+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7
76+
- name: Bump Kotlin in libraries.toml
77+
run: |
78+
./scripts/bump-kotlin-in-libraries-toml.main.kts
79+
git add gradle/libraries.toml && git commit -m "Bump Kotlin"
80+
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #v4.2.1
81+
with:
82+
distribution: 'temurin'
83+
java-version: 17
84+
- uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda #v3.4.2
85+
with:
86+
gradle-home-cache-cleanup: true
87+
- name: Build with Gradle
88+
run: |
89+
./gradlew -p tests ciBuild
90+
- name: Collect Diagnostics
91+
if: always()
92+
run: ./scripts/collect-diagnostics.main.kts
93+
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3
94+
if: always()
95+
with:
96+
name: tests-integration.zip
97+
path: diagnostics.zip
98+
99+
intellij-plugin:
100+
if: "!startsWith(github.head_ref, 'release-')"
101+
name: Build IntelliJ Plugin
102+
runs-on: ubuntu-latest
103+
outputs:
104+
version: ${{ steps.properties.outputs.version }}
105+
steps:
106+
# Free GitHub Actions Environment Disk Space
107+
- name: Maximize Build Space
108+
run: |
109+
sudo rm -rf /usr/share/dotnet
110+
sudo rm -rf /usr/local/lib/android
111+
sudo rm -rf /opt/ghc
112+
113+
# Check out current repository
114+
- name: Fetch Sources
115+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7
116+
117+
- name: Bump Kotlin in libraries.toml
118+
run: |
119+
./scripts/bump-kotlin-in-libraries-toml.main.kts
120+
121+
# Setup Java 11 environment for the next steps
122+
- name: Setup Java
123+
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #v4.2.1
124+
with:
125+
distribution: 'temurin'
126+
java-version: 17
127+
128+
# Set environment variables
129+
- name: Export Properties
130+
id: properties
131+
shell: bash
132+
run: |
133+
PROPERTIES="$(./gradlew :intellij-plugin:properties --console=plain -q)"
134+
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
135+
NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
136+
137+
echo "::set-output name=version::$VERSION"
138+
echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier"
139+
140+
./gradlew :intellij-plugin:listProductsReleases # prepare list of IDEs for Plugin Verifier
141+
142+
# Trigger code generation in test project, as the plugin's tests depend on it
143+
- name: Test project codegen
144+
run: ./gradlew -p tests :intellij-plugin-test-project:generateApolloSources
145+
146+
# Run tests
147+
- name: Run Tests
148+
run: ./gradlew :intellij-plugin:check
149+
150+
# Collect Tests Result of failed tests
151+
- name: Collect Tests Result
152+
if: ${{ failure() }}
153+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3
154+
with:
155+
name: tests-result
156+
path: ${{ github.workspace }}/intellij-plugin/build/reports/tests
157+
158+
# Cache Plugin Verifier IDEs
159+
- name: Setup Plugin Verifier IDEs Cache
160+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 #v4.0.2
161+
with:
162+
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
163+
key: plugin-verifier-${{ hashFiles('intellij-plugin/build/listProductsReleases.txt') }}
164+
165+
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
166+
- name: Run Plugin Verification tasks
167+
run: ./gradlew :intellij-plugin:runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
168+
169+
# Collect Plugin Verifier Result
170+
- name: Collect Plugin Verifier Result
171+
if: ${{ always() }}
172+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3
173+
with:
174+
name: pluginVerifier-result
175+
path: ${{ github.workspace }}/intellij-plugin/build/reports/pluginVerifier
176+
177+
# Prepare plugin archive content for creating artifact
178+
- name: Prepare Plugin Artifact
179+
id: artifact
180+
shell: bash
181+
run: |
182+
cd ${{ github.workspace }}/intellij-plugin/build/distributions
183+
FILENAME=`ls *.zip`
184+
unzip "$FILENAME" -d content
185+
186+
echo "::set-output name=filename::${FILENAME:0:-4}"
187+
188+
# Store already-built plugin as an artifact for downloading
189+
- name: Upload artifact
190+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3
191+
with:
192+
name: ${{ steps.artifact.outputs.filename }}
193+
path: ./intellij-plugin/build/distributions/content/*/*
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env kotlin
2+
3+
import java.io.File
4+
5+
fun main() {
6+
val kotlinVersion = "2.0.20-Beta1"
7+
val kspVersion = "2.0.20-Beta1-1.0.22"
8+
9+
val file = File("gradle/libraries.toml")
10+
val content = file.readText()
11+
.replaceVersion("kotlin-plugin", kotlinVersion)
12+
.replaceVersion("kotlin-plugin-max", kotlinVersion)
13+
.replaceVersion("kotlin-stdlib", kotlinVersion)
14+
.replaceVersion("ksp", kspVersion)
15+
file.writeText(content)
16+
}
17+
18+
fun String.replaceVersion(key: String, version: String): String {
19+
return replace(Regex("""$key = ".*""""), """$key = "$version"""")
20+
}
21+
22+
main()

0 commit comments

Comments
 (0)