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

New GHA is caching test tasks, even though the JDK changes #917

Open
aSemy opened this issue Sep 8, 2022 · 3 comments
Open

New GHA is caching test tasks, even though the JDK changes #917

aSemy opened this issue Sep 8, 2022 · 3 comments

Comments

@aSemy
Copy link
Contributor

aSemy commented Sep 8, 2022

The test tasks aren't being re-run when the JDK changes. This might either be because Gradle thinks they're up to date, or because the JDK isn't changing (so the caching is correct).

https://github.com/stuebingerb/mockk/runs/8245418795?check_suite_focus=true#step:5:462

I'd be surprised if the JDK version wasn't registered as a task input by Gradle, but it's possible. It think it's more likely that the GHA isn't properly changing the JDK.

Originally found by @stuebingerb in #916 (comment)

Related #914

@stuebingerb
Copy link
Contributor

I have disabled caching completely in https://github.com/stuebingerb/mockk/actions/runs/3014589035 and the tests still run fine. I believe it might be an issue with the jvm target not being set properly.

@stuebingerb
Copy link
Contributor

I'm not sure if I have already fully understood the build, but to me it seems that the JVM toolchain uses it's values from Deps.Versions:

tasks.withType<JavaCompile>().configureEach {
    options.encoding = "UTF-8"
    sourceCompatibility = Deps.Versions.jvmTarget.toString()
    targetCompatibility = Deps.Versions.jvmTarget.toString()
}

tasks.withType<KotlinCompile>().configureEach {
    kotlinOptions {
        jvmTarget = Deps.Versions.jvmTarget.toString()
    }
}

And that seems to be hardcoded to JDK 8:

val jvmTarget = JavaVersion.VERSION_1_8

@stuebingerb
Copy link
Contributor

stuebingerb commented Sep 8, 2022

There's also a javaToolchainMainVersion and a javaToolchainTestVersion but at first glance I only see the test version change in the matrix (which might be the reason for this error):

> Task :test-modules:performance-tests:compileKotlin FAILED
e: /home/runner/work/mockk/mockk/test-modules/performance-tests/src/main/kotlin/io/mockk/performance/JmhTest.kt: (27, 40): Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants