[英]GitLab CI shared Windows runner for Python
我在 GitLab 中有一个 python 项目回购。 我看到 GitLab 在可用的 beta 版本中共享了 Windows 跑步者(见这篇文章)。
我想知道 Windows 共享跑步者上的 python 是否有任何标准gitlab-ci.yml
? 如果是这样,由于这仍然是测试版,我很好奇它有多稳定? 对于那些使用过这个并且有过 AppVeyor 经验的人,我是用 AppVeyor 还是这个更好?
谢谢!
我希望它仍然相关,但您可以使用巧克力在虚拟机上安装 python gitlab windows 跑步者创建示例:如 next.gitlab-ci.yml
.shared_windows_runners:
tags:
- shared-windows
- windows
- windows-1809
before_script:
- Set-Variable -Name "time" -Value (date -Format "%H:%m")
- echo ${time}
- echo "started by ${GITLAB_USER_NAME}"
- choco install python --version=3.7.0 -y -f
stages:
- build
build_somthing:
extends:
- .shared_windows_runners
stage: build
script:
- "C:\\Python37\\python.exe -m pip install --upgrade setuptools"
- "C:\\Python37\\python.exe -m pip install -r requirements.txt"
chocolatey will install python in path: C:\Python37, so if you want to use python you can use it as follows: "C:\Python37\python.exe -m pip install --upgrade setuptools"
您可以使用此代码段:
my_win_job:
before_script:
# https://gitlab.com/gitlab-org/ci-cd/shared-runners/images/gcp/windows-containers/-/issues/13
- Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
- choco install python3 --version=$PYTHON_VERSION --yes --force --no-progress
- refreshenv
script:
- python -V
- python -m pip install -U pip wheel
variables:
PYTHON_VERSION: "3.9"
tags:
- windows
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.