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

Why publish.yml flip between sh and bash? #152

Open
pllim opened this issue Aug 22, 2023 · 2 comments
Open

Why publish.yml flip between sh and bash? #152

pllim opened this issue Aug 22, 2023 · 2 comments

Comments

@pllim
Copy link
Contributor

pllim commented Aug 22, 2023

https://github.com/OpenAstronomy/github-actions-workflows/blob/main/.github/workflows/publish.yml uses both shell: sh and shell: bash which is really confusing. I find that conditional does not work at #149 (comment) and I am not sure how to fix it here.

Also see liberfa/pyerfa#111

@ConorMacBride
Copy link
Member

The error is happening because the $( ... ) in

env: |
  CIBW_ENVIRONMENT: 'PIP_PRE=$( if [ "${CIBW_BUILD:0:5}" == "cp312" ]; then echo 1; else echo 0; fi )'

is being evaluated before it is passed to cibuildwheel, which it should not, because $CIBW_BUILD is not set at that stage.

I tried escaping it

env: |
  CIBW_ENVIRONMENT: 'PIP_PRE=\$( if [ "\${CIBW_BUILD:0:5}" == "cp312" ]; then echo 1; else echo 0; fi )'

so that it is evaluated inside cibuildwheel, but cibuildwheel then gives an error: https://github.com/ConorMacBride/test-workflows/actions/runs/5944886137/job/16123000921#step:7:279.

Not sure why. I'll take another look at this later.

@pllim
Copy link
Contributor Author

pllim commented Aug 23, 2023

Thanks for investigating! If this cannot work, then what would be better?

  1. Have a new input to set this from workflow interface; or
  2. Recommend that people have separate jobs if they need to set CIBW_ENVIRONMENT to different values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants