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

Fixture test script not working on Windows (MINGW64) #705

Closed
1 task done
bukowa opened this issue Jun 15, 2024 · 3 comments · Fixed by #708
Closed
1 task done

Fixture test script not working on Windows (MINGW64) #705

bukowa opened this issue Jun 15, 2024 · 3 comments · Fixed by #708
Labels
bug Something isn't working

Comments

@bukowa
Copy link
Contributor

bukowa commented Jun 15, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

test-fixtures-locally.sh is not working on Windows when executed in bash provided by git installation (C:\Program Files\Git\bin\bash.exe

$ .github/fixtures/test-fixtures-locally.sh test-date-order
error: manifest path `/c/Users/buk/WebstormProjects/git-cliff/.github/fixtures/../../Cargo.toml` does not exist

Solution that works for me:

SCRIPT_DIR=$(cygpath -w "$SCRIPT_DIR")
FIXTURES_DIR=$(cygpath -w "$FIXTURES_DIR")

Steps To Reproduce

$ .github/fixtures/test-fixtures-locally.sh test-date-order
error: manifest path `/c/Users/buk/WebstormProjects/git-cliff/.github/fixtures/../../Cargo.toml` does not exist

Expected behavior

It works.

Screenshots / Logs

No response

Software information

  • Operating system: Windows
  • Rust version:
  • Project version:

Additional context

Originally posted by @orhun in #696 (comment)

@bukowa bukowa added the bug Something isn't working label Jun 15, 2024
@orhun orhun changed the title .github/fixtures/test-fixtures-locally.sh not working on windows with MINGW64 Fixture test script not working on Windows (MINGW64) Jun 15, 2024
@orhun orhun removed their assignment Jun 15, 2024
@orhun
Copy link
Owner

orhun commented Jun 15, 2024

It would be nice to detect if this is being run on Windows and set those environment variables.

Unfortunately I don't have a Windows machine to test this.

@bukowa
Copy link
Contributor Author

bukowa commented Jun 15, 2024

It would be nice to detect if this is being run on Windows and set those environment variables.

What do you think? Works for me.

# Check if we are running on Windows with MINGW64 and if cygpath is available
if [ -n "$MSYSTEM" ] && [ "$MSYSTEM" = "MINGW64" ]; then
  echo "Running inside MINGW64 trying to convert paths to Windows format."
  if command -v cygpath > /dev/null 2>&1; then
    # Convert the path to Windows format
    SCRIPT_DIR=$(cygpath -w "$SCRIPT_DIR")
    FIXTURES_DIR=$(cygpath -w "$FIXTURES_DIR")
  else
    echo "WARNING: cygpath command not found in the PATH. The script may not work correctly on Windows."
    exit 1
  fi
fi

@orhun
Copy link
Owner

orhun commented Jun 15, 2024

LGTM, feel free to send a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants