forked from equinor/ert
-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (34 loc) · 1.43 KB
/
annotate_python.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
name: Annotate Python
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
annotate-python-linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: -1
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install flake8
run: pip install flake8 flake8-bugbear flake8-simplify flake8-debugger flake8-pep3101
- name: install mypy
run: pip install -r types-requirements.txt
- name: install project
run: pip install .
- name: find changed files
id: find_changed_files
run: echo ::set-output name=changed_files::$(git diff --name-only ${{github.sha}} ${{github.event.pull_request.base.sha}} | tr ' ' '\n' | xargs ls -d 2>/dev/null | grep -E ".py$" | tr '\n' ' ')
- run: echo ::add-matcher::.github/flake8-matcher.json
- name: run flake8
run: flake8 --exit-zero ${{steps.find_changed_files.outputs.changed_files}}
if: steps.find_changed_files.outputs.changed_files != ''
- run: echo ::add-matcher::.github/mypy-matcher.json
- name: run mypy
run: mypy ${{steps.find_changed_files.outputs.changed_files}} --config-file .mypy-annotate.ini
if: steps.find_changed_files.outputs.changed_files != ''
continue-on-error: true