Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

Conversation

@galargh
Copy link
Contributor

@galargh galargh commented Nov 22, 2021

This is an alternative way of using msys2bash on windows machines during go-test runs.

It prepends C:/msys64/usr/bin to PATH. After this, whenever we request shell: bash, msys2's version will be picked ahead of git's.

With the original PR (#221) the workflow wasn't able to find the paths specified in https://github.com/protocol/multiple-go-modules/blob/master/action.yml#L28:

New-Item : Cannot find path 'D:\a\_temp\setup-msys2\msys2.cmd' because it does not exist.
At line:1 char:1
+ New-Item -ItemType SymbolicLink -Path D:/a/_temp/setup-msys2/bash-or- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (D:\a\_temp\setup-msys2\msys2.cmd:String) [New-Item], ItemNotFoundExcept 
   ion
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.NewItemCommand
 
Error: Process completed with exit code 1.

This alternative setup has been tested in libp2p/go-openssl#19 (NOTE: the red checkmarks are due to 32 bit tests failing which is unrelated to this change). If you inspect the windows tests run please have a look at shell description - shell: C:/msys64/usr/bin\bash.EXE.

I've found this way of accomplishing the task by inspecting installed software on windows runners: https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#msys2

@marten-seemann
Copy link
Contributor

How does this work? Is the msys2 executable named bash?

@galargh
Copy link
Contributor Author

galargh commented Nov 23, 2021

How does this work? Is the msys2 executable named bash?

Yes, exactly! These are shells that are available on windows-latest machines:

Shells (source)

Name Target
gitbash.exe C:\Program Files\Git\bin\bash.exe
msys2bash.cmd C:\msys64\usr\bin\bash.exe
wslbash.exe C:\Windows\System32\bash.exe

By default, when we request shell: bash C:\Program Files\Git\bin\bash.exe is used. When we add C:\msys64\usr\bin to PATH (it is not on the path at all to begin with) then C:\msys64\usr\bin\bash.exe preceeds the gitbash version so it is picked for subsequent steps instead.

Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

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

That's interesting. This means that we basically set bash = msys2 once, and all future steps will uses msys2 instead of bash.
This also needs that we won't need the changes we made in multiple-go-modules v1.3.

@mvdan, can you have a look at this?

Copy link
Contributor

@mvdan mvdan left a comment

Choose a reason for hiding this comment

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

Certainly looks easier :) I'd say link to the docs in the YAML, so that if they change those paths in the future, at least we know where to look immediately.

@galargh
Copy link
Contributor Author

galargh commented Dec 2, 2021

Thank you for the reviews!

If I understand correctly, merging this will automatically propagate the changes across all repos (https://github.com/protocol/.github#technical-details). So I just wanted to make sure - do we have any additional procedures around merging such changes or should I just merge and check back if there are any unmerged web3-bot PRs a bit later?

@marten-seemann
Copy link
Contributor

If I understand correctly, merging this will automatically propagate the changes across all repos (https://github.com/protocol/.github#technical-details). So I just wanted to make sure - do we have any additional procedures around merging such changes or should I just merge and check back if there are any unmerged web3-bot PRs a bit later?

Yes, so please don't merge to master. We try to keep the noise level low, so we just do a few deployments per year (ideally).
You can target the next branch. This branch has all the changes we want to get deployed next time we decide to deploy to all repos. Can you re-target this PR?

@galargh galargh changed the base branch from master to next December 3, 2021 15:51
@galargh galargh merged commit 3281439 into next Dec 8, 2021
@galargh galargh deleted the msys2-on-windows branch December 8, 2021 12:06
@galargh galargh linked an issue Dec 23, 2021 that may be closed by this pull request
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use msys2 on windows

6 participants