generated from TrisNol/sample-python-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (34 loc) · 1.28 KB
/
lint_test_python.yml
File metadata and controls
45 lines (34 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Lint and test Python
on: [pull_request, push]
jobs:
lint_python:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Python setup
uses: actions/setup-python@v2
- name: Install project dependencies
run: pip install -r requirements.txt
- name: Install testing/linting dependencies
run: pip install bandit flake8 pytest pyupgrade safety coverage
- name: Scan for security issues with Bandit
run: bandit --recursive --skip B101 . # B101 is assert statements
- name: Lint with Flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --show-source --statistics
- run: safety check --full-report --ignore=44715 --output safety-check.txt || true
- uses: actions/upload-artifact@v3
with:
name: safety-check-results
path: safety-check.txt
- name: Determine test coverage
run: |
coverage run -m pytest .
coverage report -m --fail-under=60
coverage html
- uses: actions/upload-artifact@v3
with:
name: test-coverage-results
path: htmlcov/