tj-actions / coverage-badge-py

:octocat: Github action to generate coverage badge without uploading results to a 3rd party.
MIT License
60 stars 20 forks source link

[BUG] coverage-badge-py does not work on python3.12 #160

Open ebourgeois opened 6 months ago

ebourgeois commented 6 months ago

Is there an existing issue for this?

Does this issue exist in the latest version?

Describe the bug?

When using this action in a python3.12 runner, it fails with:

Collecting coverage-badge
  Downloading coverage_badge-1.1.0-py2.py3-none-any.whl.metadata (3.2 kB)
Collecting coverage (from coverage-badge)
  Downloading coverage-7.4.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (8.2 kB)
Downloading coverage_badge-1.1.0-py2.py3-none-any.whl (6.4 kB)
Downloading coverage-7.4.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (238 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 238.2/238.2 kB 9.7 MB/s eta 0:00:00
Installing collected packages: coverage, coverage-badge
Successfully installed coverage-7.4.4 coverage-badge-1.1.0
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.2/x64/bin/coverage-badge", line 5, in <module>
    from coverage_badge.__main__ import main
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/coverage_badge/__main__.py", line 7, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

To Reproduce

  1. In a python 3.12 environment
  2. pip install -U coverage-badge

What OS are you seeing the problem on?

all

Expected behavior?

Project should use importlib and install correctly

Relevant log output

2024-03-25T15:13:08.0397921Z ##[group]Run tj-actions/coverage-badge-py@v2
2024-03-25T15:13:08.0398415Z with:
2024-03-25T15:13:08.0398785Z   output: coverage.svg
2024-03-25T15:13:08.0399160Z   overwrite: true
2024-03-25T15:13:08.0399492Z   working-directory: .
2024-03-25T15:13:08.0399852Z env:
2024-03-25T15:13:08.0400261Z   pythonLocation: /opt/hostedtoolcache/Python/3.12.2/x64
2024-03-25T15:13:08.0400842Z   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.2/x64/lib
2024-03-25T15:13:08.0401354Z ##[endgroup]
2024-03-25T15:13:08.0602942Z ##[group]Run pip install -U coverage-badge
2024-03-25T15:13:08.0603501Z pip install -U coverage-badge
2024-03-25T15:13:08.0604221Z EXTRA_ARGS=""
2024-03-25T15:13:08.0604592Z 
2024-03-25T15:13:08.0605001Z if [[ 'true' == 'true'  ]]; then
2024-03-25T15:13:08.0605457Z   EXTRA_ARGS+="-f"
2024-03-25T15:13:08.0605825Z fi
2024-03-25T15:13:08.0606176Z 
2024-03-25T15:13:08.0606669Z coverage-badge $EXTRA_ARGS -o "coverage.svg"
2024-03-25T15:13:08.0633549Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2024-03-25T15:13:08.0634148Z env:
2024-03-25T15:13:08.0634567Z   pythonLocation: /opt/hostedtoolcache/Python/3.12.2/x64
2024-03-25T15:13:08.0635167Z   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.2/x64/lib
2024-03-25T15:13:08.0635722Z ##[endgroup]
2024-03-25T15:13:08.5534334Z Collecting coverage-badge
2024-03-25T15:13:08.5890490Z   Downloading coverage_badge-1.1.0-py2.py3-none-any.whl.metadata (3.2 kB)
2024-03-25T15:13:08.9152232Z Collecting coverage (from coverage-badge)
2024-03-25T15:13:08.9181250Z   Downloading coverage-7.4.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (8.2 kB)
2024-03-25T15:13:08.9266842Z Downloading coverage_badge-1.1.0-py2.py3-none-any.whl (6.4 kB)
2024-03-25T15:13:08.9313740Z Downloading coverage-7.4.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (238 kB)
2024-03-25T15:13:08.9580916Z    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 238.2/238.2 kB 9.7 MB/s eta 0:00:00
2024-03-25T15:13:09.1627841Z Installing collected packages: coverage, coverage-badge
2024-03-25T15:13:09.3023913Z Successfully installed coverage-7.4.4 coverage-badge-1.1.0
2024-03-25T15:13:09.4669826Z Traceback (most recent call last):
2024-03-25T15:13:09.4677994Z   File "/opt/hostedtoolcache/Python/3.12.2/x64/bin/coverage-badge", line 5, in <module>
2024-03-25T15:13:09.4678915Z     from coverage_badge.__main__ import main
2024-03-25T15:13:09.4680329Z   File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/coverage_badge/__main__.py", line 7, in <module>
2024-03-25T15:13:09.4681344Z     import pkg_resources
2024-03-25T15:13:09.4681913Z ModuleNotFoundError: No module named 'pkg_resources'
2024-03-25T15:13:09.4715261Z ##[error]Process completed with exit code 1.

Has all relevant logs been included?

Anything else?

No response

Code of Conduct

atchisson commented 4 months ago

I think it's more related to this issue than the action itself.

If anyone is still bumping into this problem, adding a pip install setuptools in a step before the coverage badge did it for me.