Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix release workflow and polish codecov #2065

Merged
merged 2 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
30 changes: 17 additions & 13 deletions .github/workflows/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,41 +56,45 @@ $ ./gradlew preprocessWorkflows

There are currently three known caveats with the approach we follow.

* https://youtrack.jetbrains.com/issue/KTIJ-16532
+
=== https://youtrack.jetbrains.com/issue/KTIJ-16532

If you navigate to a file in the dependencies, only a decompiled file is opened,
even though the source JAR would be available. Also the quick documentation is missing.
+

This can easily by mitigated by attaching the library to the normal project
dependencies while having the need to navigate the source files or while editing them,
which makes them properly viewable and documentation displayable in the editor.

* https://youtrack.jetbrains.com/issue/KTIJ-14580
+
=== https://youtrack.jetbrains.com/issue/KTIJ-14580

We use `@file:Import` to reduce code duplication by having common code in a common file.
Unfortunately, this triggers a Kotlin IntelliJ plugin bug where the imported file cannot
be loaded properly and so the things supplied by it like dependencies or common functions
are not available. This makes most of the workflow `*.main.kts` files red as hell in the
IDE currently.
+

To reduce risk for eye-cancer while reading the `*.main.kts` scripts or to be able to
sanely edit them, temporarily add the `@file:DependsOn` from the imported file to the
importing file and wait a second, then remove the line again once you are done.

* https://youtrack.jetbrains.com/issue/KT-42101
+
=== https://youtrack.jetbrains.com/issue/KT-42101

We use `@file:Import` to reduce code duplication by having common code in a common file.
Unfortunately, this triggers a Kotlin bug where the compilation cache becomes confused
if the imported file is changed without the importing file being changed too.
+

If only the imported file is changed, it could happen that an old version is used,
or it could also happen that classes added by a `@file:DependsOn` in the imported file
are not available to the importing file. So if there was a change in the imported file,
you either need to also change the importing file, or to properly execute the script,
you need to delete the stale entry from the compilation cache which can be found at for example
`~/.cache/main.kts.compiled.cache/` on Linux and `%LOCALAPPDATA%\main.kts.compiled.cache\`
on Windows. Alternatively, you can also delete the whole cache directory.
+
you need to delete the stale entry from the compilation cache which can be found here:

- On Windows the default location is at `%LOCALAPPDATA%\main.kts.compiled.cache\`.
- On Linux the default location is at `$XDG_CACHE_HOME/main.kts.compiled.cache/` or `~/.cache/main.kts.compiled.cache/`.
- On macOS the default location is at `~/Library/Caches/main.kts.compiled.cache/`.

Alternatively, you can also delete the whole cache directory.

Another option is to disable the compilation cache for the execution by setting the
environment variable `KOTLIN_MAIN_KTS_COMPILED_SCRIPTS_CACHE_DIR` or the system property
`kotlin.main.kts.compiled.scripts.cache.dir` to an empty value, depending on the run
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/branches-and-prs.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ workflow(
}

val matrix = Matrix.full
with(__FILE__.parentFile.resolve("../../codecov.yml")) {
with(__FILE__.parentFile.resolve("../codecov.yml")) {
readText()
.replace("after_n_builds:.*+$".toRegex(), "after_n_builds: ${matrix.size}")
.let(::writeText)
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ workflow(
val SIGNING_GPG_PASSWORD by secrets

val matrix = Matrix.full
with(__FILE__.parentFile.resolve("../../codecov.yml")) {
with(__FILE__.parentFile.resolve("../codecov.yml")) {
readText()
.replace("after_n_builds:.*+$".toRegex(), "after_n_builds: ${matrix.size}")
.let(::writeText)
Expand Down Expand Up @@ -82,7 +82,7 @@ workflow(
"ghActionsBuild",
""""-Dvariant=${expr(Matrix.variant)}"""",
""""-DjavaVersion=${expr(Matrix.javaVersion)}"""",
"-Dscan.tag.main-build"
""""-Dscan.tag.main-build""""
).joinToString(" "),
env = commonCredentials
)
Expand Down Expand Up @@ -129,7 +129,7 @@ workflow(
"ghActionsPublish",
""""-Dvariant=${expr(Matrix.variant)}"""",
""""-DjavaVersion=${expr(Matrix.javaVersion)}"""",
"-Dscan.tag.main-publish"
""""-Dscan.tag.main-publish""""
).joinToString(" "),
env = mutableMapOf(
"GITHUB_TOKEN" to expr(GITHUB_TOKEN),
Expand Down Expand Up @@ -179,7 +179,7 @@ workflow(
"ghActionsDocs",
""""-Dvariant=${expr(Matrix.variant)}"""",
""""-DjavaVersion=${expr(Matrix.javaVersion)}"""",
"-Dscan.tag.main-docs"
""""-Dscan.tag.main-docs""""
).joinToString(" "),
env = mutableMapOf(
"GITHUB_TOKEN" to expr(GITHUB_TOKEN)
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
name: 'Build Spock'
env:
DEVELOCITY_ACCESS_KEY: '${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}'
run: './gradlew --stacktrace ghActionsBuild "-Dvariant=${{ matrix.variant }}" "-DjavaVersion=${{ matrix.java }}" -Dscan.tag.main-build'
run: './gradlew --stacktrace ghActionsBuild "-Dvariant=${{ matrix.variant }}" "-DjavaVersion=${{ matrix.java }}" "-Dscan.tag.main-build"'
- id: 'step-3'
name: 'Stop Daemon'
run: './gradlew --stop'
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
SONATYPE_OSS_PASSWORD: '${{ secrets.SONATYPE_OSS_PASSWORD }}'
SIGNING_PASSWORD: '${{ secrets.SIGNING_GPG_PASSWORD }}'
DEVELOCITY_ACCESS_KEY: '${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}'
run: './gradlew --no-parallel --stacktrace ghActionsPublish "-Dvariant=${{ matrix.variant }}" "-DjavaVersion=${{ matrix.java }}" -Dscan.tag.main-publish'
run: './gradlew --no-parallel --stacktrace ghActionsPublish "-Dvariant=${{ matrix.variant }}" "-DjavaVersion=${{ matrix.java }}" "-Dscan.tag.main-publish"'
publish-release-docs:
name: 'Publish Release Docs'
runs-on: '${{ matrix.os }}'
Expand Down Expand Up @@ -165,4 +165,4 @@ jobs:
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
DEVELOCITY_ACCESS_KEY: '${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}'
run: './gradlew --no-parallel --stacktrace ghActionsDocs "-Dvariant=${{ matrix.variant }}" "-DjavaVersion=${{ matrix.java }}" -Dscan.tag.main-docs'
run: './gradlew --no-parallel --stacktrace ghActionsDocs "-Dvariant=${{ matrix.variant }}" "-DjavaVersion=${{ matrix.java }}" "-Dscan.tag.main-docs"'
Loading