Skip to content

Commit

Permalink
Unify and simplify CI
Browse files Browse the repository at this point in the history
  • Loading branch information
penguinolog committed Feb 6, 2020
1 parent 69aa808 commit 8543212
Show file tree
Hide file tree
Showing 20 changed files with 88 additions and 198 deletions.
7 changes: 3 additions & 4 deletions .azure_pipelines/run_tests.yml
Expand Up @@ -26,7 +26,7 @@ jobs:

- script: |
python -m pip install --upgrade pip
pip install -U setuptools virtualenv
pip install -U setuptools virtualenv wheel
displayName: upgrade pip and setuptools
- script: |
Expand All @@ -44,9 +44,9 @@ jobs:
displayName: Build and install
- script: |
pip install asynctest mock pytest pytest-mock pytest-asyncio pytest-sugar pytest-cov
pip install asynctest mock pytest pytest-mock pytest-asyncio pytest-sugar pytest-cov coverage[toml]>=5.0
pytest --junitxml=unit_result.xml --cov=exec_helpers --cov-report=xml --cov-report=html --cov-report term test
pytest --junitxml=unit_result.xml --cov=exec_helpers --cov-report=xml --cov-report term
displayName: PyTest
- task: PublishTestResults@2
Expand All @@ -62,4 +62,3 @@ jobs:
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: ${{ format('$(System.DefaultWorkingDirectory)/coverage.xml') }}
reportDirectory: ${{ format('$(System.DefaultWorkingDirectory)/htmlcov') }}
38 changes: 0 additions & 38 deletions .coveragerc

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/pythonpackage.yml
Expand Up @@ -22,11 +22,11 @@ jobs:
run: |
python -m pip install --upgrade pip wheel
pip install -r CI_REQUIREMENTS.txt
pip install --upgrade asynctest mock pytest pytest-mock pytest-asyncio pytest-sugar pytest-cov
pip install --upgrade asynctest mock pytest pytest-mock pytest-asyncio pytest-sugar pytest-cov coverage[toml]>=5.0
- name: Build package and install develop
run: |
python setup.py develop -v
- name: Test with pytest
run: |
py.test --cov-config .coveragerc --cov-report= --cov=exec_helpers test
py.test --cov-report= --cov=exec_helpers test
coverage report -m --fail-under 85
11 changes: 11 additions & 0 deletions .pydocstyle.ini
@@ -0,0 +1,11 @@
[pydocstyle]
ignore =
D401,
# First line should be in imperative mood; try rephrasing
D202,
# No blank lines allowed after function docstring
D203,
# 1 blank line required before class docstring
D213
# Multi-line docstring summary should start at the second line
match = (?!_version|test_)*.py
32 changes: 16 additions & 16 deletions .travis.yml
@@ -1,11 +1,10 @@
language: python
os: linux
dist: xenial
sudo: true
dist: bionic

install:
- &upgrade_python_toolset pip install --upgrade pip setuptools wheel
- &install_test_deps pip install --upgrade asynctest mock pytest pytest-mock pytest-asyncio pytest-sugar
- &install_test_deps pip install --upgrade asynctest mock pytest pytest-mock pytest-asyncio pytest-sugar coverage[toml]>=5.0
- &install_deps pip install -r CI_REQUIREMENTS.txt
- pip install --upgrade pytest-cov coveralls

Expand All @@ -21,24 +20,19 @@ _python:
python: "3.8"

_helpers:
- &build_package python setup.py bdist_wheel
- &build_package python setup.py bdist_wheel clean

- &static_analysis
stage: Static analysis
<<: *python37
after_success: skip

- &code_style_check
stage: Code style check
<<: *python37
after_success: skip

script:
- python setup.py develop -v
- py.test --cov-config .coveragerc --cov=exec_helpers test

after_success:
- coveralls
- py.test --cov=exec_helpers

