-
Notifications
You must be signed in to change notification settings - Fork 2
63 lines (51 loc) · 1.67 KB
/
Copy pathtest.yml
File metadata and controls
63 lines (51 loc) · 1.67 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Test Code on PR
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
jobs:
test:
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.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Create reports folders
run: |
mkdir -p reports/coverage && mkdir -p reports/flake8 && mkdir -p reports/bandit && mkdir -p reports/mypy
- name: Lint with flake8
continue-on-error: true
run: |
flake8 . --count --select=E101,E111,E201,E202,E203,E231,E302,E731,E9,F401,F403,F405,F811,F7 --exit-zero --max-complexity=10 --max-line-length=100 --format=pylint --output-file=reports/flake8/report.txt
- name: Security analysis with bandit
continue-on-error: true
run: |
bandit -r . -c pyproject.toml -f json -o reports/bandit/report.json
- name: Type check with mypy
continue-on-error: true
run: |
mypy . --show-error-codes --no-error-summary >> reports/mypy/index.txt
- name: Run tests with pytest
env:
API_KEY: ${{ secrets.MBTA_API_KEY }}
run: |
pytest --cov-report=html:reports/coverage/
- name: Zip reports folder
run: |
zip -r reports.zip reports/
- name: Upload reports as artifact
uses: actions/upload-artifact@v4
with:
name: reports
path: reports.zip