Skip to content

chore: Fail build if code coverage is too low #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ batch:
buildspec: codebuild/python3.7.yml
- identifier: python3_8
buildspec: codebuild/python3.8.yml

- identifier: code_coverage
buildspec: codebuild/coverage/coverage.yml
14 changes: 14 additions & 0 deletions codebuild/coverage/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 0.2

env:
variables:
TOXENV: "coverage"

phases:
install:
runtime-versions:
python: latest
build:
commands:
- pip install tox
- tox
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ branch = True

[coverage:report]
show_missing = True
fail_under = 90

[mypy]
ignore_missing_imports = True
Expand Down
10 changes: 9 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ envlist =
# test-release :: Builds dist files and uploads to testpypi pypirc profile.
# release :: Builds dist files and uploads to pypi pypirc profile.

# Reporting environments:
#
# coverage :: Runs code coverage, failing the build if coverage is below the configured threshold

[testenv:base-command]
commands = pytest --basetemp={envtmpdir} -l --cov dynamodb_encryption_sdk {posargs}
commands = pytest --basetemp={envtmpdir} -l {posargs}

[testenv]
passenv =
Expand Down Expand Up @@ -86,6 +90,10 @@ commands =
# Only run examples tests
examples: {[testenv:base-command]commands} examples/test/ -m "examples"

# Run code coverage on the unit tests
[testenv:coverage]
commands = {[testenv:base-command]commands} --cov dynamodb_encryption_sdk test/ -m "local and not slow and not veryslow and not nope"

# Verify that local tests work without environment variables present
[testenv:nocmk]
basepython = python3
Expand Down