jobs:
include:
Expand All @@ -49,7 +43,7 @@ jobs:
- *install_deps
- pip install --upgrade "pylint >= 2.3" isort[pyproject,requirements]
script:
- python setup.py --version
- python setup.py --version clean
- pylint exec_helpers
- <<: *static_analysis
name: "Bandit"
Expand All @@ -65,7 +59,7 @@ jobs:
- *install_deps
- pip install --upgrade "mypy >= 0.720"
script:
- python setup.py --version
- python setup.py --version clean
- mypy --strict exec_helpers
- <<: *static_analysis
name: "PEP8"
Expand All @@ -92,10 +86,16 @@ jobs:

- stage: test
<<: *python36
after_success:
- coveralls
- stage: test
<<: *python37
after_success:
- coveralls
- stage: test
<<: *python38
after_success:
- coveralls

- stage: deploy
# This prevents job from appearing in test plan unless commit is tagged:
Expand All @@ -108,20 +108,20 @@ jobs:
install:
- *upgrade_python_toolset
- *install_deps
- pip install -U --upgrade-strategy=eager --no-cache-dir twine
before_deploy:
- *build_package
script: python setup.py bdist_wheel
- pip install -U wheel
script: *build_package
deploy:
- provider: pypi
# `skip_cleanup: true` is required to preserve binary wheels, built
# inside of manylinux1 docker container during `script` step above.
skip_cleanup: true
user: penguinolog
password:
secure: "maml4+SU/6NtRf7JIwWhVyXkesE9Gk5Umdo3txOjcrcvt84S3NlN/hFgdNclMUpJ3b+rOFEpiZOamtDKbP67uhlA6yJ364SxW5T3ZQJ8tjFFzMHcaM38HgGbgLR8AxK8fdZKRg9gVMnGofeiusB5aNsKmn9XnvESc8dNv0Umdmi83wXxm+DfVRXL8VTFgwsH3BxQy/Kdv6upRrXyNWkyoi8Zk8PkrFFDpFoW9WK1fRBqnvCw1Wt8nEAJah7y2b7vj52eM+MfT3IL+jpocZqOJQlFPdWkTonX7mAP9nB97kk4DMbm3ZqUw2Qr9pM0nKK9HhrXhsSSUGa1w95zmw9nbXLrpfnQ61Lyk9pGcVh60WbrVKstE/x9Lq3pqGsA/YKqsIZK3OAqRfBHNG9L7lekP05hXyDNHJXGoEyGQjVA/666S2ZCjM10XaaUmZ5P1kPGocCnEjv86dKdINTkFM6L0n4oIu1nyftBhVu9jz0xQaxute4LZNJiQtE6x8NX3WuSO68UhWjDqevYdRgW55Gp1OD4ilfA/SVNPpsHJfB2baue1fi9m8Rn3bWQSJoZ8twYHoIxEOAIXyMBhYnmldvsuUY6h5p+/hk6kpJAsTXZFjUSa/FPIH84QvDkNCoZxwInSkjEN1tj9PBep2vYcLMd92+g6udtin8FbYMZItiDl1M="
on:
tags: true
distributions: sdist bdist_wheel
distributions: sdist
skip_upload_docs: true
skip_existing: true

Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Expand Up @@ -47,7 +47,7 @@ jobs:
displayName: 'Install dependencies'
- script: |
python setup.py --version
python setup.py --version clean
displayName: 'Generate version file'
- script: |
Expand Down
2 changes: 1 addition & 1 deletion exec_helpers/_ssh_client_base.py
Expand Up @@ -36,7 +36,7 @@
import tenacity # type: ignore
import threaded

# Exec-Helpers Implementation
# Package Implementation
from exec_helpers import _log_templates
from exec_helpers import _ssh_helpers
from exec_helpers import api
Expand Down
2 changes: 1 addition & 1 deletion exec_helpers/api.py
Expand Up @@ -38,7 +38,7 @@
import threading
import typing

# Exec-Helpers Implementation
# Package Implementation
from exec_helpers import constants
from exec_helpers import exceptions
from exec_helpers import exec_result
Expand Down
2 changes: 1 addition & 1 deletion exec_helpers/async_api/api.py
Expand Up @@ -26,7 +26,7 @@
import pathlib
import typing

# Exec-Helpers Implementation
# Package Implementation
from exec_helpers import api
from exec_helpers import constants
from exec_helpers import exceptions
Expand Down
2 changes: 1 addition & 1 deletion exec_helpers/async_api/exec_result.py
Expand Up @@ -24,7 +24,7 @@
import logging
import typing

