Skip to content

Commit

Permalink
Enable codecov (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Jan 27, 2022
1 parent b21692e commit da3a275
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 7 deletions.
33 changes: 27 additions & 6 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,21 @@ on:

jobs:
build:
name: ${{ matrix.name }}
name: ${{ matrix.name || matrix.tox_env }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
python-version:
- 3.9
tox_env:
- lint
- packaging
cover:
- false
include:
- os: ubuntu-latest
python-version: 3.9
tox_env: lint
name: lint
- os: ubuntu-latest
python-version: 3.9
tox_env: packaging
Expand All @@ -34,26 +39,32 @@ jobs:
python-version: 3.6
tox_env: py36
name: py36
cover: true
- os: ubuntu-latest
python-version: 3.7
tox_env: py37
name: py37
cover: true
- os: ubuntu-latest
python-version: 3.8
tox_env: py38
name: py38
cover: true
- os: ubuntu-latest
python-version: 3.9
tox_env: py39
name: py39
cover: true
- os: macOS-latest
python-version: 3.6
tox_env: py36
name: py36-macos
cover: true
- os: macOS-latest
python-version: 3.9
tox_env: py39
name: py39-macos
cover: true

steps:
- uses: actions/checkout@v2
Expand All @@ -64,8 +75,18 @@ jobs:
- name: Install dependencies
run: |
python -m pip install -U pip
pip install tox
pip install tox coverage
- name: Run tox -e ${{ matrix.tox_env }}
run: |
echo "${{ matrix.PREFIX }} tox -e ${{ matrix.tox_env }}"
${{ matrix.PREFIX }} tox -e ${{ matrix.tox_env }}
- name: Upload coverage data
uses: codecov/codecov-action@v2
with:
directory: .tox
files: 'coverage-*.xml'
name: ${{ matrix.tox_env }}
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
if: ${{ matrix.cover }}
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
---
ci:
autoupdate_commit_msg: "chore: pre-commit autoupdate"
autoupdate_schedule: monthly
autofix_commit_msg: |
chore: auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
skip:
# https://github.com/pre-commit-ci/issues/issues/55
- codecov
repos:
- repo: local
hooks:
- id: codecov
name: Check codecov.yml
# https://superuser.com/a/1587813/3004
entry: >
bash -c '[ $(
curl --silent -o /dev/stderr -w "%{http_code}" -X POST --data-binary @codecov.yml https://codecov.io/validate
) -eq 200 ]'
language: system
files: "codecov.yml"
pass_filenames: false
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
Expand Down
11 changes: 11 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
codecov:
notify:
wait_for_ci: true
require_ci_to_pass: true
comment: false
coverage:
status:
patch: false
project:
default:
threshold: 0.5%
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ setenv =
PYTHONWARNINGS=error::FutureWarning
# Aim to replace with below once other issues are fixed:
# PYTHONWARNINGS=error
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
deps =
mock
pytest
pytest-cov
sitepackages = False
commands = python -m pytest -ra --cov=ansi2html --no-cov-on-fail --cov-append
commands = python -m pytest -ra --cov=ansi2html --no-cov-on-fail --cov-append --cov-report=xml:{toxworkdir}/coverage-{envname}.xml

[testenv:lint]
description = Runs all linting tasks
Expand Down

0 comments on commit da3a275

Please sign in to comment.