https://kotlinlang.org logo
Title
j

Jan-Ove Weichel

04/27/2023, 9:51 AM
Hi. I created a feature request today regarding the merge_group trigger (https://github.com/typesafegithub/github-workflows-kt/issues/799). And I’m currently working on a PR to add that Trigger. I’ve checked where other triggers were used, added it to the generator, and wanted to add it to the all-triggers.yml test case. But when I tried to follow the steps in the Readme, I ran into a couple of issues. The first one was easy to fix since the GenerateKotlinScripts only looks for files with a .yaml extension, but all files in the relevant directory have a .yml extension. The following error I ran into is something where I need help. When I’m now running the GenerateKotlinScripts test, I get an error. (Stacktrace is in the Thread Comments). Is that an actual error, or something I need to configure with my local setup? I get the same error when running the test from IntelliJ and Gradle. My changes are currently in this branch: https://github.com/Jan-Ove/github-workflows-kt/tree/feature/add-merge_group-trigger
p

Piotr Krzemiński

04/27/2023, 9:52 AM
@Jan-Ove Weichel could you remove the lengthy stack trace and move it to the comments under the thead + remove the previews? the goal is to be able to browse the channel conveniently 🙂
also @jmfayard could you TAL if this problem looks familiar?
j

Jan-Ove Weichel

04/27/2023, 9:54 AM
Here is the Stacktrace:
java.nio.file.NoSuchFileException: actions
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
	at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
	at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:149)
	at java.base/java.nio.file.Files.readAttributes(Files.java:1764)
	at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:219)
	at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
	at java.base/java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
	at java.base/java.nio.file.FileTreeIterator.<init>(FileTreeIterator.java:71)
	at java.base/java.nio.file.Files.walk(Files.java:3825)
	at java.base/java.nio.file.Files.walk(Files.java:3879)
	at io.github.typesafegithub.workflows.actionsmetadata.ActionsMetadataReadingKt.readLocalActionTypings(ActionsMetadataReading.kt:25)
	at io.github.typesafegithub.workflows.actionsmetadata.ActionsMetadataReadingKt.readActionsMetadata(ActionsMetadataReading.kt:18)
	at io.github.typesafegithub.workflows.actionsmetadata.WrappersToGenerateKt$wrappersToGenerate$2.invoke(WrappersToGenerate.kt:3)
	at io.github.typesafegithub.workflows.actionsmetadata.WrappersToGenerateKt$wrappersToGenerate$2.invoke(WrappersToGenerate.kt:3)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at io.github.typesafegithub.workflows.actionsmetadata.WrappersToGenerateKt.getWrappersToGenerate(WrappersToGenerate.kt:3)
	at io.github.typesafegithub.workflows.scriptgenerator.JobsKt$generateJobs$1.invoke(Jobs.kt:37)
	at io.github.typesafegithub.workflows.scriptgenerator.JobsKt$generateJobs$1.invoke(Jobs.kt:13)
	at io.github.typesafegithub.workflows.scriptgenerator.KotlinPoetKt.CodeBlock(KotlinPoet.kt:11)
	at io.github.typesafegithub.workflows.scriptgenerator.JobsKt.generateJobs(Jobs.kt:13)
	at io.github.typesafegithub.workflows.scriptgenerator.GitHubWorkflowKt$workFlowProperty$1.invoke(GitHubWorkflow.kt:35)
	at io.github.typesafegithub.workflows.scriptgenerator.GitHubWorkflowKt$workFlowProperty$1.invoke(GitHubWorkflow.kt:24)
	at io.github.typesafegithub.workflows.scriptgenerator.KotlinPoetKt.CodeBlock(KotlinPoet.kt:11)
	at io.github.typesafegithub.workflows.scriptgenerator.GitHubWorkflowKt.workFlowProperty(GitHubWorkflow.kt:24)
	at io.github.typesafegithub.workflows.scriptgenerator.GitHubWorkflowKt.toFileSpec(GitHubWorkflow.kt:16)
	at io.github.typesafegithub.workflows.scriptgenerator.GitHubWorkflowKt.toKotlin(GitHubWorkflow.kt:72)
	at io.github.typesafegithub.workflows.scriptgenerator.YamlToKotlinScriptKt.yamlToKotlinScript(YamlToKotlinScript.kt:11)
	at io.github.typesafegithub.workflows.scriptgenerator.YamlToKotlinScriptKt.yamlToKotlinScript$default(YamlToKotlinScript.kt:9)
	at test.GenerateKotlinScripts$1$1$1.invokeSuspend(GenerateKotlinScripts.kt:21)
