Skip to content

Commit

Permalink
Merge pull request #20 from cisagov/improvement/actions
Browse files Browse the repository at this point in the history
Switch CI from Travis to GitHub actions
  • Loading branch information
felddy authored Oct 18, 2019
2 parents 02c90d0 + 038a75a commit fae7694
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 33 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: build

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade -r requirements-test.txt
- name: Run pre-commit on all files
run: pre-commit run --all-files

- name: Test with pytest
run: pytest

- name: Coveralls
run: coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
if: success()
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repos:
args:
- --config=.mdl_config.json
- repo: https://github.com/adrienverge/yamllint
rev: v1.17.0
rev: v1.18.0
hooks:
- id: yamllint
- repo: https://github.com/detailyang/pre-commit-shell
Expand All @@ -43,7 +43,7 @@ repos:
additional_dependencies:
- flake8-docstrings
- repo: https://github.com/asottile/pyupgrade
rev: v1.23.0
rev: v1.25.0
hooks:
- id: pyupgrade
# Run bandit on "tests" tree with a configuration
Expand All @@ -57,7 +57,7 @@ repos:
- --config=.bandit.yml
# Run bandit everything but tests directory
- repo: https://github.com/PyCQA/bandit
rev: 2a1dbab
rev: 1.6.2
hooks:
- id: bandit
name: bandit (everything else)
Expand Down
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# skeleton-python-library #

[![Build Status](https://travis-ci.com/cisagov/skeleton-python-library.svg?branch=develop)](https://travis-ci.com/cisagov/skeleton-python-library)
[![GitHub Build Status](https://github.com/cisagov/skeleton-python-library/workflows/build/badge.svg)](https://github.com/cisagov/skeleton-python-library/actions)
[![Coverage Status](https://coveralls.io/repos/github/cisagov/skeleton-python-library/badge.svg?branch=develop)](https://coveralls.io/github/cisagov/skeleton-python-library?branch=develop)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/cisagov/skeleton-python-library.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/cisagov/skeleton-python-library/alerts/)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/cisagov/skeleton-python-library.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/cisagov/skeleton-python-library/context:python)
Expand All @@ -9,10 +9,10 @@
This is a generic skeleton project that can be used to quickly get a
new [cisagov](https://github.com/cisagov) Python library GitHub
project started. This skeleton project contains [licensing
information](LICENSE), as well as [pre-commit
hooks](https://pre-commit.com) and a [Travis
CI](https://travis-ci.com) configuration appropriate for a Python
library project.
information](LICENSE), as well as
[pre-commit hooks](https://pre-commit.com) and
[GitHub Actions](https://github.com/features/actions) configurations
appropriate for a Python library project.

## Contributing ##

Expand Down
10 changes: 9 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,15 @@ def package_vars(version_file):
py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")],
include_package_data=True,
install_requires=["docopt", "setuptools"],
extras_require={"test": ["pre-commit", "pytest", "pytest-cov", "coveralls"]},
extras_require={
"test": [
"pre-commit",
"pytest",
"pytest-cov",
"coveralls",
"virtualenv==16.3.0", # see: https://github.com/ansible/ansible-lint/issues/590
]
},
# Conveniently allows one to run the CLI tool as `example`
entry_points={"console_scripts": ["example = example.example:main"]},
)
8 changes: 4 additions & 4 deletions tests/test_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
)

# define sources of version strings
TRAVIS_TAG = os.getenv("TRAVIS_TAG")
RELEASE_TAG = os.getenv("RELEASE_TAG")
PROJECT_VERSION = example.__version__


Expand All @@ -44,13 +44,13 @@ def test_stdout_version(capsys):


@pytest.mark.skipif(
TRAVIS_TAG in [None, ""], reason="this is not a release (TRAVIS_TAG not set)"
RELEASE_TAG in [None, ""], reason="this is not a release (RELEASE_TAG not set)"
)
def test_release_version():
"""Verify that release tag version agrees with the module version."""
assert (
TRAVIS_TAG == f"v{PROJECT_VERSION}"
), "TRAVIS_TAG does not match the project version"
RELEASE_TAG == f"v{PROJECT_VERSION}"
), "RELEASE_TAG does not match the project version"


@pytest.mark.parametrize("level", log_levels)
Expand Down

0 comments on commit fae7694

Please sign in to comment.