Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 20 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ jobs:
matrix:
include:
# test latest gcc and python
- {os: ubuntu-latest, FC: gcc, FC_V: 13}
- {os: macos-latest, FC: gcc, FC_V: 13}
- {os: windows-latest, FC: gcc, FC_V: 13}
- {os: ubuntu-latest, FC: gcc, FC_V: 13, shell: bash}
- {os: macos-latest, FC: gcc, FC_V: 13, shell: bash}
- {os: windows-latest, FC: gcc, FC_V: 13, shell: pwsh}
# test latest python and intel-classic
- {os: ubuntu-latest, FC: intel-classic, FC_V: 2021.7}
- {os: macos-13, FC: intel-classic, FC_V: 2021.7}
- {os: windows-2019, FC: intel-classic, FC_V: 2021.7}
- {os: ubuntu-latest, FC: intel-classic, FC_V: 2021.7, shell: bash}
- {os: macos-13, FC: intel-classic, FC_V: 2021.7, shell: bash}
- {os: windows-2019, FC: intel-classic, FC_V: 2021.7, shell: pwsh}
# test latest python and previous gcc
- {os: ubuntu-latest, FC: gcc, FC_V: 12}
- {os: ubuntu-latest, FC: gcc, FC_V: 11}
- {os: ubuntu-latest, FC: gcc, FC_V: 12, shell: bash}
- {os: ubuntu-latest, FC: gcc, FC_V: 11, shell: bash}
defaults:
run:
shell: bash
shell: ${{ matrix.shell }}

steps:
- name: Checkout repo
Expand All @@ -57,7 +57,7 @@ jobs:
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: v0.19.1
pixi-version: v0.34.0
manifest-path: "pixi.toml"

- name: pixi post-install
Expand Down Expand Up @@ -91,7 +91,6 @@ jobs:

- name: test on Windows
if: runner.os == 'Windows'
shell: pwsh
run: |
pixi run autotest-base

Expand Down Expand Up @@ -122,16 +121,16 @@ jobs:
matrix:
include:
# test latest gcc and python
- {os: ubuntu-latest, FC: gcc, FC_V: 13}
- {os: macos-latest, FC: gcc, FC_V: 13}
- {os: windows-latest, FC: gcc, FC_V: 13}
- {os: ubuntu-latest, FC: gcc, FC_V: 13, shell: bash}
- {os: macos-latest, FC: gcc, FC_V: 13, shell: bash}
- {os: windows-latest, FC: gcc, FC_V: 13, shell: pwsh}
# test latest python and intel
- {os: ubuntu-latest, FC: intel-classic, FC_V: 2021.7}
- {os: macos-13, FC: intel-classic, FC_V: 2021.7}
- {os: windows-2019, FC: intel-classic, FC_V: 2021.7}
- {os: ubuntu-latest, FC: intel-classic, FC_V: 2021.7, shell: bash}
- {os: macos-13, FC: intel-classic, FC_V: 2021.7, shell: bash}
- {os: windows-2019, FC: intel-classic, FC_V: 2021.7, shell: pwsh}
defaults:
run:
shell: bash
shell: ${{ matrix.shell }}

steps:
- name: Checkout repo
Expand All @@ -149,7 +148,7 @@ jobs:
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: v0.19.1
pixi-version: v0.34.0
manifest-path: "pixi.toml"

- name: pixi post-install
Expand All @@ -170,13 +169,13 @@ jobs:
- name: Run scheduled tests
run: |
pixi run autotest-schedule

- name: Upload failed test output
if: failure()
uses: actions/upload-artifact@v4
with:
name: failed-schedule-${{ matrix.os }}-${{ matrix.FC }}-${{ matrix.FC_V }}
path: ./autotest/.failed
path: autotest/.failed

- name: Print coverage report before upload
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pymake-linting-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: v0.19.1
pixi-version: v0.34.0
manifest-path: "pixi.toml"

- name: Lint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pymake-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: v0.19.1
pixi-version: v0.34.0
manifest-path: "pixi.toml"

- name: pixi post-install
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ jobs:
pip install ".[test]"

- name: Download artifacts
uses: dawidd6/action-download-artifact@v6
uses: dawidd6/action-download-artifact@v7

