|
4 | 4 | pull_request:
|
5 | 5 | push:
|
6 | 6 | branches:
|
7 |
| - - 'master' |
8 |
| - - 'develop' |
| 7 | + - "master" |
| 8 | + - "develop" |
9 | 9 | schedule:
|
10 |
| - - cron: '0 0 * * *' |
| 10 | + - cron: "0 0 * * *" |
11 | 11 |
|
12 | 12 | env:
|
13 | 13 | # The only way to simulate if-else statement
|
14 | 14 | CHECKOUT_BRANCH: ${{ github.event_name == 'schedule' && 'develop' || github.ref }}
|
15 | 15 |
|
16 |
| - |
17 | 16 | jobs:
|
18 |
| - |
19 |
| - check-code-black-isort-flake8: |
| 17 | + check-pre-commit-hooks: |
20 | 18 | runs-on: ubuntu-latest
|
21 | 19 | steps:
|
22 | 20 | - name: Checkout branch
|
23 | 21 | uses: actions/checkout@v2
|
24 | 22 | with:
|
25 | 23 | ref: ${{ env.CHECKOUT_BRANCH }}
|
26 |
| - |
| 24 | + |
27 | 25 | - name: Setup Python
|
28 | 26 | uses: actions/setup-python@v2
|
29 | 27 | with:
|
30 | 28 | python-version: "3.8"
|
31 | 29 | architecture: x64
|
32 | 30 |
|
33 |
| - - name: Prepare linters |
34 |
| - run: pip install black[jupyter] isort flake8 nbqa |
| 31 | + - name: Prepare pre-commit validators |
| 32 | + run: | |
| 33 | + pip install pre-commit |
35 | 34 |
|
36 |
| - - name: Check code compliance with black |
37 |
| - run: black . --check --diff |
| 35 | + - name: Check code compliance with pre-commit validators |
| 36 | + run: pre-commit run --all-files |
38 | 37 |
|
39 |
| - - name: Check code compliance with isort |
40 |
| - run: | |
41 |
| - isort . --check --diff |
42 |
| - nbqa isort . --nbqa-diff |
| 38 | + check-code-pylint-and-mypy: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - name: Checkout branch |
| 42 | + uses: actions/checkout@v2 |
| 43 | + with: |
| 44 | + ref: ${{ env.CHECKOUT_BRANCH }} |
| 45 | + |
| 46 | + - name: Setup Python |
| 47 | + uses: actions/setup-python@v2 |
| 48 | + with: |
| 49 | + python-version: "3.8" |
| 50 | + architecture: x64 |
43 | 51 |
|
44 |
| - - name: Check code compliance with flake8 |
| 52 | + - name: Install packages |
45 | 53 | run: |
|
46 |
| - flake8 . |
47 |
| - nbqa flake8 . --nbqa-exclude=examples/core/CoreOverview.ipynb |
| 54 | + sudo apt-get update |
| 55 | + sudo apt-get install -y build-essential libgdal-dev graphviz proj-bin gcc libproj-dev libspatialindex-dev |
| 56 | + pip install -r requirements-dev.txt --upgrade |
| 57 | + python install_all.py -e |
| 58 | +
|
| 59 | + - name: Run pylint |
| 60 | + run: make pylint |
| 61 | + |
| 62 | + - name: Run mypy |
| 63 | + run: mypy core/eolearn/core |
48 | 64 |
|
49 | 65 | test-on-github:
|
50 | 66 | runs-on: ubuntu-latest
|
51 | 67 | strategy:
|
52 | 68 | matrix:
|
53 | 69 | python-version:
|
54 |
| - - '3.7' |
55 |
| - - '3.9' |
56 |
| - - '3.10' |
57 |
| - include: |
| 70 | + - "3.7" |
| 71 | + - "3.9" |
| 72 | + - "3.10" |
| 73 | + include: |
58 | 74 | # A flag marks whether full or partial tests should be run
|
59 | 75 | # We don't run integration tests on pull requests from outside repos, because they don't have secrets
|
60 |
| - - python-version: '3.8' |
| 76 | + - python-version: "3.8" |
61 | 77 | full_test_suite: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
|
62 | 78 | steps:
|
63 | 79 | - name: Checkout branch
|
@@ -86,10 +102,9 @@ jobs:
|
86 | 102 | --sh_client_secret "${{ secrets.SH_CLIENT_SECRET }}"
|
87 | 103 | pytest --cov --cov-report=term --cov-report=xml
|
88 | 104 |
|
89 |
| - - name: Run pylint and reduced tests |
| 105 | + - name: Run reduced tests |
90 | 106 | if: ${{ !matrix.full_test_suite }}
|
91 | 107 | run: |
|
92 |
| - make pylint |
93 | 108 | pytest -m "not sh_integration"
|
94 | 109 |
|
95 | 110 | - name: Upload code coverage
|
|
0 commit comments