Python 带有工作服的项目代码覆盖率徽章/github 操作
Python project code coverage badge with coveralls / github actions
我正在尝试将代码覆盖率 % 徽章添加到我的存储库 README.md
我目前正在使用 Github 操作来自动化我的 pytest 测试。我有它自己的工作,但我一直在努力尝试获得覆盖率 % 徽章。我正在使用工作服来生成徽章,并且基于 it looks like coveralls is expecting an lcov.info file. But when I look at the reporting options for pytest-cov 我没有看到它的输出选项。
我已经尝试生成其他类型,例如 xml 并配置为查找此类型,但它仍在 coverage 文件夹中查找 lcov.info。下面是我当前的 pythonapp.yml 文件。当前失败的步骤是寻找 ./coverage/lcov.info
的工作服
如能提供有关我做错了什么或如何解决的任何帮助,我们将不胜感激。
name: tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pip install pytest pytest-cov
python -m pytest --cov=./myapp --cov-report xml
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path--to-lcov: coverage.xml
在我看来,您在“path-to-lcov”的参数名称中多了一个连字符
根据此处的文档:https://github.com/marketplace/actions/coveralls-github-action
尝试将“path--to-lcov”更改为“path-to-lcov”
我正在尝试将代码覆盖率 % 徽章添加到我的存储库 README.md
我目前正在使用 Github 操作来自动化我的 pytest 测试。我有它自己的工作,但我一直在努力尝试获得覆盖率 % 徽章。我正在使用工作服来生成徽章,并且基于 it looks like coveralls is expecting an lcov.info file. But when I look at the reporting options for pytest-cov 我没有看到它的输出选项。
我已经尝试生成其他类型,例如 xml 并配置为查找此类型,但它仍在 coverage 文件夹中查找 lcov.info。下面是我当前的 pythonapp.yml 文件。当前失败的步骤是寻找 ./coverage/lcov.info
如能提供有关我做错了什么或如何解决的任何帮助,我们将不胜感激。
name: tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pip install pytest pytest-cov
python -m pytest --cov=./myapp --cov-report xml
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path--to-lcov: coverage.xml
在我看来,您在“path-to-lcov”的参数名称中多了一个连字符
根据此处的文档:https://github.com/marketplace/actions/coveralls-github-action
尝试将“path--to-lcov”更改为“path-to-lcov”