Skip to content

Commit e313b21

Browse files
authored
Use nox instead of make for building and testing project (#51)
* 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
1 parent e4b13e3 commit e313b21

File tree

10 files changed

+220
-151
lines changed

10 files changed

+220
-151
lines changed

Diff for: .github/workflows/build-test-ci.yml

+7-47
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
matrix:
1919
os: [ubuntu-latest, macos-latest, windows-latest]
20-
python-version: ['3.8', '3.9', '3.10']
20+
python-version: ["3.8", "3.9", "3.10"]
2121

2222
steps:
2323
- uses: actions/checkout@v2
@@ -36,61 +36,21 @@ jobs:
3636
conda info
3737
conda list
3838
39-
- name: Build and install package
40-
run: make install
39+
- name: Install package
40+
run: pip install -e .
4141

4242
- name: Test
4343
if: ${{ !(matrix.os == 'windows-latest' && matrix.python-version == '3.10') }}
4444
env:
4545
OPENTOPOGRAPHY_API_KEY: ${{ secrets.OPENTOPOGRAPHY_API_KEY }}
4646
run: |
4747
pytest --cov=bmi_topography --cov-report=xml:./coverage.xml --cov-config=./setup.cfg -vvv
48+
49+
- name: Test BMI
50+
if: ${{ matrix.python-version == '3.9' }}
51+
run: |
4852
bmi-test bmi_topography:BmiTopography --config-file=./examples/config.yaml --root-dir=./examples -vvv
4953
5054
- name: Coveralls
5155
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8'
5256
uses: AndreMiras/coveralls-python-action@v20201129
53-
54-
lint:
55-
runs-on: ubuntu-latest
56-
57-
steps:
58-
- uses: actions/checkout@v2
59-
60-
- name: Set up Python 3.8
61-
uses: actions/setup-python@v2
62-
with:
63-
python-version: 3.8
64-
65-
- name: Lint
66-
run: |
67-
pip install flake8
68-
make lint
69-
70-
format:
71-
runs-on: ubuntu-latest
72-
73-
steps:
74-
- uses: actions/checkout@v2
75-
- uses: actions/setup-python@v2
76-
- uses: psf/black@stable
77-
with:
78-
options: "--check --verbose --diff"
79-
src: "bmi_topography tests examples docs"
80-
81-
docs:
82-
runs-on: ubuntu-latest
83-
84-
steps:
85-
- uses: actions/checkout@v2
86-
87-
- name: Set up Python 3.8
88-
uses: actions/setup-python@v2
89-
with:
90-
python-version: 3.8
91-
92-
- name: Build docs
93-
run: |
94-
pip install -r docs/source/requirements.txt
95-
make install
96-
cd docs && make html

Diff for: .github/workflows/docs.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Documentation
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
7+
build:
8+
name: Build documentation
9+
if:
10+
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
11+
github.repository
12+
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- uses: conda-incubator/setup-miniconda@v2
18+
with:
19+
miniforge-version: latest
20+
python-version: 3.11
21+
auto-activate-base: false
22+
23+
- name: Install dependencies
24+
run: pip install nox
25+
26+
- name: Build documentation
27+
run: nox -s build-docs

Diff for: .github/workflows/format.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Format
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
7+
format:
8+
name: Check for lint and format code to a standard style
9+
if:
10+
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
11+
github.repository
12+
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- uses: conda-incubator/setup-miniconda@v2
18+
with:
19+
miniforge-version: latest
20+
python-version: 3.11
21+
auto-activate-base: false
22+
23+
- name: Install nox
24+
run: pip install nox
25+
26+
- name: Format code
27+
run: nox -s format -- --check --verbose --diff

Diff for: MANIFEST.in

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
include *.md
22
include *.cff
33
include environment.yml
4-
include Makefile
4+
include noxfile.py
55
include examples/*
66
recursive-include tests *
7-
recursive-include docs *
7+
8+
exclude .readthedocs.yaml
9+
recursive-exclude docs *

Diff for: Makefile

-97
This file was deleted.

Diff for: bmi_topography/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
from ._version import __version__
12
from .bbox import BoundingBox
23
from .bmi import BmiTopography
34
from .topography import Topography
4-
from ._version import __version__
55

66
__all__ = ["Topography", "BoundingBox", "BmiTopography", "__version__"]

Diff for: environment.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ dependencies:
1212
- xarray
1313
- rioxarray
1414
- bmipy
15-
- make
1615
- black
1716
- flake8
18-
- isort >=5
17+
- isort
18+
- nox
1919
- pytest
2020
- pytest-cov
2121
- pytest-datadir
@@ -28,5 +28,4 @@ dependencies:
2828
- matplotlib
2929
- build
3030
- twine
31-
- pip:
32-
- zest.releaser
31+
- zest.releaser

0 commit comments

Comments
 (0)