Skip to content

Commit 90bd97c

Browse files
authored
Replacing TravisCI with GitHub Action (#5)
* Adding GitHub Action First attempt at using GitHub Actions instead of Travis. * Limiting black to py37 Limiting black to py37 Only running coveralls if tests pass. * Setting COVERALLS_REPO_TOKEN as Github secret * Replacing Travis with Github Actions Also - Only calling coveralls under py37 * Fixing flake8
1 parent add17c1 commit 90bd97c

3 files changed

Lines changed: 52 additions & 36 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Python package
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
max-parallel: 4
11+
matrix:
12+
python-version: [2.7, 3.5, 3.6, 3.7]
13+
14+
steps:
15+
- uses: actions/checkout@v1
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v1
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -e .
24+
- name: Lint with flake8
25+
run: |
26+
pip install flake8
27+
# stop the build if there are Python syntax errors or undefined names
28+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
29+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
30+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
31+
- name: Check syntax with Python Black on py37
32+
if: matrix.python-version == '3.7'
33+
run: |
34+
pip install black
35+
black --check flagpole
36+
black --check tests
37+
- name: Test with pytest/coverage
38+
run: |
39+
pip install pytest coveralls
40+
coverage run -a -m py.test tests/test_flags.py
41+
coverage run -a -m py.test tests/test_registry.py
42+
- name: Upload coverage data under py37
43+
env:
44+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
45+
if: success() && matrix.python-version == '3.7'
46+
run: |
47+
coveralls

.travis.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

flagpole/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ def _calculate_dependency_flag(self, method, calculated=None):
106106
"""
107107
Given a method that may or may not contain dependencies, create a binary flag
108108
which represents all dependent methods.
109-
109+
110110
As dependencies may be multiple levels deep, we use a recursive approach.
111-
111+
112112
Note: Will raise an Exception if a dependency cycle is detected.
113-
113+
114114
:param method: Starting point for calculating dependency flag
115115
:param calculated: set of methods this function has been called with. Used to detect dependency cycles.
116116
:return dependencies: binary flag (int) created by binary-ORing each dependency in the chain.
@@ -132,9 +132,9 @@ def _calculate_dependency_flag(self, method, calculated=None):
132132

133133
def _find_methods_matching_flag(self, flag):
134134
"""
135-
Given a flag, iterates over the method registry and returns a list of
135+
Given a flag, iterates over the method registry and returns a list of
136136
all methods which match the flag.
137-
137+
138138
:param flag: flag to match against
139139
:return results: list of matching methods.
140140
"""

0 commit comments

Comments
 (0)