Skip to content

Commit

Permalink
Refactoring examples to be testable
Browse files Browse the repository at this point in the history
  • Loading branch information
nycholas committed Oct 7, 2024
1 parent d534816 commit 2e4b755
Show file tree
Hide file tree
Showing 97 changed files with 2,815 additions and 2,168 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,20 @@ jobs:
- name: Run tests
run: |
bash ./bin/docker-compose-it.sh
example-tests:
name: Examples | Unit tests
needs: does-it-run
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- name: Run tests | ${{ matrix.python-version }}
run: |
make test-examples
31 changes: 17 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,40 +1,43 @@
.PHONY: all clean test test-release release publish-test publish env
.PHONY: all clean style typing test test-release release publish-test publish env

VIRTUALENV_EXISTS := $(shell [ -d .venv ] && echo 1 || echo 0)

all: clean test
@python -c "print('OK')"

clean:
@python setup.py clean
@find src/ -name "*.so" | xargs rm -rf
@find . -name "*.pyc" | xargs rm -rf
@find . -name "__pycache__" | xargs rm -rf
@find . -name ".coverage" | xargs rm -rf
@rm -rf .coverage coverage.* .eggs/ .mypy_cache/ .pytype/ .ruff_cache/ .pytest_cache/ .tox/ src/Flask_JSONRPC.egg-info/ htmlcov/ junit/ htmldoc/ build/ dist/ wheelhouse/
@find {src,examples,tests} -regex ".*\.\(so\|pyc\|__pycache__\|\.coverage\|\.tox\|\.pytest_cache\|\.ruff_cache\)" | xargs rm -rf
@find {src,examples,tests} -name "__pycache__" -o -name ".coverage" -o -name ".tox" -o -name ".pytest_cache" -o -name ".ruff_cache" -o -name ".pkg" -o -name ".tmp" | xargs rm -rf
@rm -rf .coverage coverage.* .eggs/ .mypy_cache/ .pytype/ .ruff_cache/ .pytest_cache/ .tox/ src/*.egg-info/ htmlcov/ junit/ htmldoc/ build/ dist/ wheelhouse/

style:
@ruff check .
@ruff format .

typing:
@mypy --install-types --non-interactive src/

test: clean
@python -m pip install --upgrade tox
@python -m tox
@python -m tox -p all

test-examples: clean
@find examples/ -name "tox.ini" -print0 | xargs -0 -t -I % -P 1 tox -p all -c %

test-release: clean test
@docker-compose -f docker-compose.test.yml build --build-arg VERSION=$(shell date +%s)
@docker-compose -f docker-compose.test.yml up
test-release: test
$(shell ./bin/docker-compose-test.sh)
$(shell ./bin/docker-compose-it.sh)

release: clean test
release: test
@python -m pip install --upgrade -r requirements/cbuild.txt
@python -m build
@MYPYC_ENABLE=1 python setup.py bdist_wheel

publish-test: clean release
publish-test: release
@python -m pip install --upgrade twine
@python -m twine upload --repository testpypi dist/*

publish: clean release
publish: release
@python -m pip install --upgrade twine
@python -m twine upload dist/*

Expand Down
104 changes: 0 additions & 104 deletions examples/async/README.rst

This file was deleted.

81 changes: 0 additions & 81 deletions examples/async/async_minimal.py

This file was deleted.

58 changes: 0 additions & 58 deletions examples/auth/README.rst

This file was deleted.

Loading

0 comments on commit 2e4b755

Please sign in to comment.