Skip to content

Commit

Permalink
Enforce code style using black and isort (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
samwedge committed Jan 15, 2021
1 parent 8b644b0 commit 71b7bdc
Show file tree
Hide file tree
Showing 14 changed files with 373 additions and 144 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test

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

jobs:

lint:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Run type checking using Mypy
run: poetry run mypy rapiduino
- name: Run linting using Flake8
run: poetry run flake8 rapiduino
- name: Check code formatting using Black
run: poetry run black --check --diff --color rapiduino
- name: Check code formatting using isort
run: poetry run isort --check --diff --color rapiduino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Test
name: Test

on:
push:
Expand All @@ -8,8 +8,8 @@ on:

jobs:

build-and-test:
name: Test and lint
test:
name: Test against Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -26,29 +26,14 @@ jobs:
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Run tests
- name: Generate test coverage report
run: poetry run coverage run --source=rapiduino -m pytest tests
- name: Run tests and publish coverage
run: poetry run pytest tests
- name: Submit test coverage report
if: matrix.python-version == '3.9'
uses: AndreMiras/coveralls-python-action@develop
- name: Run type checking
run: poetry run mypy rapiduino
- name: Run linting
run: poetry run flake8 rapiduino

submit-coverage:
name: Submit test coverage
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Generate test coverage report
run: poetry run coverage run --source=rapiduino -m pytest tests
- name: Submit test coverage report
uses: AndreMiras/coveralls-python-action@develop
2 changes: 2 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[settings]
profile = black
Loading

0 comments on commit 71b7bdc

Please sign in to comment.