NLeSC / python-template

Netherlands eScience Center Python Template
https://research-software-directory.org/software/nlesc-python-template
Apache License 2.0
181 stars 76 forks source link

Python info steps: switch bash -l to bash -e #341

Closed egpbos closed 1 year ago

egpbos commented 1 year ago

Fixes #219.

egpbos commented 1 year ago

The macOS log outputs show that the issue is fixed. If anyone wants to give this a LGTM, we can merge :)

egpbos commented 1 year ago

Good comment @sjvrijn, I should explain! Although I must admit I'm also not 100% sure. A couple of thoughts:

  1. The default shell mode in GitHub Actions is actually bash -e, see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell. Makes sense to me to just use the default when there's no reason not to.
  2. I'm not actually sure if we even need to specify the shell though, given that it's already the default...
  3. -l means open a login shell. I think (correct me if I'm wrong) the way GitHub Actions normally works is that you are basically running all steps in a workflow as sequential scripts from a single login session. In that session, environment variables and such have been set (e.g. for the Python environment). If you open a new login shell, those variables won't be around in that new login environment. The default way of running scripts is in non-login mode. That way, the environment of the login shell running the script is passed along. So removing the -l flag is actually the crucial part here.
  4. Why did it work for the Linux case though? No idea. 💀