Skip to content

Commit

Permalink
CI: Use uv
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtoews committed Feb 4, 2025
1 parent 0d795cb commit 3da35d8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 28 deletions.
35 changes: 9 additions & 26 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Tests

on:
on:
schedule:
- cron: '42 8 2-30/2 * *' # At 08:42 UTC on every 2nd day-of-month
push:
pull_request:
workflow_dispatch:

jobs:
tests:
Expand All @@ -20,13 +21,10 @@ jobs:
- uses: actions/checkout@v4

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}

- name: Update pip
run: python -m pip install --upgrade pip

- name: Install MinGW-w64 tools (Windows)
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
Expand All @@ -44,25 +42,10 @@ jobs:
uses: fortran-lang/setup-fortran@v1
with:
compiler: gcc
version: 11

- name: Install build dependencies (macOS)
if: runner.os == 'macOS'
run: |
pip install meson ninja pandas numpy matplotlib pyemu flopy jupyter notebook nbconvert
- name: Install build dependencies (macOS)
if: runner.os == 'Windows'
run: |
pip install meson ninja pandas numpy matplotlib pyemu flopy jupyter notebook nbconvert
version: 13

- name: Install build dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y gfortran
pip install meson ninja pandas numpy matplotlib pyemu flopy jupyter notebook nbconvert
- name: Install build requirements
run: uv pip install meson ninja

- name: Build pestutils (Windows)
if: runner.os == 'Windows'
Expand All @@ -75,10 +58,10 @@ jobs:
if: runner.os != 'Windows'
run: bash scripts/build_lib.sh

- name: Install package
run: pip install .[test,optional]
- name: Install package and all extras
run: uv sync --all-extras

- name: Run tests
run: pytest -v
run: uv run pytest -v
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencies = [
[project.optional-dependencies]
optional = [
"flopy",
"jupyter",
"pyemu",
]
test = [
Expand Down
8 changes: 6 additions & 2 deletions tests/test_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
from pathlib import Path
from subprocess import run

import nbformat
import pytest

try:
import nbformat
except ImportError:
pytest.skip("requires nbformat", allow_module_level=True)

examples_dir = Path(__file__).parent.parent / "examples"


Expand All @@ -15,7 +19,7 @@ def test_notebooks(nb_file):
nb = nbformat.read(f, as_version=4)
for cell in nb["cells"]:
for line in cell["source"].splitlines():
if line.startswith("import "):
if line.startswith("import ") and "ppu_helpers" not in line:
module = line.split()[1]
pytest.importorskip(module)

Expand Down

0 comments on commit 3da35d8

Please sign in to comment.