Git Product home page Git Product logo

Comments (5)

iamFIREcracker avatar iamFIREcracker commented on June 12, 2024 1

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!

from setup-msys2.

eine avatar eine commented on June 12, 2024

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?

from setup-msys2.

newhoggy avatar newhoggy commented on June 12, 2024

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?

from setup-msys2.

eine avatar eine commented on June 12, 2024

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

from setup-msys2.

eine avatar eine commented on June 12, 2024

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.

from setup-msys2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.