-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (52 loc) · 1.82 KB
/
code_validations.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
58
59
60
name: Code Validations
on: [pull_request]
jobs:
check-for-python-changes:
runs-on: ubuntu-latest
outputs:
run-python-validations: ${{ steps.changes.outputs.run-python-validations }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get changed files
id: changes
run: |
echo "::set-output name=run-python-validations::$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep .py$ | xargs)"
run-checks:
runs-on: ubuntu-latest
needs: check-for-python-changes
if: ${{needs.check-for-python-changes.outputs.run-python-validations}}
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8.12
uses: actions/setup-python@v2
with:
python-version: 3.8.12
- uses: actions/cache@v3
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.cfg') }}--${{ hashFiles('tests/requirements.txt') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -r tests/requirements.txt
- name: Make sure black formatter results in no diff
run: |
black $(git ls-files '*.py') --check
- name: Make sure isort formatter results in no diff
run: |
isort $(git ls-files '*.py') --check
- name: Analyzing the code with pylint
run: |
pylint openlayer tests
- name: Analyzing the code with flake8
run: |
flake8 openlayer tests
# Currently always succeeds because unit tests need to be fixed
- name: Running Pytest
run: |
pytest