# Exec-Helpers Implementation
# Package Implementation
from exec_helpers import exec_result


Expand Down
2 changes: 1 addition & 1 deletion exec_helpers/async_api/subprocess_runner.py
Expand Up @@ -28,7 +28,7 @@
import os
import typing

# Exec-Helpers Implementation
# Package Implementation
from exec_helpers import _log_templates
from exec_helpers import _subprocess_helpers
from exec_helpers import constants
Expand Down
2 changes: 1 addition & 1 deletion exec_helpers/exceptions.py
Expand Up @@ -27,7 +27,7 @@
# Standard Library
import typing

# Exec-Helpers Implementation
# Package Implementation
from exec_helpers import _log_templates
from exec_helpers import proc_enums
from exec_helpers.proc_enums import ExitCodeT
Expand Down
2 changes: 1 addition & 1 deletion exec_helpers/exec_result.py
Expand Up @@ -26,7 +26,7 @@
import threading
import typing

# Exec-Helpers Implementation
# Package Implementation
from exec_helpers import exceptions
from exec_helpers import proc_enums
from exec_helpers.proc_enums import ExitCodeT
Expand Down
2 changes: 1 addition & 1 deletion exec_helpers/subprocess_runner.py
Expand Up @@ -31,7 +31,7 @@
# External Dependencies
import threaded

# Exec-Helpers Implementation
# Package Implementation
from exec_helpers import _log_templates
from exec_helpers import _subprocess_helpers
from exec_helpers import api
Expand Down
43 changes: 42 additions & 1 deletion pyproject.toml
Expand Up @@ -20,5 +20,46 @@ force_single_line = true

import_heading_stdlib = "Standard Library"
import_heading_thirdparty = "External Dependencies"
import_heading_firstparty = "Exec-Helpers Implementation"
import_heading_firstparty = "Package Implementation"
import_heading_localfolder = "Local Implementation"

[tool.coverage.run]
omit = ["test/*"]
branch = true

[tool.coverage.report]
exclude_lines = [
# Have to re-enable the standard pragma
"pragma: no cover",

# Don't complain about missing debug-only code:
"def __repr__",

# Don't complain if tests don't hit defensive assertion code:
"raise NotImplementedError",

# Exclude methods marked as abstract
"@abstractmethod",

# Exclude import statements
"^from\b",
"^import\b",

# Exclude variable declarations that are executed when file is loaded
"^[a-zA-Z_]+\b\\s=",

# Code for static analysis is never covered:
"if typing.TYPE_CHECKING:",

# Fallback code with no installed deps is almost impossible to cover properly
"except ImportError:",

# Don't complain if non-runnable code isn't run:
"if __name__ == .__main__.:",

# OS Specific
"if platform.system()",
]

[tool.coverage.json]
pretty_print = true
2 changes: 1 addition & 1 deletion pytest.ini
Expand Up @@ -2,4 +2,4 @@
addopts = -vvv -s -p no:django -p no:ipdb
testpaths = test
mock_use_standalone_module = false
junit_family=xunit2
junit_family = xunit2
17 changes: 0 additions & 17 deletions setup.cfg
@@ -1,5 +1,4 @@
[metadata]
name = exec-helpers
project_urls =
Bug Tracker = https://github.com/python-useful-helpers/exec-helpers/issues
Documentation = https://exec-helpers.readthedocs.io/
Expand Down Expand Up @@ -54,18 +53,6 @@ show-source = True
count = True
max-line-length = 120

[pydocstyle]
ignore =
D401,
# First line should be in imperative mood; try rephrasing
D202,
# No blank lines allowed after function docstring
D203,
# 1 blank line required before class docstring
D213
# Multi-line docstring summary should start at the second line
match = (?!_version|test_)*.py

[doc8]
max-line-length = 150

Expand All @@ -78,7 +65,3 @@ warn_redundant_casts = True
show_error_context = True
show_column_numbers = True
pretty = True

[mypy-ruamel.yaml.comments]
follow_imports = skip
ignore_errors = True

0 comments on commit 8543212

Please sign in to comment.