OSeMOSYS / otoole

OSeMOSYS Tools for Energy
https://otoole.readthedocs.io
MIT License
23 stars 17 forks source link

Update metadata #207

Closed trevorb1 closed 8 months ago

trevorb1 commented 8 months ago

Description

In this PR I update the following docs:

trevorb1 commented 8 months ago

ugh. I dont know what is up with coveralls right now, but will come back to this tomorrow or on monday. Using the existing action, I get the following traceback error only on the pull_request action.

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/coveralls/cli.py", line 95, in main
    result = coverallz.wear()
  File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/coveralls/api.py", line 257, in wear
    return self.submit_report(json_string)
  File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/coveralls/api.py", line 293, in submit_report
    raise CoverallsException(
coveralls.exception.CoverallsException: Could not submit coverage: 422 Client Error: Unprocessable Entity for url: https://coveralls.io/api/v1/jobs

Using the Coveralls GitHub Action I get the following error. Coveralls can find the coverage file, but just wont upload it.

Run coveralls report --debug       
  coveralls report --debug       
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib
    COVERALLS_DEBUG: true
    COVERALLS_CARRYFORWARD_FLAGS: 
    COVERALLS_FLAG_NAME: 
    COVERALLS_PARALLEL: 
    COVERALLS_ENDPOINT: https://coveralls.io/
    COVERALLS_GIT_BRANCH: 
    COVERALLS_GIT_COMMIT: 
    COVERALLS_REPO_TOKEN: ***
    COVERALLS_COMPARE_REF: 
    COVERALLS_COMPARE_SHA: 
    COVERALLS_SOURCE_HEADER: github-action

⠀⠀⠀⠀⠀⠀⣿
⠀⠀⠀⠀⠀⣼⣿⣧⠀⠀⠀⠀⠀⠀⠀ ⣠⣶⣾⣿⡇⢀⣴⣾⣿⣷⣆ ⣿⣿⠀⣰⣿⡟⢸⣿⣿⣿⡇ ⣿⣿⣿⣷⣦⠀⠀⢠⣿⣿⣿⠀⠀⣿⣿⠁⠀⣼⣿⡇⠀⢀⣴⣾⣿⡷
⠶⣶⣶⣶⣾⣿⣿⣿⣷⣶⣶⣶⠶  ⣸⣿⡟ ⠀⢠⣿⣿⠃⠈⣿⣿⠀⣿⣿⢠⣿⡿⠀⣿⣿⣧⣤⠀⢸⣿⡇⣠⣿⡿⠀⢠⣿⡟⣿⣿⠀⢸⣿⡿⠀⠀⣿⣿⠃⠀⢸⣿⣧⣄
⠀⠀⠙⢻⣿⣿⣿⣿⣿⡟⠋⠁⠀⠀ ⣿⣿⡇⠀ ⢸⣿⣿⠀⣸⣿⡟⠀⣿⣿⣾⡿⠁ ⣿⣿⠛⠛⠀⣿⣿⢿⣿⣏⠀⢀⣿⣿⣁⣿⣿⠀⣾⣿⡇⠀⢸⣿⡿⠀⠀⡀⠙⣿⣿⡆
⠀⠀⢠⣿⣿⣿⠿⣿⣿⣿⡄⠀⠀⠀ ⠙⢿⣿⣿⠇⠈⠿⣿⣿⡿⠋⠀⠀⢿⣿⡿⠁⠀⢸⣿⣿⣿⡇⢸⣿⣿⠀⣿⣿⣄⣾⣿⠛⠛⣿⣿⢠⣿⣿⣿ ⣼⣿⣿⣿ ⣿⣿⡿⠋⠀
⠀⢀⣾⠟⠋⠀⠀⠀⠙⠻⣷⡀⠀⠀

  v0.6.6

🔍 Detected coverage file: .coverage
☝️ Detected coverage format: python - .coverage
⏱️ Report parsing: 00:00:00.016743520
🚨 Nothing to report
Error: Process completed with exit code 1.
willu47 commented 8 months ago

We don't need to post coverage from each of the CI workflows - I suggest constraining coverage to only the one of the ubuntu python versions. That should speed up the workflows a little as well.

willu47 commented 8 months ago

Some hints:

The action's step needs to run after your test suite has outputted an LCOV file. Most major test runners can be configured to do so; if you're using Node, see more info here.

See pytest plugin pytest-cov documentation

You probably need to update the options for pytest in either the tox.ini config file or the setup.cfg file in the root directory

trevorb1 commented 8 months ago

Thanks for the note, @willu47. What I ended up doing was just putting the following conditional in the action. This way, tests are run for all versions but coverage is only uploaded for the one specific python version on ubuntu.

- name: Upload coverage data to converalls.io
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
  run: |
    pip install --upgrade coveralls
    coveralls --service=github

Then, if you check non-ubuntu python 3.11 actions, you can see that this step is skipped.

image

image

trevorb1 commented 8 months ago

Researching this, I guess we should switch to using the official Coveralls Action, as this is the recommended way by Coveralls. I will probably just create a new issue ticket for this tho, as getting Coveralls set up is a little outside the scope of this issue.

trevorb1 commented 8 months ago

For the time being, since the action is now working, I am going to merge this to wrap everything up for the JOSS review. If you have any concerns/feedback on this solution @willu47, please leave them in issue #208. Thanks! :)