From 57683517731a4125dd1de0a1b3dde6d3449a4e3e Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 15 Mar 2020 23:19:26 +0100 Subject: [PATCH] add testing and coverage --- .drone.jsonnet | 45 +++++++++++++++++++++++++++++++++++++++++- .drone.yml | 42 +++++++++++++++++++++++++++++++++++++-- README.md | 1 + docs/content/_index.md | 1 + 4 files changed, 86 insertions(+), 3 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index f6fbe3a..e095c67 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -72,6 +72,48 @@ local PipelineDeps = { }; local PipelineTest = { + kind: 'pipeline', + name: 'test', + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + { + name: 'pytest', + image: 'python:3.8', + environment: { + PY_COLORS: 1, + }, + commands: [ + 'pip install pipenv -qq', + 'pipenv --bare install --dev --keep-outdated', + 'pipenv run pytest dockertidy/tests/ --cov=dockertidy/ --no-cov-on-fail', + ], + }, + { + name: 'codecov', + image: 'python:3.8', + environment: { + PY_COLORS: 1, + CODECOV_TOKEN: { from_secret: 'codecov_token' }, + }, + commands: [ + 'pip install codecov', + 'coverage combine .tox/py*/.coverage', + 'codecov --required', + ], + }, + ], + depends_on: [ + 'dependencies', + ], + trigger: { + ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'], + }, +}; + +local PipelineVerify = { kind: 'pipeline', name: 'verify', platform: { @@ -85,7 +127,7 @@ local PipelineTest = { PythonVersion(pyversion='3.8'), ], depends_on: [ - 'dependencies', + 'test', ], trigger: { ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'], @@ -368,6 +410,7 @@ local PipelineNotifications = { PipelineLint, PipelineDeps, PipelineTest, + PipelineVerify, PipelineSecurity, PipelineBuildPackage, PipelineBuildContainer(arch='amd64'), diff --git a/.drone.yml b/.drone.yml index f24a48e..47d8781 100644 --- a/.drone.yml +++ b/.drone.yml @@ -51,6 +51,44 @@ trigger: depends_on: - lint +--- +kind: pipeline +name: test + +platform: + os: linux + arch: amd64 + +steps: +- name: pytest + image: python:3.8 + commands: + - pip install pipenv -qq + - pipenv --bare install --dev --keep-outdated + - pipenv run pytest dockertidy/tests/ --cov=dockertidy/ --no-cov-on-fail + environment: + PY_COLORS: 1 + +- name: codecov + image: python:3.8 + commands: + - pip install codecov + - coverage combine .tox/py*/.coverage + - codecov --required + environment: + CODECOV_TOKEN: + from_secret: codecov_token + PY_COLORS: 1 + +trigger: + ref: + - refs/heads/master + - refs/tags/** + - refs/pull/** + +depends_on: +- dependencies + --- kind: pipeline name: verify @@ -111,7 +149,7 @@ trigger: - refs/pull/** depends_on: -- dependencies +- test --- kind: pipeline @@ -491,6 +529,6 @@ depends_on: --- kind: signature -hmac: 7434a5205208c8f283d2985ede241d81c2fdd629f19032f550d5173449b0c74f +hmac: 5fd3ca3dfa6f98b965f927a5b3ac5e9f59d0f871fe97d018bea4ccdcd059923b ... diff --git a/README.md b/README.md index f5d1a80..a45693b 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ [![Python Version](https://img.shields.io/pypi/pyversions/docker-tidy.svg)](https://pypi.org/project/docker-tidy/) [![PyPi Status](https://img.shields.io/pypi/status/docker-tidy.svg)](https://pypi.org/project/docker-tidy/) [![PyPi Release](https://img.shields.io/pypi/v/docker-tidy.svg)](https://pypi.org/project/docker-tidy/) +[![Codecov](https://img.shields.io/codecov/c/github/xoxys/docker-tidy)](https://codecov.io/gh/xoxys/docker-tidy) [![License: MIT](https://img.shields.io/github/license/xoxys/docker-tidy)](LICENSE) This project is a fork of [Yelp/docker-custodian](https://github.com/Yelp/docker-custodian). Keep docker hosts tidy. diff --git a/docs/content/_index.md b/docs/content/_index.md index 77ec135..27477dd 100644 --- a/docs/content/_index.md +++ b/docs/content/_index.md @@ -7,6 +7,7 @@ title: Documentation [![Python Version](https://img.shields.io/pypi/pyversions/docker-tidy.svg)](https://pypi.org/project/docker-tidy/) [![PyPi Status](https://img.shields.io/pypi/status/docker-tidy.svg)](https://pypi.org/project/docker-tidy/) [![PyPi Release](https://img.shields.io/pypi/v/docker-tidy.svg)](https://pypi.org/project/docker-tidy/) +[![Codecov](https://img.shields.io/codecov/c/github/xoxys/docker-tidy)](https://codecov.io/gh/xoxys/docker-tidy) [![License: MIT](https://img.shields.io/github/license/xoxys/docker-tidy)](LICENSE) This project is a fork of [Yelp/docker-custodian](https://github.com/Yelp/docker-custodian). Keep docker hosts tidy.