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

Streamlining matrix builds #71

Closed
newhoggy opened this issue Sep 24, 2020 · 5 comments
Closed

Streamlining matrix builds #71

newhoggy opened this issue Sep 24, 2020 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@newhoggy
Copy link

I'm interested in streamlining matrix builds that include Linux and MacOS.

Currently, msys2/setup-msys2 fails on non-Windows platforms. It would be nice if there was an option to not fail and instead do nothing. This would mean I don't have to conditionally perform the installation.

Additionally, having an extra msys2do shell command which internally runs msys2 -c <cmd> on Windows and runs <cmd> directly everywhere else also helps.

@eine
Copy link
Collaborator

eine commented Sep 24, 2020

Hi @newhoggy! I think it's ok not to fail on non-Windows platforms but display a warning instead.

With regard to msysdo, unfortunately it is not possible to have the same file behave differently, because it's a cmd file. The non-Windows execution would need to create a different file. Instead, I think that an alias msys2=bash should be created. Either shell: bash {0} or run: bash -c 'uname -a' are valid commands.

Do you want to give it a try?

@eine eine added enhancement New feature or request good first issue Good for newcomers labels Sep 24, 2020
@newhoggy
Copy link
Author

Is there a way to make alias msys2=bash persist between jobs? The commands I want to run under msys2 are scattered amongst multiple jobs?

@eine
Copy link
Collaborator

eine commented Sep 24, 2020

Note that currently setup-msys2 is not persistent between jobs. It works for multiple steps, but it needs to be executed in each job.

From a technical point of view, rather than an alias, you might want to symlink e.g. /usr/bin/msys2 to /usr/bin/bash. That's actually the "interesting" issue of this feature: finding the solution that is preserved properly.

For using msys2 in multiple step, set it as a global shell. See https://github.com/msys2/setup-msys2#usage

@iamFIREcracker
Copy link
Contributor

FYI, in a custom action of mine I ended up creating a bash-or-msys2 symlink pointing to bash on Linux / Mac OS, and msys2.cmd on Windows; thanks to that, and the fact that I used it as shell parameter for some of my action steps (i.e. shell: bash-or-msys2 {0}), I saved myself from duplicating a bunch of steps simply because it's still not possible to inject shell to composite action (see: that actions/runner#835).

    - name: Create bash-or-msys2
      shell: bash
      run: |
        if [[ "$RUNNER_OS" == "Windows" ]]; then
            powershell New-Item -ItemType SymbolicLink \
              -Path  "D:/a/_temp/setup-msys2/bash-or-msys2.cmd" \
              -Target "D:/a/_temp/setup-msys2/msys2.cmd"
        else
            sudo ln -sf $(which bash) /usr/local/bin/bash-or-msys2
        fi
        ...
    - name: Upgrade ASDF to the Latest Version
      shell: bash-or-msys2 {0}
      run: |
        if [[ "${{ inputs.asdf-version }}" != "latest" ]]; then
            echo ::group::Installing ASDF ${{ inputs.asdf-version }}
            ros install asdf/${{ inputs.asdf-version }}
        else
            echo ::group::Installing latest ASDF
            ros install asdf
        fi
        echo ::endgroup::

Hope it helps!

@eine
Copy link
Collaborator

eine commented Nov 8, 2021

Option platform-check-severity was added in v2.6.0. See #172 and https://github.com/msys2/setup-msys2/blob/master/CHANGELOG.md#260---20211103.

@eine eine closed this as completed Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants