将ci结果部署到git
cico的Python项目详细描述
西科
将CI结果部署到Git
cico将ci环境生成的人工制品提交给git结果分支。
对于每个测试的分支,将在结果分支中创建一个目录。
- tested branch:您提交的分支已由CI工具签出
- results branch:应该部署结果的分支
- 可以位于与测试分支不同的存储库中
安装
$ pip install cico
用法
deploy.py
fromcicoimportTravisCIfromcico.resultsimportDirectory,File,BadgeTravisCI(repo=GitHub(USERNAME,# GitHub Username (e.g. 'stefanhoelzl')REPO_NAME,# GitHub Repository (e.g. 'ci-results')TOKEN),# GitHub Personal access tokens# ONLY ENCRYPTED (https://docs.travis-ci.com/user/environment-variables/#Defining-encrypted-variables-in-.travis.yml)branch=RESULT_BRANCH,# Git Branch with the results (e.g. 'cico-testing')results=[# Deploy file 'testresults.tap' into folder 'tap' (destination is optional)File("testresults.tap",destination="tap"),# Deploy file 'wrong_name.tap' as 'correct_name.tap' (rename is optional)File("wrong_name.txt",rename="correct_name.txt"),# Deploy directory 'covhtml' into folder 'coverage' (desitnation is optional)Directory("covhtml",destination="coverage"),# Create a Badge with the label "My Badge" and value "96" as mybadge.svg and mybadge.png# (png is optional) in the directory 'badges'Badge("badges/mybadge",png=True,label="My Badge",value=96,**anybadge_arguments),# https://github.com/jongracecox/anybadge]).commit(# commit message (optional)# {build} gets replaced by build number# {branch} gets replaced by name of tested branchmessage="build {build} on branch {branch}",# perform 'git push' even if not executed in CI environment (default=False)no_ci_push=True)
.travis.yml
带有after_script
部分
after_script:-python deploy.py
.travis.yml
带有deploy
部分
deploy:provider:scriptskip_cleanup:true# prevent TravisCI from cleaning up the files you want to deployscript:python deploy.py
存储库分支cico-testing
中的目录结构ci-results
+-- master
o-- correct_name.txt
+-- tap
| o-- testresults.tap
+-- covhtml
| +-- <all contents of covhtml in the tested branch>
+-- badges
o-- mybadge.svg
o-- mybadge.png