p

Piotr Krzemiński

04/27/2023, 10:04 AM
from a quick glance: I suggest using a debugger to see which path it tries to read the files from.
java.nio.file.NoSuchFileException: actions
j

Jan-Ove Weichel

04/27/2023, 10:12 AM
The
readLocalActionTypings
function os looking in
/github-workflows-kt/script-generator/logic/actions
folder. But it should look in
/github-workflows-kt/actions
folder, right?
v

Vampire

04/27/2023, 10:31 AM
Seems that uses a pure relative path, which then means it is relative to the current working directory, which is almost always the wrong thing to do except for paths given by the actual human starting a program.
p

Piotr Krzemiński

04/27/2023, 10:43 AM
@Jan-Ove Weichel can you try running this test without your changes? Looks like the problem is not related to your changes, let’s confirm it. the tests work fine on CI
j

Jan-Ove Weichel

04/27/2023, 11:32 AM
The tests probably ran before, because they didn’t really run. On the main branch the
GenerateKotlinScripts
doesn’t create any test cases since it is looking for files with a
.yaml
ending in a folder where all files have a
.yml
ending. If I run the checks on the main branch without my changes they don’t show any error. But when I only change the thing in
GenerateKotlinScripts
they also fail.
p

Piotr Krzemiński

04/27/2023, 11:33 AM
oh, got it 🤦‍♂️ it deserves to be tracked as a bug
I’m curious how many regressions will come up once the tests are fixed
Created [Bug] Some tests for script-generator don't work · Issue #800. Lucky number! @Jan-Ove Weichel are you willing to push this topic forward?
j

Jan-Ove Weichel

04/27/2023, 11:49 AM
I can push this further. But I’ll probably need a bit of help since I’ve only used the library previously and haven’t really gotten the chance to go further into the code base.
p

Piotr Krzemiński

04/27/2023, 11:50 AM
thanks! 🙇 sure, feel free to ask as often as you need
if you write a comment under the bug, I’ll be able to assign you there
j

Jan-Ove Weichel

04/27/2023, 7:15 PM
I managed to get everything running again. But there are a couple of things where I’m not 100% sure how to proceed with them. I’ve marked them in this PR with some comments: https://github.com/typesafegithub/github-workflows-kt/pull/802
p

Piotr Krzemiński

04/27/2023, 8:00 PM
Awesome! @jmfayard please take a look
j

jmfayard

04/28/2023, 5:33 AM
done
p

Piotr Krzemiński

05/03/2023, 8:56 AM
@Jan-Ove Weichel looks like Windows tests fail in your PR. Do you need some help with this?
j

Jan-Ove Weichel

05/03/2023, 8:58 AM
@Piotr Krzemiński That would be great. I still have a Windows PC but I haven’t setup any dev-environment there.
p

Piotr Krzemiński

05/03/2023, 8:58 AM
Take a look at how slashes/backslashes are handled in file paths. It's already handled in other places in the code
For more hints press "h" :)
j

Jan-Ove Weichel

05/03/2023, 9:06 AM
I already thought, that this is probably the error. But it would be helpful to know at what places this happens. And it’s right now a bit annoying for me to test, since the build on Github only runs when a maintainer allows it. But I’ll try to get this setup on my Windows machine today or tomorrow and hopefully figure out where the specific problem is.
p

Piotr Krzemiński

05/03/2023, 9:13 AM
You can enable CI in your fork, then I think they will run on your branch
I don't own a Windows machine :)
v

Vampire

05/03/2023, 9:27 AM
That's what VirtualBox is made for. 😄
p

Piotr Krzemiński

05/03/2023, 9:30 AM
I don't want to pay for Windows
v

Vampire

05/03/2023, 9:30 AM
Steal it 😄
No, of course don't
But it would be helpful to know at what places this happens.
Isn't the test results in the build scan enough to see where the problem is @Jan-Ove Weichel?
p

Piotr Krzemiński

05/03/2023, 9:33 AM
Yeah, we publish build scans for every build, I've just checked it shows the full assertion message - there's a mismatch at least in the file path in the YAML
j

Jan-Ove Weichel

05/03/2023, 9:43 AM
The build scan ist actually helpful 👍