将测试添加到GitLab管道

发布于 2025-02-13 01:35:21 字数 239 浏览 0 评论 0原文

我已经将文件(测试文件,pytest)推到了我的gitlab项目中,我想在GitLab项目的CI/CD中显示测试。

谁能告诉我我该怎么做?我尝试在.gitlab-ci.yml文件上添加测试,但是我不确定它的正确语法是什么。

我试图添加的内容:

testing_testing:
  stage: test
  script: test_sample.py

有什么想法吗?

I have pushed a file (test file, pytest) to my Gitlab project, I want to show tests run in a pipeline in CI/CD of the Gitlab project.

Can anyone tell me how can I do this? I tried to add a test at the .gitlab-ci.yml file, but I’m not sure what’s the right syntax of it.

What I tried to add :

testing_testing:
  stage: test
  script: test_sample.py

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清风无影 2025-02-20 01:35:21

有GitLab官方示例: lib/gitlab/ci/templates/python.gitlab-ci.yml·gitlab

在您的情况下,在CI中添加Python测试,您应该在运行Python脚本中添加图像。前任:

testing_testing:
  image: python:latest
  stage: test
  script: 
    - python test_sample.py

There is GitLab official example: lib/gitlab/ci/templates/Python.gitlab-ci.yml · GitLab

In your case, add a python test in CI, you should add an image to run your python script. ex:

testing_testing:
  image: python:latest
  stage: test
  script: 
    - python test_sample.py
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文