-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
143 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
name: test nornir | ||
on: [push,pull_request] | ||
|
||
jobs: | ||
linters: | ||
name: linters | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup python | ||
uses: actions/setup-python@v1 | ||
|
||
- name: Install Poetry | ||
uses: dschep/install-poetry-action@v1.2 | ||
|
||
- name: Cache Poetry virtualenv | ||
uses: actions/cache@v1 | ||
id: cache | ||
with: | ||
path: ~/.virtualenvs | ||
key: poetry-linters-${{ hashFiles('**/poetry.lock') }} | ||
restore-keys: poetry-linters-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Set Poetry config | ||
run: | | ||
poetry config virtualenvs.in-project false | ||
poetry config virtualenvs.path ~/.virtualenvs | ||
- name: Install Dependencies | ||
run: poetry install | ||
|
||
- name: Run pylama | ||
run: make pylama | ||
- name: Run black | ||
run: make black | ||
- name: Run mypy | ||
run: make mypy | ||
- name: Run sphinx | ||
run: | | ||
sudo apt-get install pandoc | ||
make sphinx | ||
pytest: | ||
name: Testing on Python ${{ matrix.python-version }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ '3.6', '3.7', '3.8' ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: x64 | ||
|
||
- name: Start containers | ||
run: docker-compose up -d | ||
|
||
- name: Install Poetry | ||
uses: dschep/install-poetry-action@v1.2 | ||
|
||
- name: Cache Poetry virtualenv | ||
uses: actions/cache@v1 | ||
id: cache | ||
with: | ||
path: ~/.virtualenvs | ||
key: poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
restore-keys: poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Set Poetry config | ||
run: | | ||
poetry config virtualenvs.in-project false | ||
poetry config virtualenvs.path ~/.virtualenvs | ||
- name: Install Dependencies | ||
run: poetry install | ||
|
||
- name: Run pytest | ||
run: make pytest | ||
|
||
- name: Run nbval | ||
run: make nbval |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,45 @@ | ||
ifeq ($(PYTHON), ) | ||
override PYTHON=3.6 | ||
endif | ||
|
||
DOCKER_COMPOSE_FILE=docker-compose.yaml | ||
DOCKER_COMPOSE=PYTHON=${PYTHON} docker-compose -f ${DOCKER_COMPOSE_FILE} | ||
NORNIR_DIRS=nornir tests docs | ||
|
||
.PHONY: start_dev_env | ||
start_dev_env: | ||
${DOCKER_COMPOSE} \ | ||
up -d \ | ||
dev1.group_1 dev2.group_1 dev3.group_2 dev4.group_2 dev5.no_group httpbin netconf1.no_group | ||
up -d | ||
|
||
.PHONY: stop_dev_env | ||
stop_dev_env: | ||
${DOCKER_COMPOSE} \ | ||
down | ||
|
||
.PHONY: build_test_container | ||
build_test_container: | ||
${DOCKER_COMPOSE} \ | ||
build nornir | ||
|
||
.PHONY: enter-container | ||
enter-container: | ||
${DOCKER_COMPOSE} \ | ||
run --rm nornir bash | ||
|
||
.PHONY: pytest | ||
pytest: | ||
${DOCKER_COMPOSE} \ | ||
run --rm nornir pytest --cov=nornir --cov-report=term-missing -vs ${ARGS} | ||
poetry run pytest --cov=nornir --cov-report=term-missing -vs ${ARGS} | ||
|
||
.PHONY: black | ||
black: | ||
${DOCKER_COMPOSE} \ | ||
run --rm nornir black --check ${NORNIR_DIRS} | ||
poetry run black --check ${NORNIR_DIRS} | ||
|
||
.PHONY: sphinx | ||
sphinx: | ||
# TODO REPLACE with: sphinx-build -n -E -q -N -b dummy -d docs/_build/doctrees docs asd | ||
${DOCKER_COMPOSE} \ | ||
run --rm nornir sphinx-build -W -b html -d docs/_build/doctrees docs docs/_build/html | ||
poetry run sphinx-build -W -b html -d docs/_build/doctrees docs docs/_build/html | ||
|
||
.PHONY: pylama | ||
pylama: | ||
${DOCKER_COMPOSE} \ | ||
run --rm nornir pylama ${NORNIR_DIRS} | ||
poetry run pylama ${NORNIR_DIRS} | ||
|
||
.PHONY: mypy | ||
mypy: | ||
${DOCKER_COMPOSE} \ | ||
run --rm nornir mypy nornir tests | ||
poetry run mypy nornir tests | ||
|
||
.PHONY: nbval | ||
nbval: | ||
${DOCKER_COMPOSE} \ | ||
run --rm nornir pytest --nbval --sanitize-with docs/nbval_sanitize.cfg \ | ||
docs/plugins \ | ||
docs/howto \ | ||
docs/tutorials/intro/initializing_nornir.ipynb \ | ||
docs/tutorials/intro/inventory.ipynb | ||
poetry run pytest --nbval --sanitize-with docs/nbval_sanitize.cfg \ | ||
docs/plugins \ | ||
docs/howto \ | ||
docs/tutorials/intro/initializing_nornir.ipynb \ | ||
docs/tutorials/intro/inventory.ipynb | ||
|
||
.PHONY: tests | ||
tests: stop_dev_env build_test_container start_dev_env black sphinx pylama mypy nbval | ||
make pytest PYTEST=3.6 | ||
make pytest PYTEST=3.7 | ||
tests: stop_dev_env start_dev_env black sphinx pylama mypy nbval pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.