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: Action did not work on Windows runners. #257

Merged
merged 6 commits into from
Mar 21, 2024

Conversation

sokuhatiku
Copy link
Contributor

Changes

Fix action to work on windows-latest

  • Replaced symlink to simple javascript.
  • Fixed wrong UnityEditor paths.
  • Fixed wrong project path at Standalone tests.
  • Added nographics option to Editor command line variable.

Added tests to verify that action works on windows-latest

  • Specified runs-on bash for replacing script backend process for IL2CPP.

Related Issues

Successful Workflow Run Link

Notes

  • This PR adds -nographics option to the Unity command line arguments on windows runner. This change affects tests that use graphics features such as RenderTexture for example.
  • To see if tests work correctly with windows-latest, this PR increases number of test patterns in main.yml from 49 to 79.

Checklist

  • Read the contribution guide and accept the code of conduct
  • Docs (If new inputs or outputs have been added or changes to behavior that should be documented. Please make a PR
    in the documentation repo)
  • Readme (updated or not needed)
  • Tests (added, updated or not needed)

Copy link

Cat Gif

@sokuhatiku sokuhatiku changed the title fix: Tests did not work on Windows runners. fix: Action did not work on Windows runners. Jan 12, 2024
Copy link
Member

@GabLeRoux GabLeRoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some small comments while reviewing. Overall, this looks good to me. I think it's worth having an additionnal review on this before merging and creating a release.

Thanks a lot for your contributions sokuhatiku! :D

.github/workflows/main.yml Show resolved Hide resolved
dist/platforms/windows/run_tests.ps1 Show resolved Hide resolved
dist/platforms/windows/run_tests.ps1 Show resolved Hide resolved
Comment on lines -1 to +2
import { run as main } from './main';
import path from 'path';
import { run as post } from './post';

/*
* GitHub Action can provide multiple executable entrypoints (pre, main, post),
* but it is complicated process to generate multiple `.js` files with `ncc`.
* So we rather generate just one entrypoint, that is symlinked to multiple locations (main.js and post.js).
* Then when GitHub Action Runner executes it as `node path/to/main.js` and `node path/to/post.js`,
* it can read arguments it was executed with and decide which file to execute.
* The argv[0] is going to be a full path to `node` executable and
* the argv[1] is going to be the full path to the script.
* In case index.js would be marked executable and executed directly without the argv[1] it defaults to "main.js".
*/
async function run([, name = 'main.js']: string[]) {
const script = path.basename(name);

switch (script) {
case 'main.js':
await main();
break;
case 'post.js':
await post();
break;
default:
throw new Error(`Unknown script argument: '${script}'`);
}
}

run(process.argv);
export { run as main } from './main';
export { run as post } from './post';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too familiar with that specific section. I definitely prefer the one with less lines. This was done in the following commit: dea8579

I assume it is fine, but I'd like @webbertakken's input on this part just in case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

dist/main.js Outdated
Copy link
Member

@GabLeRoux GabLeRoux Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edit: nevermind, I misread my own change. I tried to build this myself to see if there was a difference with the build and I had a different result than what I see here. See 32df7d8.

I wonder if the Node version used to build has an impact here. branch is fix/windows-runner-dist-644. Don't mind the 644 in there, that's a small misunderstanding on my side which I figured out after writing here.

I personally built on Node v18.19.0.

Copy link
Member

@davidmfinol davidmfinol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@webbertakken
Copy link
Member

@sokuhatiku Would you mind rebasing and regenerating the dist files? Should be straight forward.

I think it would be great to merge this one.

@sokuhatiku
Copy link
Contributor Author

@webbertakken I've rebased and regenerated the dist files as requested.

@webbertakken webbertakken merged commit 75d0d76 into game-ci:main Mar 21, 2024
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

Successfully merging this pull request may close these issues.

4 participants