-
Notifications
You must be signed in to change notification settings - Fork 5
177 lines (148 loc) · 4.95 KB
/
ci.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: CI
on:
push:
paths-ignore:
- '**.md'
pull_request:
branches:
- main
- develop
paths-ignore:
- '**.md'
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: 'pip'
cache-dependency-path: pyproject.toml
- name: Install Python packages
run: |
pip install .
pip install ".[lint]"
- name: Run isort
run: isort --verbose --check --diff modflow_devtools
- name: Run black
run: black --check --diff modflow_devtools
- name: Run flake8
run: flake8 --count --show-source --exit-zero modflow_devtools
- name: Run pylint
run: pylint --jobs=0 --errors-only --exit-zero modflow_devtools
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install Python packages
run: |
pip install --upgrade pip
pip install build twine
pip --verbose install .
- name: Print package version
run: python -c "import modflow_devtools; print(modflow_devtools.__version__)"
- name: Build package
run: python -m build
- name: Check distribution
run: twine check --strict dist/*
test:
name: Test
needs:
- build
- lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, macos-12, windows-2022 ]
python: [ 3.8, 3.9, "3.10", "3.11" ]
env:
GCC_V: 11
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
path: modflow-devtools
- name: Checkout modflow6
uses: actions/checkout@v3
with:
repository: MODFLOW-USGS/modflow6
path: modflow6
- name: Checkout modflow6 examples
uses: actions/checkout@v3
with:
repository: MODFLOW-USGS/modflow6-examples
path: modflow6-examples
- name: Checkout modflow6 test models
uses: actions/checkout@v3
with:
repository: MODFLOW-USGS/modflow6-testmodels
path: modflow6-testmodels
- name: Checkout modflow6 large test models
uses: actions/checkout@v3
with:
repository: MODFLOW-USGS/modflow6-largetestmodels
path: modflow6-largetestmodels
token: ${{ github.token }}
- name: Install executables
uses: modflowpy/install-modflow-action@v1
- name: Setup GNU Fortran ${{ env.GCC_V }}
uses: awvwgk/setup-fortran@main
with:
compiler: gcc
version: ${{ env.GCC_V }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: |
modflow-devtools/pyproject.toml
modflow6-examples/etc/requirements*.txt
- name: Install Python packages
working-directory: modflow-devtools
run: |
pip install .
pip install ".[test]"
- name: Cache modflow6 examples
id: cache-examples
uses: actions/cache@v3
with:
path: modflow6-examples/examples
key: modflow6-examples-${{ hashFiles('modflow6-examples/data/**') }}
- name: Install extra Python packages
if: steps.cache-examples.outputs.cache-hit != 'true'
working-directory: modflow6-examples/etc
run: |
pip install -r requirements.pip.txt
pip install -r requirements.usgs.txt
- name: Build modflow6 example models
if: steps.cache-examples.outputs.cache-hit != 'true'
working-directory: modflow6-examples/etc
run: python ci_build_files.py
- name: Run local tests
working-directory: modflow-devtools/autotest
env:
REPOS_PATH: ${{ github.workspace }}
# use --dist loadfile to so tests requiring pytest-virtualenv run on the same worker
run: pytest -v -n auto --dist loadfile --durations 0 --ignore modflow_devtools/test/test_download.py
- name: Run network-dependent tests
# only invoke the GH API on one OS and Python version
# to avoid rate limits (1000 rqs / hour / repository)
# https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#usage-limits
if: runner.os == 'Linux' && matrix.python == '3.8'
working-directory: modflow-devtools/autotest
env:
REPOS_PATH: ${{ github.workspace }}
GITHUB_TOKEN: ${{ github.token }}
run: pytest -v -n auto --durations 0 modflow_devtools/test/test_download.py