Skip to content

Commit

Permalink
test harness additions
Browse files Browse the repository at this point in the history
- update build badge on README.rst
- update to tox.ini
- update to workflow
- update .isort.cfg
  • Loading branch information
emmanvg committed Jan 14, 2021
1 parent ff6d682 commit 56ce56e
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 35 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/python-ci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: cti-pattern-validator test harness
on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]

name: Python ${{ matrix.python-version }} Build
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install and update essential dependencies
run: |
pip install -U pip setuptools
pip install tox-gh-actions
pip install codecov
- name: Test with Tox
run: |
tox
- name: Upload coverage information to Codecov
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
1 change: 1 addition & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ known_third_party =
typing,
known_first_party = stix2patterns
force_sort_within_sections = 1
line_length = 160
19 changes: 14 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
sha: ea227f024bd89d638aea319c92806737e3375979
rev: v3.4.0
hooks:
- id: trailing-whitespace
exclude: grammars
- id: check-merge-conflict
- repo: https://github.com/PyCQA/flake8
rev: 3.8.4
hooks:
- id: flake8
name: Check project styling
exclude: grammars
args:
- --ignore=F403,F405
- --max-line-length=160
- id: check-merge-conflict
- repo: https://github.com/FalconSocial/pre-commit-python-sorter
sha: b57843b0b874df1d16eb0bef00b868792cb245c2
- repo: https://github.com/PyCQA/isort
rev: 5.7.0
hooks:
- id: python-import-sorter
- id: isort
name: Sort python imports (shows diff)
args: ["-c", "--diff"]
- id: isort
name: Sort python imports (fixes files)
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ possible or appropriate, questions may be directed by email to the Maintainer(s)
Open Repository participation to OASIS Staff at [email protected]
and any specific CLA-related questions to [email protected].

.. |Build_Status| image:: https://api.travis-ci.org/oasis-open/cti-pattern-validator.svg?branch=master
:target: https://travis-ci.org/oasis-open/cti-pattern-validator
.. |Build_Status| image:: https://github.com/oasis-open/cti-pattern-validator/workflows/cti-pattern-validator%20test%20harness/badge.svg
:target: https://github.com/oasis-open/cti-pattern-validator/actions?query=workflow%3A%22cti-pattern-validator+test+harness%22
.. |Coverage| image:: https://codecov.io/gh/oasis-open/cti-pattern-validator/branch/master/graph/badge.svg
:target: https://codecov.io/gh/oasis-open/cti-pattern-validator
.. |Version| image:: https://img.shields.io/pypi/v/stix2-patterns.svg?maxAge=3600
Expand Down
39 changes: 11 additions & 28 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27,py34,py35,py36,py37,py38,pycodestyle,isort-check,packaging
envlist = py36,py37,py38,py39,packaging,pre-commit-check

[testenv]
deps =
Expand All @@ -9,41 +9,24 @@ commands =
check-manifest
pytest --cov=stix2patterns stix2patterns/test/ --cov-report term-missing

passenv = CI TRAVIS TRAVIS_*

[testenv:pycodestyle]
deps =
flake8
commands =
flake8 ./stix2patterns

[testenv:isort-check]
deps = isort
commands =
isort stix2patterns --df
isort stix2patterns -c

[pycodestyle]
max-line-length=160
exclude=grammars

[flake8]
ignore=F403,F405
max-line-length=160
exclude=grammars
passenv = GITHUB_*

[testenv:packaging]
deps =
twine
commands =
python setup.py bdist_wheel --universal
python setup.py sdist bdist_wheel --universal
twine check dist/*

[testenv:pre-commit-check]
deps =
pre-commit
commands =
pre-commit run --all-files

[travis]
python =
2.7: py27, pycodestyle
3.4: py34
3.5: py35
3.6: py36, pycodestyle, isort-check, packaging
3.6: py36
3.7: py37
3.8: py38
3.9: py39, packaging, pre-commit-check

0 comments on commit 56ce56e

Please sign in to comment.