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

[CI] Fix test_macos with recent bash for nix-shell #10480

Merged
merged 2 commits into from
Mar 15, 2021

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Mar 6, 2021

Fixes the original issue of #10110 by installing bash from brew:

  1. The actual error is /nix/store/r0n4qzr800498l23cq80mg0k03j3aqms-cctools-binutils-darwin-wrapper-927.0.2/nix-support/setup-hook: line 138: ${role_pre}${cmd^^}=${cmd}: bad substitution. Looks like macos ships a really old bash version (3.2) and the substitution requires at least 4.0. So that should be easy to fix, just install a recent bash.

Also moves nix initialization to prepare_build stage.

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:infrastructure platform:darwin labels Mar 6, 2021
@straight-shoota straight-shoota changed the title [CI] Initialize nix environment in prepare_build [CI] Fix test_macos with recent bash for nix-shell Mar 7, 2021
@bcardiff
Copy link
Member

bcardiff commented Mar 9, 2021

I've been using GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18) without any issues.

But if setting up a new bash on the CI is needed it fine.

I played a bit locally:

$ nix-shell --pure --run 'A=3 exit $A'
$ echo $?
0 # :-(

$ nix-shell --pure --run 'export A=3; exit $A'
$ echo $?
3 # :-)

So, maybe we need to change:

--- on_nix_shell nix-shell --pure $CI_NIX_SHELL_ARGS --run "'TZ=$TZ $command'"
+++ on_nix_shell nix-shell --pure $CI_NIX_SHELL_ARGS --run "'export TZ=$TZ; $command'"

wdyt?

@straight-shoota
Copy link
Member Author

@straight-shoota
Copy link
Member Author

straight-shoota commented Mar 13, 2021

Can this get an approval? This is necessary to make CI (somewhat) reliable on macos again.

Copy link
Member

@sdogruyol sdogruyol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @straight-shoota 🙏

@bcardiff bcardiff merged commit 9e049e7 into crystal-lang:master Mar 15, 2021
@straight-shoota straight-shoota deleted the fix/gha-nix-darwin branch March 15, 2021 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. platform:darwin topic:infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants