Skip to content

Commit

Permalink
Add GitHub Action for tests & coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
deanishe committed May 20, 2020
1 parent 0659f0b commit 1d907de
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 37 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "build"

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
run:
name: "tests & coverage"
runs-on: macos-latest
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 2.7

- name: Install test dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-test.txt
- name: Lint
run: ./run-tests.sh -l

- name: Unit tests
run: ./run-tests.sh

- name: Install coverage dependencies
run: pip install -r requirements-ci.txt

- name: Codacy
run: python-codacy-coverage -r coverage.xml -c ${{ github.sha }} || exit 0

- name: Coveralls
run: coveralls || exit 0

- name: Codecov
run: bash <(curl -s https://codecov.io/bash) || exit 0
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ install:
- git clone https://github.com/MacPython/terryfy
- source terryfy/travis_tools.sh
- get_python_environment $SOURCE $VERSION venv
- bin/travis-install-deps.sh
- pip install -r requirements-test.txt
- pip install -r requirements-ci.txt

script:
- ./run-tests.sh
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ Alfred-Workflow

A helper library in Python for authors of workflows for [Alfred 3 and 4][alfred].

[![Build Status][shield-travis]][travis] [![Coverage Status][shield-coveralls]][coveralls] [![Latest Version][shield-version]][pypi] [![Development Status][shield-status]][pypi] [![Supported Python Versions][shield-pyversions]][pypi]
<!-- [![Build Status][shield-travis]][travis] -->
[![Build Status][shield-github]][action-github]
[![Coverage Status][shield-coveralls]][coveralls]
[![Development Status][shield-status]][pypi]
[![Latest Version][shield-version]][pypi]
[![Supported Python Versions][shield-pyversions]][pypi]

<!-- [![Downloads][shield-download]][pypi] -->

Expand Down Expand Up @@ -335,6 +340,8 @@ Workflows using Alfred-Workflow
[shield-coveralls]: https://coveralls.io/repos/github/deanishe/alfred-workflow/badge.svg?branch=master
[shield-docs]: https://readthedocs.org/projects/alfredworkflow/badge/?version=latest&style=flat
[shield-download]: https://img.shields.io/pypi/dm/Alfred-Workflow.svg?style=flat
[shield-github]: https://github.com/deanishe/alfred-workflow/workflows/build/badge.svg
[action-github]: https://github.com/deanishe/alfred-workflow/actions?query=workflow%3Abuild
[shield-health]: https://landscape.io/github/deanishe/alfred-workflow/master/landscape.png?style=flat
[shield-licence]: https://pypip.in/license/Alfred-Workflow/badge.svg?style=flat
[shield-status]: https://img.shields.io/pypi/status/Alfred-Workflow.svg?style=flat
Expand Down
27 changes: 0 additions & 27 deletions bin/travis-install-deps.sh

This file was deleted.

2 changes: 2 additions & 0 deletions requirements-ci.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
codacy-coverage==1.3.11
coveralls==1.11.1
14 changes: 7 additions & 7 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pyobjc-framework-Cocoa==5.2
pytest==4.4.1
pytest-cov==2.7.1
pyobjc-framework-Cocoa==5.3
pytest==4.6.10
pytest-cov==2.8.1
pytest-httpbin==1.0.0
pytest-localserver==0.5.0
tox==3.9.0
twine==1.13.0
flake8==3.7.7
flake8-docstrings==1.3.0
# tox==3.15.1
# twine==1.15.0
flake8==3.8.1
flake8-docstrings==1.5.0
2 changes: 1 addition & 1 deletion tests/test_util_lockfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_concurrent_access(paths):
assert not os.path.exists(paths.lockfile)

with open(paths.testfile) as fp:
lines = [l.strip() for l in fp.readlines()]
lines = [line.strip() for line in fp.readlines()]

for line in lines:
assert len(set(line)) == 1
Expand Down

0 comments on commit 1d907de

Please sign in to comment.