1
1
name : build
2
2
3
3
on :
4
+ pull_request :
4
5
push :
6
+ branches :
7
+ - " master"
8
+ - " develop"
5
9
schedule :
6
- - cron : ' 0 0 * * *'
10
+ - cron : " 0 0 * * *"
7
11
8
12
env :
9
13
# The only way to simulate if-else statement
10
- CHECKOUT_BRANCH : ${{ github.event_name == 'push ' && github.ref || 'develop' }}
14
+ CHECKOUT_BRANCH : ${{ github.event_name == 'schedule ' && 'develop' || github.ref }}
11
15
12
16
jobs :
13
-
14
- check-code-black-isort-flake8 :
17
+ check-pre-commit-hooks :
15
18
runs-on : ubuntu-latest
16
19
steps :
17
20
- name : Checkout branch
@@ -25,21 +28,13 @@ jobs:
25
28
python-version : " 3.8"
26
29
architecture : x64
27
30
28
- - name : Prepare linters
29
- run : pip install black[jupyter] isort flake8 nbqa
30
-
31
- - name : Check code compliance with black
32
- run : black . --check --diff
33
-
34
- - name : Check code compliance with isort
31
+ - name : Prepare pre-commit validators
35
32
run : |
36
- isort . --check --diff
37
- nbqa isort . --nbqa-diff
33
+ pip install pre-commit
34
+ pre-commit install
38
35
39
- - name : Check code compliance with flake8
40
- run : |
41
- flake8 .
42
- nbqa flake8 .
36
+ - name : Check code compliance with pre-commit validators
37
+ run : pre-commit run --all-files
43
38
44
39
check-code-pylint-and-mypy :
45
40
runs-on : ubuntu-latest
@@ -54,10 +49,10 @@ jobs:
54
49
with :
55
50
python-version : " 3.8"
56
51
architecture : x64
57
-
52
+
58
53
- name : Install packages
59
54
run : pip install -e .[AWS,DEV]
60
-
55
+
61
56
- name : Run mypy
62
57
run : mypy sentinelhub setup.py
63
58
@@ -69,10 +64,14 @@ jobs:
69
64
strategy :
70
65
matrix :
71
66
python-version :
72
- - ' 3.7'
73
- - ' 3.8'
74
- - ' 3.9'
75
- - ' 3.10'
67
+ - " 3.7"
68
+ - " 3.9"
69
+ - " 3.10"
70
+ include :
71
+ # A flag marks whether full or partial tests should be run
72
+ # We don't run integration tests on pull requests from outside repos, because they don't have secrets
73
+ - python-version : " 3.8"
74
+ full_test_suite : ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
76
75
steps :
77
76
- name : Checkout branch
78
77
uses : actions/checkout@v2
92
91
pip install -e .[AWS,DEV]
93
92
94
93
- name : Run full tests and code coverage
95
- if : matrix.python-version == '3.8'
94
+ if : ${{ matrix.full_test_suite }}
96
95
run : |
97
96
sentinelhub.config \
98
97
--sh_client_id "${{ secrets.SH_CLIENT_ID }}" \
@@ -103,12 +102,12 @@ jobs:
103
102
pytest --cov --cov-report=term --cov-report=xml
104
103
105
104
- name : Run pylint and reduced tests
106
- if : matrix.python-version != '3.8'
105
+ if : ${{ !matrix.full_test_suite }}
107
106
run : |
108
107
pytest -m "not sh_integration and not aws_integration"
109
108
110
109
- name : Upload code coverage
111
- if : matrix.python-version == '3.8'
110
+ if : ${{ matrix.full_test_suite }}
112
111
uses : codecov/codecov-action@v2
113
112
with :
114
113
files : coverage.xml
0 commit comments