1+ name : CI
2+ on :
3+ push :
4+ branches :
5+ - main
6+ - develop*
7+ paths-ignore :
8+ - ' **.md'
9+ pull_request :
10+ branches :
11+ - main
12+ - develop*
13+ paths-ignore :
14+ - ' **.md'
15+ jobs :
16+ lint :
17+ name : Lint
18+ runs-on : ubuntu-latest
19+ steps :
20+
21+ - name : Checkout repo
22+ uses : actions/checkout@v3
23+
24+ - name : Setup Python
25+ uses : actions/setup-python@v4
26+ with :
27+ python-version : 3.7
28+ cache : ' pip'
29+ cache-dependency-path : setup.cfg
30+
31+ - name : Install Python packages
32+ run : |
33+ pip install .
34+ pip install ".[lint]"
35+
36+ - name : Run isort
37+ run : isort --verbose --check --diff modflow_devtools
38+
39+ - name : Run black
40+ run : black --check --diff modflow_devtools
41+
42+ - name : Run flake8
43+ run : flake8 --count --show-source --exit-zero modflow_devtools
44+
45+ - name : Run pylint
46+ run : pylint --jobs=0 --errors-only --exit-zero modflow_devtools
47+
48+ build :
49+ name : Build
50+ runs-on : ubuntu-latest
51+ steps :
52+
53+ - name : Checkout repo
54+ uses : actions/checkout@v3
55+
56+ - name : Setup Python
57+ uses : actions/setup-python@v4
58+ with :
59+ python-version : 3.7
60+
61+ - name : Upgrade pip and install build and twine
62+ run : |
63+ pip install --upgrade pip
64+ pip install build twine
65+
66+ - name : Base modflow_devtools installation
67+ run : |
68+ pip --verbose install .
69+
70+ - name : Print package version
71+ run : |
72+ python -c "import modflow_devtools; print(modflow_devtools.__version__)"
73+
74+ - name : Build package
75+ run : |
76+ python -m build
77+
78+ - name : Check distribution
79+ run : |
80+ twine check --strict dist/*
81+
82+ test :
83+ name : Test
84+ needs :
85+ - build
86+ - lint
87+ runs-on : ${{ matrix.os }}
88+ strategy :
89+ fail-fast : false
90+ matrix :
91+ os : [ ubuntu-22.04, macos-12, windows-2022 ]
92+ python : [ 3.7, 3.8, 3.9, "3.10" ]
93+ env :
94+ GCC_V : 11
95+ steps :
96+
97+ - name : Checkout repo
98+ uses : actions/checkout@v3
99+ with :
100+ path : modflow-devtools
101+
102+ - name : Checkout modflow6
103+ uses : actions/checkout@v3
104+ with :
105+ repository : MODFLOW-USGS/modflow6
106+ path : modflow6
107+
108+ - name : Checkout modflow6 examples
109+ uses : actions/checkout@v3
110+ with :
111+ repository : MODFLOW-USGS/modflow6-examples
112+ path : modflow6-examples
113+
114+ - name : Checkout modflow6 test models
115+ uses : actions/checkout@v3
116+ with :
117+ repository : MODFLOW-USGS/modflow6-testmodels
118+ path : modflow6-testmodels
119+
120+ - name : Checkout modflow6 large test models
121+ uses : actions/checkout@v3
122+ with :
123+ repository : MODFLOW-USGS/modflow6-largetestmodels
124+ path : modflow6-largetestmodels
125+
126+ - name : Install executables
127+ uses : modflowpy/install-modflow-action@v1
128+
129+ - name : Setup GNU Fortran ${{ env.GCC_V }}
130+ uses : awvwgk/setup-fortran@main
131+ with :
132+ compiler : gcc
133+ version : ${{ env.GCC_V }}
134+
135+ - name : Setup Python
136+ uses : actions/setup-python@v4
137+ with :
138+ python-version : ${{ matrix.python }}
139+ cache : ' pip'
140+ cache-dependency-path : |
141+ modflow-devtools/setup.cfg
142+ modflow6-examples/etc/requirements*.txt
143+
144+ - name : Install Python packages
145+ working-directory : modflow-devtools
146+ run : |
147+ pip install .
148+ pip install ".[test]"
149+
150+ - name : Cache modflow6 examples
151+ id : cache-examples
152+ uses : actions/cache@v3
153+ with :
154+ path : modflow6-examples/examples
155+ key : modflow6-examples-${{ hashFiles('modflow6-examples/data/**') }}
156+
157+ - name : Install extra Python packages
158+ # can't build examples on Python 3.7, requires Python 3.8
159+ if : steps.cache-examples.outputs.cache-hit != 'true' && matrix.python != '3.7'
160+ working-directory : modflow6-examples/etc
161+ run : |
162+ pip install -r requirements.pip.txt
163+ pip install -r requirements.usgs.txt
164+
165+ - name : Build modflow6 example models
166+ # can't build examples on Python 3.7, requires Python 3.8
167+ if : steps.cache-examples.outputs.cache-hit != 'true' && matrix.python != '3.7'
168+ working-directory : modflow6-examples/etc
169+ run : python ci_build_files.py
170+
171+ - name : Run tests
172+ working-directory : modflow-devtools
173+ env :
174+ BIN_PATH : ~/.local/bin/modflow
175+ REPOS_PATH : ${{ github.workspace }}
176+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
177+ run : pytest -v -n auto --durations 0
0 commit comments