setup-python overrides PK_CONFIG_PATH
Description:
I'm attempting to run tests on MacOs that require mysqlclient installed. Version 2.2 of mysqlclient relies on pkg-config, runs pkg-config --exists mysqlclient during installation.
However even if I point PK_CONFIG_PATH to the mysqlclient pk config configuration, setup-python overrides it's contents, which makes the mysqlclient installation fail on macos.
This issue is non existing on ubuntu
Action version: v4
Platform:
- [ ] Ubuntu
- [x] macOS
- [ ] Windows
Runner type:
- [x] Hosted
- [ ] Self-hosted
Tools version: Python (Any version) mysqlclient 2.2.0
Repro steps:
tests-mysqlient-macosx:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: ankane/setup-mysql@v1
with:
mysql-version: 8.0
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Update PKG_CONFIG_PATH
run: echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/[email protected]/lib/pkgconfig" >> "$GITHUB_ENV"
- name: Check MySQL Version
run: mysqld --version
- name: Check pkg-config --exists mysqlclient
run: pkg-config --exists mysqlclient
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install mysqlclient
run: pip install mysqlclient==2.2.0
Expected behavior: Installation succedes,
Actual behavior: Installation fails on pkg-config being unable to read mysqlclient configuration
run with reproduced steps: https://github.com/ClearcodeHQ/pytest-mysql/actions/runs/6572608008 https://github.com/ClearcodeHQ/pytest-mysql/blob/f34496e7178c1740483ae8ba1953df9daee8e298/.github/workflows/tests.yml#L123
Hello @fizyk. Thank you for your report. You can try to use update-environment input. You can take a look at this example
@dmitry-shibanov thank you, that seems to be working around the issue, however, I think it would be also better if setup-python hadn't overridden the PK_CONFIG_PATH if it existed prior to running actions/setup-python 🤔 I'm afraid I might end sometimes with manually glued PK_CONFIG_PATH later if it'll be needed to also have PK_CONFIG_PATH from setup-python 🤔
It looks like the actions/core packages only allow to add variable values, https://github.com/actions/toolkit/blob/master/packages/core/src/core.ts#L39
With the exception of PATH: there's addPath functionality in core https://github.com/actions/toolkit/blob/main/packages/core/src/core.ts#L107 not sure if it would be possible for the team responsible for core to add also more general that could cover PK_CONFIG_PATH 🤔
Last thing, switching off the update-environment flag, also skips the PATH envvar update, which means I'll definitely need to update that manually, if I'll go that way.
I have worked around this problem with something like this: https://github.com/fizyk/actions-reuse/pull/139/files#diff-1db8f75d453bbec1df290471bddf711c2b236fa387b1030d308c44dae6d8e8e7R27
I just ran into this bug as well