gpt4 book ai didi

github - 带有工作服/github 操作的 Python 项目代码覆盖率徽章

转载 作者:行者123 更新时间:2023-12-04 04:14:58 24 4
gpt4 key购买 nike

我正在尝试向我的存储库 README.md 添加代码覆盖率 % 徽章
我目前正在使用 Github 操作来自动化我的 pytest 测试。我有自己的工作,但我一直在努力获得覆盖百分比徽章。我正在使用工作服来生成徽章,并基于 it looks like coveralls is expecting an lcov.info file .但是当我看到 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
尝试将“路径到 lcov”更改为“路径到 lcov”

关于github - 带有工作服/github 操作的 Python 项目代码覆盖率徽章,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60910770/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com