-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (47 loc) · 1.5 KB
/
automated_tests.yml
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
name: formatting_checks
on:
pull_request:
branches: ["master", "dev"]
push:
branches: ["master", "dev"]
jobs:
check_linting_and_formatting:
runs-on: macos-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files
id: changed-python-files
uses: tj-actions/changed-files@v41
with:
files: |
**.py
- name: Setup Python environment
if: steps.changed-python-files.outputs.any_changed == 'true'
uses: actions/setup-python@v3
- name: Installs
if: steps.changed-python-files.outputs.any_changed == 'true'
run: |
python -m pip install black flake8 isort
- name: Run Python formatting and linting
if: steps.changed-python-files.outputs.any_changed == 'true'
run: |
flake8 ${{ steps.changed-python-files.outputs.all_changed_files }} --extend-ignore=E203,W503 --max-line-length=120
black --check ${{ steps.changed-python-files.outputs.all_changed_files }}
isort --profile black ${{ steps.changed-python-files.outputs.all_changed_files }}
run_unit_tests:
runs-on: macos-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python environment
uses: actions/setup-python@v3
- name: Run Unit Tests
run: |
pip install -r requirements.txt
pip install pytest
pytest -rf tests/*