bash_unit icon indicating copy to clipboard operation
bash_unit copied to clipboard

[BUG] `install` fails on GH Action

Open dalisoft opened this issue 1 year ago β€’ 5 comments

Hi @pgrange

Installation on GH Action macOS fails (see this line) which shows

https://github.com/pgrange/bash_unit/blob/30b59189a4d50dde86c6b107f5015f28ff188666/install.sh#L5

Seems something got wrong but we can't see due of silent curl

dalisoft avatar Apr 26 '24 16:04 dalisoft

Hi @dalisoft ,

Indeed, curl was way too silent in the install script. Sorry for the inconvenience. I've changed the option so that, hopefully, you can figure out what's happening in this CI.

See 3c1bdb0 on main branch.

I think you only have to restart the job and see what happens. Let me know if that helps. Cheers,

pgrange avatar Apr 28 '24 10:04 pgrange

Hi @pgrange and thank you for fix.

Seems it’s my fault not bash_unit as i am used bash_unit with bash -eu flag which causes fail on GH Actions macOs runner but locally works fine.

we can keep this opened, i will debug this once i finish my project release-me

dalisoft avatar Apr 28 '24 11:04 dalisoft

I am able to reproduce the bug and this is really not bashcov bug, an OS itself because it fails if one of immune tools are missing. In the case of this bug, shuf was case.

bash -eux ./bash_unit

release-me on ξ‚  master [$] via 🐳 ubuntu-vm is πŸ“¦ v0.9.2 via πŸ₯Ÿ v1.1.12 via β¬’ v20.13.1 via πŸ’Ž v3.3.2 
❯ env $(cat .env.test) bash -eux ./bash_unit tests/**/*.test.sh
+ VERSION=v2.3.1
++ printf '\033'
+ ESCAPE=$'\E'
+ NOCOLOR=''
+ RED=''
+ GREEN=''
+ YELLOW=''
+ BLUE=''
++ type -P cat
+ CAT=/bin/cat
++ type -P sed
+ SED=/usr/bin/sed
++ type -P grep
+ GREP=/usr/bin/grep
++ type -P rm
+ RM=/bin/rm
++ type -P shuf
++ exit 1
+ SHUF=

If i will change

https://github.com/pgrange/bash_unit/blob/3c1bdb074b01b7f779cff5fec525df1ef61a354d/bash_unit#L32-L36

lines to

CAT="$(type -P cat || exit 0)"
SED="$(type -P sed || exit 0)"
GREP="$(type -P grep || exit 0)"
RM="$(type -P rm || exit 0)"
SHUF="$(type -P shuf || exit 0)"

It runs and passes all tests

dalisoft avatar Jun 09 '24 15:06 dalisoft

Hi @dalisoft,

shuf is needed to run tests in a random order (See -r option of bash_unit). It is part of the core-utils package on Debian or Ubuntu and so always present. But, indeed, it is not installed on OS X, hence the error you observe.

I've switch from shuf to using sort -R instead as this is available both on Linux and OS X systems. This should solve this issue.

Cheers,

pgrange avatar Jun 10 '24 07:06 pgrange

Thank you @pgrange

dalisoft avatar Jun 10 '24 08:06 dalisoft