Skip to content

Commit

Permalink
Use nox instead of make for building and testing project (#51)
Browse files Browse the repository at this point in the history
* Add now, remove make dependency

* zest.releaser is now on conda-forge

* Make pretty

* First pass at noxfile.py

* Add session for bmi-tester

* Add a build-docs session

* Break jobs into separate files

* Make pretty

* Be sure to install package

* Install pandoc separately through conda

It doesn't install correctly through pip (?)

* Use Action for black

* Use conda for all dependencies in workflow

* Force overwrite of api doc files

* Add prepare_docs session to update docs source before building

* Pass black arguments to format session

* Remove Makefile

* Include noxfile.py, drop Makefile
  • Loading branch information
mdpiper authored Jan 27, 2023
1 parent e4b13e3 commit e313b21
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 151 deletions.
54 changes: 7 additions & 47 deletions .github/workflows/build-test-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10']
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
Expand All @@ -36,61 +36,21 @@ jobs:
conda info
conda list
- name: Build and install package
run: make install
- name: Install package
run: pip install -e .

- name: Test
if: ${{ !(matrix.os == 'windows-latest' && matrix.python-version == '3.10') }}
env:
OPENTOPOGRAPHY_API_KEY: ${{ secrets.OPENTOPOGRAPHY_API_KEY }}
run: |
pytest --cov=bmi_topography --cov-report=xml:./coverage.xml --cov-config=./setup.cfg -vvv
- name: Test BMI
if: ${{ matrix.python-version == '3.9' }}
run: |
bmi-test bmi_topography:BmiTopography --config-file=./examples/config.yaml --root-dir=./examples -vvv
- name: Coveralls
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8'
uses: AndreMiras/coveralls-python-action@v20201129

lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Lint
run: |
pip install flake8
make lint
format:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: psf/black@stable
with:
options: "--check --verbose --diff"
src: "bmi_topography tests examples docs"

docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Build docs
run: |
pip install -r docs/source/requirements.txt
make install
cd docs && make html
27 changes: 27 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Documentation

on: [push, pull_request]

jobs:

build:
name: Build documentation
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
python-version: 3.11
auto-activate-base: false

- name: Install dependencies
run: pip install nox

- name: Build documentation
run: nox -s build-docs
27 changes: 27 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Format

on: [push, pull_request]

jobs:

format:
name: Check for lint and format code to a standard style
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
python-version: 3.11
auto-activate-base: false

- name: Install nox
run: pip install nox

- name: Format code
run: nox -s format -- --check --verbose --diff
6 changes: 4 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
include *.md
include *.cff
include environment.yml
include Makefile
include noxfile.py
include examples/*
recursive-include tests *
recursive-include docs *

exclude .readthedocs.yaml
recursive-exclude docs *
97 changes: 0 additions & 97 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion bmi_topography/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from ._version import __version__
from .bbox import BoundingBox
from .bmi import BmiTopography
from .topography import Topography
from ._version import __version__

__all__ = ["Topography", "BoundingBox", "BmiTopography", "__version__"]
7 changes: 3 additions & 4 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ dependencies:
- xarray
- rioxarray
- bmipy
- make
- black
- flake8
- isort >=5
- isort
- nox
- pytest
- pytest-cov
- pytest-datadir
Expand All @@ -28,5 +28,4 @@ dependencies:
- matplotlib
- build
- twine
- pip:
- zest.releaser
- zest.releaser
Loading

0 comments on commit e313b21

Please sign in to comment.