-
Notifications
You must be signed in to change notification settings - Fork 7
167 lines (143 loc) · 4.65 KB
/
ci.yml
File metadata and controls
167 lines (143 loc) · 4.65 KB
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
name: CI
on:
push:
paths-ignore:
- '**.md'
- '.github/workflows/release.yml'
- '.gitignore'
pull_request:
branches:
- main
- develop
paths-ignore:
- '**.md'
- '.github/workflows/release.yml'
- '.gitignore'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
cache-dependency-glob: "**/pyproject.toml"
- name: Install
run: uv sync --group lint
- name: Lint
run: uvx ruff check
- name: Format
run: uvx ruff format --check
- name: Spelling
run: uvx codespell
- name: Typing
run: uv run mypy modflow_devtools
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
cache-dependency-glob: "**/pyproject.toml"
- name: Install project
run: uv sync --group build
- name: Print package version
run: uv run python -c "import modflow_devtools; print(modflow_devtools.__version__)"
- name: Build package
run: uv build
- name: Check distribution
run: uvx twine check --strict dist/*
test:
name: Test
needs:
- build
- lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, macos-14, windows-2022 ]
python: [ "3.10", "3.11", "3.12", "3.13" ]
env:
GCC_V: 11
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
path: modflow-devtools
- name: Checkout modflow6 for DFN autodiscovery
uses: actions/checkout@v4
with:
repository: MODFLOW-ORG/modflow6
path: modflow6
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
cache-dependency-glob: "**/pyproject.toml"
python-version: ${{ matrix.python }}
- name: Setup Fortran
if: runner.os != 'Windows'
uses: fortran-lang/setup-fortran@v1
with:
compiler: gcc
version: ${{ env.GCC_V }}
- name: Setup Fortran (Windows)
if: runner.os == 'Windows'
uses: fortran-lang/setup-fortran@v1
with:
compiler: intel
version: 2025.2
- name: Install project
working-directory: modflow-devtools
run: uv sync --all-extras
- name: Run local tests
working-directory: modflow-devtools/autotest
env:
REPOS_PATH: ${{ github.workspace }}
MODFLOW_DEVTOOLS_AUTO_SYNC: 0
TEST_DFN_PATH: ${{ github.workspace }}/modflow6/doc/mf6io/mf6ivar/dfn
# use --dist loadfile to so tests requiring pytest-virtualenv run on the same worker
run: uv run pytest -v -n auto --dist loadfile --durations 0 --ignore test_download.py --ignore test_models.py --ignore test_dfns_registry.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.10'
working-directory: modflow-devtools/autotest
env:
REPOS_PATH: ${{ github.workspace }}
GITHUB_TOKEN: ${{ github.token }}
# TODO: switch to upstream when dfn registry file added
TEST_DFNS_REPO: wpbonelli/modflow6
TEST_DFNS_REF: registry
TEST_DFNS_SOURCE: modflow6
# Models API
TEST_MODELS_REPO: MODFLOW-ORG/modflow6-testmodels
TEST_MODELS_REF: develop
TEST_MODELS_SOURCE: modflow6-testmodels
TEST_MODELS_SOURCE_NAME: mf6/test
# Programs API
TEST_PROGRAMS_REPO: MODFLOW-ORG/modflow6
TEST_PROGRAMS_REF: develop
TEST_PROGRAMS_SOURCE: modflow6
run: uv run pytest -v -n auto --dist loadgroup --durations 0 test_download.py test_models.py test_dfns_registry.py
rtd:
name: Docs
needs: test
runs-on: ubuntu-22.04
if: github.repository_owner == 'MODFLOW-ORG' && github.event_name == 'push'
steps:
- name: Trigger RTD
uses: dfm/rtds-action@v1
with:
webhook_url: ${{ secrets.RTDS_WEBHOOK_URL }}
webhook_token: ${{ secrets.RTDS_WEBHOOK_TOKEN }}
commit_ref: ${{ github.ref }}