如何从 gitlab CI 工件文件夹发布覆盖率报告?
How to publish coverage report from gitlab CI artifacts folder?
我正在按照以下教程创建代码覆盖率报告:Publish code coverage report with GitLab Pages
我的 .gitlab-ci.yml
文件看起来与教程中的一样,除了我在 python
中做的
image: ubuntu:18.04
variables:
CODECOV_TOKEN: $CODECOV_TOKEN
stages:
- coverage
- deploy
coverage:
stage: coverage
before_script:
- apt-get -y update
- apt-get -y install curl python3-pip python3.7 zip
- python3.7 -m pip install --upgrade pip
- python3.7 -V
- pip3.7 install -r requirements.txt
script:
- coverage run -m pytest
- coverage report -m
- coverage html
artifacts:
paths:
- htmlcov/
pages:
stage: deploy
dependencies:
- coverage
script:
- mv htmlcov/ public/
artifacts:
paths:
- public/
当 .yml
文件为 运行 时,它会创建一个名为 public
的工件
此文件夹包含index.html
,其内容为
现在,我想在回购协议中将 52% 作为覆盖率标志。从上面的教程中,我想知道我应该使用哪个 link 以便我可以在 repo 中获得徽章。在教程中,在 Using the code coverage report badge 部分下,他们有一个 markdown source
[](http://gitlab-org.gitlab.io/gitlab-ce/coverage-ruby)
我对这些 link 是什么感到有点困惑,因此想知道这对我的项目有什么用?
在你这里
->> settings
->> ci_cd
->> General pipelines
->> Test coverage parsing
它将扫描您 gitlab-ci 日志以捕获正则表达式。
我猜!
但是,我认为这是答案。
在您的项目中,转到设置 > CI/CD 并展开常规管道 部分。您会找到将 pipeline
和 coverage
徽章添加到您的项目所需的代码。在此部分中,您还可以指定分支名称,以便徽章显示该分支的状态。
如果您坚持使用 coverage: unknown
徽章,您可以使用此 link 阅读我的问题解决方案:
Gitlab coverage badge is always unknown
我正在按照以下教程创建代码覆盖率报告:Publish code coverage report with GitLab Pages
我的 .gitlab-ci.yml
文件看起来与教程中的一样,除了我在 python
image: ubuntu:18.04
variables:
CODECOV_TOKEN: $CODECOV_TOKEN
stages:
- coverage
- deploy
coverage:
stage: coverage
before_script:
- apt-get -y update
- apt-get -y install curl python3-pip python3.7 zip
- python3.7 -m pip install --upgrade pip
- python3.7 -V
- pip3.7 install -r requirements.txt
script:
- coverage run -m pytest
- coverage report -m
- coverage html
artifacts:
paths:
- htmlcov/
pages:
stage: deploy
dependencies:
- coverage
script:
- mv htmlcov/ public/
artifacts:
paths:
- public/
当 .yml
文件为 运行 时,它会创建一个名为 public
的工件
index.html
,其内容为
现在,我想在回购协议中将 52% 作为覆盖率标志。从上面的教程中,我想知道我应该使用哪个 link 以便我可以在 repo 中获得徽章。在教程中,在 Using the code coverage report badge 部分下,他们有一个 markdown source
[](http://gitlab-org.gitlab.io/gitlab-ce/coverage-ruby)
我对这些 link 是什么感到有点困惑,因此想知道这对我的项目有什么用?
在你这里
->> settings
->> ci_cd
->> General pipelines
->> Test coverage parsing
它将扫描您 gitlab-ci 日志以捕获正则表达式。
我猜!
但是,我认为这是答案。
在您的项目中,转到设置 > CI/CD 并展开常规管道 部分。您会找到将 pipeline
和 coverage
徽章添加到您的项目所需的代码。在此部分中,您还可以指定分支名称,以便徽章显示该分支的状态。
如果您坚持使用 coverage: unknown
徽章,您可以使用此 link 阅读我的问题解决方案:
Gitlab coverage badge is always unknown