Skip to content

Unable to force Bash on Windows (in GitHub CI)Β #50

@Kocal

Description

@Kocal

Hi,

I'm trying to use rust-parallel on Symfony UX to speed-up our CI when running Windows tests (symfony/ux#2997), where I want to merge these steps:

- name: Run packages tests (Unix)
  if: matrix.os != 'windows-latest'
  run: |
    source .github/workflows/.utils.sh
    echo "$PACKAGES" | xargs -n1 | parallel -j +3 "_run_task {} \
      '(cd src/{} \
      && $COMPOSER_MIN_STAB \
      && $COMPOSER_UP \
      && if [ {} = LiveComponent ]; then install_property_info_for_version \"${{ matrix.php-version }}\" \"${{ matrix.minimum-stability }}\"; fi \
      && $PHPUNIT)'"

- name: Run packages tests (Windows)
  if: matrix.os == 'windows-latest'
  run: |
    source .github/workflows/.utils.sh

    # parallel is not available on Windows, so we need to run the tests sequentially
    FAILED_PACKAGES=""
    for PACKAGE in $PACKAGES; do
      if ! PACKAGE="$PACKAGE" _run_task_sequential $PACKAGE \
        '(cd src/$PACKAGE \
        && $COMPOSER_MIN_STAB \
        && $COMPOSER_UP \
        && if [ "$PACKAGE" = "LiveComponent" ]; then install_property_info_for_version \"${{ matrix.php-version }}\" \"${{ matrix.minimum-stability }}\"; fi \
        && $PHPUNIT)'; then
        FAILED_PACKAGES="$FAILED_PACKAGES $PACKAGE"
      fi
    done

    if [ -n "$FAILED_PACKAGES" ]; then
      echo "The following packages failed:$FAILED_PACKAGES"
      exit 1
    fi

to a single step.

I think it follows issue #8, where I'm not able to run Bash when being on Windows (we use some Bash functions from .github/workflows/.utils.sh):

  • if I pass --shell-path bash, I'm having an error /c: /c: Is a directory on Windows, because Self::default_shell_argument() is /c
  • so I tried to pass --shell-path bash --shell-argument -c, but now I have the following error on Windows and Linux jobs:
error: unexpected argument '-c' found

  tip: to pass '-c' as a value, use '-- -c'

You can reproduce the issue with:

 echo "a b c" | xargs -n1 | rust-parallel -j 2 -s -r '(.+)' --shell-path bash --shell-argument -c "echo {1}"

And since I'm not seeing any examples or tests about --shell-argument usage, I don't know if I'm doing something wrong or if the current behavior is broken. πŸ˜•

Do you know what's happening?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions