Skip to main content

deploy CI results to git

Project description

cico

Build Status PyPI License

deploy CI results to git

cico commits artefacts generated by a CI enviroinment to a Git results branch.

For each tested branch a directory in the results branch gets created.

  • tested branch: The branch you commited an is checked out by the CI tool
  • results branch: The branch where your results should be deployed
    • can be in a different repository than the tested branch

Installation

$ pip install cico

Usage

deploy.py

from cico import TravisCI
from cico.results import Directory, File, Badge

TravisCI(
    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 branch
    message="build {build} on branch {branch}",

    # perform 'git push' even if not executed in CI environment (default=False)
    no_ci_push=True
)

.travis.yml with after_script section

after_script:
  - python deploy.py

.travis.yml with deploy section

deploy:
  provider: script
  skip_cleanup: true  # prevent TravisCI from cleaning up the files you want to deploy
  script: python deploy.py

directory structure afterwards in branch cico-testing of the repository 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cico-0.1.8.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

cico-0.1.8-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file cico-0.1.8.tar.gz.

File metadata

  • Download URL: cico-0.1.8.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cico-0.1.8.tar.gz
Algorithm Hash digest
SHA256 600e9be449f405d788a232bc4f6699b841c4478e1dd75a5c16ebb0618a30c1d8
MD5 cae7f3e49e7306a37960cca532919ebc
BLAKE2b-256 62008b46b03b86fe4762fa7f9b2b813b6df80a6bc38484ddbf93ad6b51adc3ba

See more details on using hashes here.

File details

Details for the file cico-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for cico-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 4b1106175735feca1c21f6315089544a0f28438a9f79be64b233125a7cfda16b
MD5 75260e8227a96bb872530568f3ec41a4
BLAKE2b-256 ae840c52ba369babdb085ee003b5c817eecd5c5d7c5945aea692dea060146c3d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page