Hi. I created a feature request today regarding t...
# github-workflows-kt
j
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
@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
Here is the Stacktrace:
Copy code
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
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
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
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
@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
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
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
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
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
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
Awesome! @jmfayard please take a look
j
done
p
@Jan-Ove Weichel looks like Windows tests fail in your PR. Do you need some help with this?
j
@Piotr Krzemiński That would be great. I still have a Windows PC but I haven’t setup any dev-environment there.
p
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
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
You can enable CI in your fork, then I think they will run on your branch
I don't own a Windows machine :)
v
That's what VirtualBox is made for. 😄
p
I don't want to pay for Windows
v
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
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
The build scan ist actually helpful 👍