Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c96376

Browse files
authored
add linters (#5)
* add linters * add linter badge
1 parent 7342788 commit 2c96376

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.github/workflows/linters.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Linters
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'docs/**'
7+
branches:
8+
- master
9+
- develop
10+
pull_request:
11+
paths-ignore:
12+
- 'docs/**'
13+
branches:
14+
- '**'
15+
16+
jobs:
17+
test:
18+
runs-on: ubuntu-latest
19+
steps:
20+
#----------------------------------------------
21+
# check-out repo and set-up python
22+
#----------------------------------------------
23+
- name: Check out repository
24+
uses: actions/checkout@v2
25+
- name: Set up python
26+
uses: actions/setup-python@v2
27+
with:
28+
python-version: 3.9
29+
#----------------------------------------------
30+
# ----- install & configure poetry -----
31+
#----------------------------------------------
32+
- name: Install Poetry
33+
uses: snok/[email protected]
34+
with:
35+
virtualenvs-create: true
36+
virtualenvs-in-project: true
37+
#----------------------------------------------
38+
# load cached venv if cache exists
39+
#----------------------------------------------
40+
- name: Load cached venv
41+
id: cached-poetry-dependencies
42+
uses: actions/cache@v2
43+
with:
44+
path: .venv
45+
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
46+
#----------------------------------------------
47+
# install dependencies if cache does not exist
48+
#----------------------------------------------
49+
- name: Install dependencies
50+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
51+
run: poetry install --no-interaction --no-root
52+
#----------------------------------------------
53+
# install your root project, if required
54+
#----------------------------------------------
55+
- name: Install library
56+
run: poetry install --no-interaction
57+
#----------------------------------------------
58+
# run linters suite
59+
#----------------------------------------------
60+
- name: Run linters
61+
run: |
62+
source .venv/bin/activate
63+
flake8 --max-line-length=88 app/
64+
black --skip-string-normalization app

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
[![Tests](https://github.com/agrojas/python-rest-api-example/actions/workflows/test.yml/badge.svg)](https://github.com/agrojas/python-rest-api-example/actions/workflows/test.yml)
66

7+
[![Linters](https://github.com/agrojas/python-rest-api-example/actions/workflows/linters.yml/badge.svg)](https://github.com/agrojas/python-rest-api-example/actions/workflows/linters.yml)
78

89
### pre-commit
910

0 commit comments

Comments
 (0)