zowe / zowe-cli

Zowe CLI
Eclipse Public License 2.0
114 stars 87 forks source link

CLI GitHub workflow fails to run locally on Windows #1210

Open t1m0thyj opened 2 years ago

t1m0thyj commented 2 years ago

I'm still having issues with using nektos/act locally 😢 Lots of integration tests fail with an error like the following:

Expected: ""
Received: "/mnt/c/Users/XXX/Projects/zowe-next/zowe-cli/packages/cli/__tests__/zostso/__integration__/issue/__scripts__/issue_help.sh: 2: set: Illegal option -·
"

Based on some Google searching, the error set: Illegal option -· seems to be caused by Bash scripts using Windows line endings (CRLF) instead of Unix ones (LF). I believe what is happening is that on my local machine, the Bash scripts are checked out with CRLF line endings, and then they're getting copied into the Ubuntu Docker container.

Curious what solution you would suggest here - should I change Git settings on my Windows machine to check out files with Unix line endings, or is there an easy way we can convert the line endings when files are copied into the Docker container?

Originally posted by @t1m0thyj in https://github.com/zowe/zowe-cli/pull/1196#pullrequestreview-809052274

t1m0thyj commented 2 years ago

This can be worked around by creating a .gitattributes file with the following contents as suggested here:

* text=auto
*.sh text eol=lf

This preserves the recommended setting of core.autocrlf = true on Windows for all files except .sh files, for which Unix line endings are preferred.

Rahulkhinchi03 commented 2 years ago

@t1m0thyj, Yes, I agree with your suggestion. I faced this error (not with ZOWE CLI, but in checkstyle).

@zFernand0 I would like to work on it. Please assign me to work on it.

Extras (if we can look for them): @t1m0thyj,

  1. What about dos2unix?
  2. Can we use https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings#global-settings-for-line-endings?
zFernand0 commented 2 years ago

Hey @Rahulkhinchi03, Thanks for showing interesting in working on this issue. As I mentioned in https://github.com/zowe/zowe-cli/issues/1445#issuecomment-1164763166, you should be hearing back from LFX soon 😋