mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-12-22 10:40:44 -06:00
chore: start using nox
This commit is contained in:
parent
e26922b808
commit
044a22901b
2 changed files with 50 additions and 14 deletions
19
Makefile
19
Makefile
|
@ -1,12 +1,6 @@
|
||||||
VERSION ?= $(shell git describe --tags --always --dirty=-dev | sed 's/^v//g')
|
VERSION ?= $(shell git describe --tags --always --dirty=-dev | sed 's/^v//g')
|
||||||
PREFIX ?= ~/bin
|
PREFIX ?= ~/bin
|
||||||
|
|
||||||
lint: ## run pre-commit hooks
|
|
||||||
pdm run pre-commit run --all || pdm run pre-commit run --all
|
|
||||||
|
|
||||||
types: ## run mypy
|
|
||||||
pdm run mypy src/viv
|
|
||||||
|
|
||||||
bump: ## update version and tag commit
|
bump: ## update version and tag commit
|
||||||
@echo "bumping to version => $(VERSION)"
|
@echo "bumping to version => $(VERSION)"
|
||||||
@sed -i 's/__version__ = ".*"/__version__ = "$(VERSION)"/g' src/viv/viv.py
|
@sed -i 's/__version__ = ".*"/__version__ = "$(VERSION)"/g' src/viv/viv.py
|
||||||
|
@ -25,18 +19,15 @@ assets/viv-help.svg:
|
||||||
dev-install:
|
dev-install:
|
||||||
ln -sf $(PWD)/src/viv/viv.py ~/.local/share/viv/viv.py
|
ln -sf $(PWD)/src/viv/viv.py ~/.local/share/viv/viv.py
|
||||||
|
|
||||||
docs: docs/index.md docs/viv.py ## build docs
|
## docs |> update docs files
|
||||||
pdm run mkdocs build
|
docs: docs/viv.py docs/index.md
|
||||||
|
|
||||||
svgs: ## build svgs for docs
|
|
||||||
pdm run python ./scripts/generate-svgs.py
|
|
||||||
|
|
||||||
docs/viv.py: src/viv/viv.py
|
docs/viv.py: src/viv/viv.py
|
||||||
cp $< $@
|
@cp $< $@
|
||||||
|
|
||||||
docs/index.md: README.md
|
docs/index.md: README.md
|
||||||
printf -- '---\nhide: [navigation]\n---\n\n' > $@
|
@printf -- '---\nhide: [navigation]\n---\n\n' > $@
|
||||||
cat $< >> $@
|
@cat $< >> $@
|
||||||
|
|
||||||
examples/black: .FORCE
|
examples/black: .FORCE
|
||||||
rm -f $@
|
rm -f $@
|
||||||
|
|
45
noxfile.py
Normal file
45
noxfile.py
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import nox
|
||||||
|
|
||||||
|
nox.options.reuse_existing_virtualenvs = True
|
||||||
|
os.environ.update({"PDM_IGNORE_SAVED_PYTHON": "1"})
|
||||||
|
|
||||||
|
def pdm_install(session,group):
|
||||||
|
session.run_always("pdm", "install", "-G", group, external=True, silent=True)
|
||||||
|
|
||||||
|
|
||||||
|
@nox.session
|
||||||
|
def lint(session):
|
||||||
|
pdm_install(session,"dev")
|
||||||
|
session.run("pre-commit", "run")
|
||||||
|
session.run("mypy", "src/")
|
||||||
|
|
||||||
|
@nox.session
|
||||||
|
def svgs(session):
|
||||||
|
pdm_install(session, "docs")
|
||||||
|
session.run("./scripts/generate-svgs.py", external=True)
|
||||||
|
|
||||||
|
@nox.session
|
||||||
|
def docs(session):
|
||||||
|
pdm_install(session,"docs")
|
||||||
|
if not Path('docs/svgs').is_dir():
|
||||||
|
svgs(session)
|
||||||
|
|
||||||
|
session.run("make","docs", external=True)
|
||||||
|
if session.interactive:
|
||||||
|
session.run("mkdocs","serve")
|
||||||
|
else:
|
||||||
|
session.run("mkdocs","build")
|
||||||
|
|
||||||
|
|
||||||
|
# @nox.session(
|
||||||
|
# python=["3.8", "3.9", "3.10", "3.11"]
|
||||||
|
# )
|
||||||
|
# def test(session):
|
||||||
|
# pdm_install(session,'test')
|
||||||
|
# session.run('pytest')
|
||||||
|
#
|
Loading…
Reference in a new issue