-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Make buidler work on windows #439
Make buidler work on windows #439
Conversation
This is the last run in actions for this: /~https://github.com/fvictorio/buidler/actions/runs/36616440 which failed because it couldn't find One approach that I'm pretty sure would work for sure is to have cross-env installed in the root
which:
It goes without saying that this is convoluted and ugly. My guess is that the proper solution is related to fixing the problem with |
4e74ebb
to
d926fd8
Compare
My bad, I forgot to add Here's the action in action: /~https://github.com/fvictorio/buidler/runs/434787498 The tests step passes because the shelljs scripts aren't throwing when a command fails. I will fix that next. |
The windows runner in GitHub Actions has autocrlf set to true by default. This means that files are checked out with CRLF line endings, which causes the linter to throw a lot of errors. This should fix that.
1a5230d
to
2c4d054
Compare
15bf5b8
to
46b6e95
Compare
46b6e95
to
ecb3823
Compare
@@ -59,8 +60,8 @@ describe("Typescript support", function() { | |||
}); | |||
|
|||
assert.deepEqual(tests.sort(), [ | |||
await fsExtra.realpath("test/js-test.js"), | |||
await fsExtra.realpath("test/ts-test.ts") | |||
await fsExtra.realpath("test/js-test.js").then(slash), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why these need to be slash
ed. They are file paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TASK_TEST_GET_TEST_FILES
returns the files with unix slashes, even in windows. I thought it was easier to change the tests than the functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's surprising, and will probably lead to bugs in the future.
I think the problem comes from our glob
module. I'd rather normalize the paths to use the system's separators before returning them from it. This means modifying glob
and globSync
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I thought about that but it seemed a little out of scope. I will do it now 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed it adding the realpath
option to the glob utils. This fixes the problem and the test passes in both linux and windows. The docs have a caveat:
realpath Set to true to call fs.realpath on all of the results. In the case of a symlink that cannot be resolved, the full absolute path to the matched entry is returned (though it will usually be a broken symlink)
But that doesn't seem like it will be an issue here.
@@ -36,8 +36,12 @@ describe("Scripts runner", function() { | |||
); | |||
assert.equal(statusCode1, 0); | |||
|
|||
const statusCode2 = await runScript("./failing-script.js"); | |||
assert.notEqual(statusCode2, 0); | |||
const statusCode2 = await runScript( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this change needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember if the extra arguments were needed. The check for 123
was because at some point this tests was (wrongly) passing when the script failed with a 1 exit code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. Good catch! Can we leave the 123
and remove the extra params if they aren't necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. It passes on my machine, will see if they continue to pass on windows (it would be extremely weird if they don't).
scripts/run-tests.js
Outdated
|
||
shell.config.fatal = true // throw if a command fails | ||
|
||
const isLinux = os.type() === "Linux" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do isWindows
instead? This script is also used during development, and many contributors use mac.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isLinux
variable is only used for ignoring the buidler-vyper
tests in windows and mac. In windows, docker is available but defaulting to windows containers and changing it to linux containers is not straightforward (at least I wasn't able to do it easily). In mac, inside github actions, docker is not available for, I think, licensing reasons.
ba2784b
to
0a0acd6
Compare
This PR has some initial changes to make buidler work on windows.
scripts/install.sh
andscripts/run-tests.sh
scripts were rewritten in shelljs.cross-env
is used to make relative paths in scripts work. But, for this to work, the deletion of.bin
directories in the install script was commented out. This makes the whole purpose of using a relative path in the packages scripts unnecessary, socross-env
could just be replaced with the local binaries.The
run-tests.sh
scripts inside each package weren't migrated yet.