Closed seisman closed 4 months ago
@seisman thanks! Going to take a look into this, I suspect moving to a composite
will help solve this
@seisman, so we released 0.2.5
which is a composite
action. Would you be able to see if that works for you?
It still doesn't work. Now the error messages are:
Running ATS Action version: 0.2.5
==> Token of length 36 detected
==> Static token of length 40 detected
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting codecov-cli
Downloading codecov-cli-0.3.3.tar.gz (269 kB)
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/3s/vfzpb5r51gs6y328rmlgzm7c0000gn/T/pip-install-bPb9_m/codecov-cli/setup.py'"'"'; __file__='"'"'/private/var/folders/3s/vfzpb5r51gs6y328rmlgzm7c0000gn/T/pip-install-bPb9_m/codecov-cli/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/3s/vfzpb5r51gs6y328rmlgzm7c0000gn/T/pip-pip-egg-info-UorflE
cwd: /private/var/folders/3s/vfzpb5r51gs6y328rmlgzm7c0000gn/T/pip-install-bPb9_m/codecov-cli/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/3s/vfzpb5r51gs6y328rmlgzm7c0000gn/T/pip-install-bPb9_m/codecov-cli/setup.py", line 8, in <module>
with open(path.join(here, "README.md"), encoding="utf-8") as f:
TypeError: 'encoding' is an invalid keyword argument for this function
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
/Users/runner/work/_actions/codecov/codecov-ats/v0/dist/codecov_ats.sh: line 73: codecovcli: command not found
Codecov: Failed to properly create commit
Error: Process completed with exit code 1.
@seisman are you using python2? Or is this aliasing from somewhere else? Codecov CLI requires python3
Closing this out as the CLI does not support python2
Sorry for the late response. The real issue is that, we install Python and its dependencies via the setup-micromamba action, and run our tests using this Python interpreter. However, codecov-ats
action uses the system one, which is Python 3 on Linux and Python 2 on macOS.
@seisman we're looking into this. Given that the action is running in it's own shell we suspect we're defaulting to the system python instead of the micromamba one. We suspect that to be the issue.
I'll have an update next week
@seisman, I'm having a hard time discovering the reason here. Sometimes, it runs python2, sometimes it runs python3. It doesn't seem particularly consistent.
You can see in this run, that the macos 3.9 run seems to be in python2
here.
However, this is not true of other builds in the run, and it's also not true in other runs of the workflow. Do you have any idea why this might be?
Sometimes, it runs python2, sometimes it runs python3.
I think that's because the Linux system provides Python 3 while macOS provides Python 2 by defaults.
in the Linux run, the following message shows that codecov-ats still uses the system Python, rather than /home/runner/micromamba/envs/pygmt/bin/python
:
Requirement already satisfied: idna in /usr/lib/python3/dist-packages (from rfc3986[idna2008]<2,>=1.3->httpx==0.23.*->codecov-cli) (3.3)
Given that the action is running in it's own shell we suspect we're defaulting to the system python instead of the micromamba one.
I'm wondering if it's easier if the codecov-ats action can accept an option like PYTHON_EXE_PATH. If it's undefined, then use the system one or the first one found in the PATH. If defined (in my case, PYTHON_EXE_PATH=/home/runner/micromamba/envs/pygmt/bin/python
), then use the one specified by the user.
@seisman that is a good idea. We'll consider that, thanks for the suggestion.
You can kinda achieve the same thing by changing the configuration for the CLI (i.e. bypassing the action). The full documentation is here, but let me give the TL;DR
The step failing is label-analysis
, and that runs using the PytestStandardRunner. You can configure the runner with the pytest command to use.
To do that you can add to your codecov.yml
the following:
cli:
runners:
pytest:
pytest_command: ["/home/runner/micromamba/envs/pygmt/bin/python", "-m", "pytest"]
This will instruct the runner to use the appropriate Python interpreter. But I agree that it's not as clean as adding that to the action, so let's call it a workaround for now 😅
@seisman did this work for you?
The path /home/runner/micromamba/envs/pygmt/bin/python
is system-dependent, so it may work for Linux, but not on macOS/Windows.
@seisman thanks for your patience here. This is something we're looking to tackle imminently to help unblock you. Here's the issue https://github.com/codecov/engineering-team/issues/407
Feel free to weigh in on the approach described. Once this ships, I'll reach out again
@seisman as it's been some time, I'm not sure the current state of your usage. I believe a fix may have gone in, but I will close this issue for now. Please re-open if you are still running into problems.
Our project is trying to use the codecov/ats action in https://github.com/GenericMappingTools/pygmt/pull/2792, but it doesn't work as expected.
The codecov/ats actions produces the following errors (https://github.com/GenericMappingTools/pygmt/actions/runs/6740742232/job/18324277077?pr=2792):
We install Python and all dependencies (including
pytest-cov
) using the setup-micromamba action, but it seemscodecov lable-analysis
call the system one/usr/bin/python
.