- name: Draft release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
version=$(cat version.txt)
title="pymake $version"
notes=$(cat code.md)
notes=$(cat code.md/code.md)
gh release create "$version" \
--target master \
--title "$title" \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Python package for building MODFLOW-based programs from source files.

### Version 1.2.10
### Version 1.3.0

[![PyPI Version](https://img.shields.io/pypi/v/mfpymake.png)](https://pypi.python.org/pypi/mfpymake)
[![Anaconda Version](https://anaconda.org/conda-forge/mfpymake/badges/version.svg)](https://anaconda.org/conda-forge/mfpymake)
Expand Down
7 changes: 3 additions & 4 deletions autotest/ci_setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import os
import pathlib as pl
import shutil
from pathlib import Path

from modflow_devtools.misc import get_model_paths

import pymake

temp_pth = pl.Path("temp")
if not temp_pth.exists():
temp_pth.mkdir()
temp_pth = Path("temp")
temp_pth.mkdir(exist_ok=True)
mf6_exdir = temp_pth / "mf6examples"
if mf6_exdir.is_dir():
shutil.rmtree(mf6_exdir)
Expand Down
16 changes: 2 additions & 14 deletions autotest/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,7 @@ def test_build(function_tmpdir, target: str) -> None:
pm.inplace = True
fc = os.environ.get("FC", "gfortran")
assert (
pymake.build_apps(
target,
pm,
verbose=True,
clean=False,
)
== 0
pymake.build_apps(target, pm, verbose=True, clean=False) == 0
), f"could not compile {target}"


Expand All @@ -80,13 +74,7 @@ def test_meson_build(function_tmpdir, target: str) -> None:
pymake.linker_update_environment(cc=cc, fc=fc)
with set_dir(function_tmpdir):
assert (
pymake.build_apps(
target,
verbose=True,
clean=False,
meson=True,
)
== 0
pymake.build_apps(target, verbose=True, clean=False, meson=True) == 0
), f"could not compile {target}"


Expand Down
42 changes: 12 additions & 30 deletions autotest/test_cli_cmds.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os
import pathlib as pl
import subprocess
from pathlib import Path
from platform import system
from textwrap import dedent

import pytest
from flaky import flaky
Expand Down Expand Up @@ -47,13 +48,7 @@ def run_cli_cmd(cmd: list) -> None:
@pytest.mark.parametrize("target", targets)
def test_make_program(function_tmpdir, target: str) -> None:
with set_dir(function_tmpdir):
cmd = [
"make-program",
target,
"--appdir",
str(function_tmpdir),
"--verbose",
]
cmd = ["make-program", target, "--appdir", ".", "--verbose"]
run_cli_cmd(cmd)


Expand All @@ -62,28 +57,15 @@ def test_make_program(function_tmpdir, target: str) -> None:
@pytest.mark.base
def test_make_program_double(function_tmpdir) -> None:
with set_dir(function_tmpdir):
cmd = [
"make-program",
"mf2005",
"--double",
"--verbose",
"--appdir",
str(function_tmpdir),
]
cmd = ["make-program", "mf2005", "--double", "--verbose", "--appdir", "."]
run_cli_cmd(cmd)


@pytest.mark.dependency(name="make_program_all")
@pytest.mark.schedule
def test_make_program_all(module_tmpdir) -> None:
with set_dir(module_tmpdir):
cmd = [
"make-program",
":",
"--appdir",
str(module_tmpdir / "all"),
"--verbose",
]
cmd = ["make-program", ":", "--appdir", ".", "--verbose"]
run_cli_cmd(cmd)


Expand All @@ -93,13 +75,13 @@ def test_make_program_all(module_tmpdir) -> None:
@pytest.mark.parametrize("meson", meson_parm)
def test_mfpymake(function_tmpdir, meson: bool) -> None:
with set_dir(function_tmpdir):
src = (
"program hello\n"
+ " ! This is a comment line; it is ignored by the compiler\n"
+ " print *, 'Hello, World!'\n"
+ "end program hello\n"
)
src_file = pl.Path("src/hello.f90")
src = dedent("""\
program hello
! This is a comment line; it is ignored by the compiler
print *, 'Hello, World!'
end program hello
""")
src_file = Path("src/hello.f90")
src_file.parent.mkdir(parents=True, exist_ok=True)
with open(src_file, "w") as f:
f.write(src)
Expand Down
12 changes: 4 additions & 8 deletions autotest/test_gridgen.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pathlib as pl
import subprocess
from os import environ
from pathlib import Path
from platform import system

import pytest
Expand All @@ -11,7 +11,7 @@


@pytest.fixture(scope="module")
def target(module_tmpdir) -> pl.Path:
def target(module_tmpdir) -> Path:
name = TARGET_NAME
ext = ".exe" if system() == "Windows" else ""
return module_tmpdir / f"{name}{ext}"
Expand All @@ -23,7 +23,7 @@ def prog_data(target) -> dict:


@pytest.fixture(scope="module")
def workspace(module_tmpdir, prog_data) -> pl.Path:
def workspace(module_tmpdir, prog_data) -> Path:
return module_tmpdir / prog_data.dirname


Expand All @@ -42,11 +42,7 @@ def pm(module_tmpdir, target) -> pymake.Pymake:

def run_command(args, cwd):
p = subprocess.Popen(
args,
shell=False,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
cwd=cwd,
args, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=cwd
)
for line in p.stdout.readlines():
print(line.decode().strip())
Expand Down
4 changes: 1 addition & 3 deletions autotest/test_mf2005.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,5 @@ def test_mf2005(namefile, workspace, target):
if not (example_ws / namefile).is_file():
pytest.skip(f"{namefile} does not exist")

success, _ = flopy.run_model(
target, namefile, model_ws=example_ws, silent=False
)
success, _ = flopy.run_model(target, namefile, model_ws=example_ws, silent=False)
assert success, f"could not run {namefile} with {target}"
14 changes: 4 additions & 10 deletions autotest/test_mf6_existing_meson.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,10 @@ def test_build_with_existing_meson(pm, module_tmpdir, workspace, targets):
linker_update_environment(cc=cc, fc=fc)

# make modflow 6 with existing meson.build file
returncode = pymake.meson_build(
workspace,
fc,
cc,
appdir=pm.appdir,
)
assert returncode == 0, (
"could not build modflow 6 applications "
+ "using existing meson.build file"
)
returncode = pymake.meson_build(workspace, fc, cc, appdir=pm.appdir)
assert (
returncode == 0
), "could not build modflow 6 applications using existing meson.build file"

# check that all of the executables exist
for executable in targets:
Expand Down
20 changes: 4 additions & 16 deletions autotest/test_mp6.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,12 @@ def update_files(fn, workspace):
if rf in fn.lower():
fname1 = workspace / f"{rf}.locations"
fname2 = workspace / f"{rf}_mod.locations"
print(
"copy {} to {}".format(
os.path.basename(fname1), os.path.basename(fname2)
)
)
print(f"copy {os.path.basename(fname1)} to {os.path.basename(fname2)}")
shutil.copy(fname1, fname2)
print(f"deleting {os.path.basename(fname1)}")
os.remove(fname1)
fname1 = workspace / f"{rf.upper()}.locations"
print(
"renmae {} to {}".format(
os.path.basename(fname2), os.path.basename(fname1)
)
)
print(f"renmae {os.path.basename(fname2)} to {os.path.basename(fname1)}")
os.rename(fname2, fname1)


Expand All @@ -79,16 +71,12 @@ def test_compile(pm, target):
@pytest.mark.dependency(name="test", depends=["build"])
@pytest.mark.xdist_group(TARGET_NAME)
@pytest.mark.regression
@pytest.mark.parametrize(
"namefile", [f"EXAMPLE-{n}.mpsim" for n in range(1, 10)]
)
@pytest.mark.parametrize("namefile", [f"EXAMPLE-{n}.mpsim" for n in range(1, 10)])
def test_mp6(namefile, workspace, target):
example_ws = workspace / "example-run"
if not (example_ws / namefile).is_file():
pytest.skip(f"Namefile {namefile} does not exist")

update_files(namefile, example_ws)
success, _ = flopy.run_model(
target, namefile, model_ws=example_ws, silent=False
)
success, _ = flopy.run_model(target, namefile, model_ws=example_ws, silent=False)
assert success, f"could not run {namefile}"
Loading