Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/build-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Push Container

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Login to github container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and tag latest docker image
run: |
make container -e REGISTRY_NAME=ghcr.io/${{ github.repository_owner }} IMAGE_VERSION=$GITHUB_SHA

- name: Tag versioned image
run: docker tag ghcr.io/${{ github.repository_owner }}/nuts:$GITHUB_SHA ghcr.io/${{ github.repository_owner }}/nuts:latest

- name: Push the images
run: |
docker push ghcr.io/${{ github.repository_owner }}/nuts:latest
docker push ghcr.io/${{ github.repository_owner }}/nuts:$GITHUB_SHA
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM python:3.10-slim as builder

RUN pip install poetry
RUN mkdir -p /nuts
COPY . /nuts

WORKDIR /nuts
RUN poetry install --without dev

FROM python:3.10-slim as base

COPY --from=builder /nuts /nuts

WORKDIR /nuts
ENV PATH="/nuts/.venv/bin:$PATH"

# line below due to import bug
RUN python3 -c "from napalm.base.exceptions import ConnectionException"

ENTRYPOINT [ "/bin/bash" ]
13 changes: 12 additions & 1 deletion docs/source/installation/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Installation of NUTS
Installation Instructions
-------------------------

Nuts requires Python 3.7 or higher.
Nuts requires Python 3.8 or higher.

Installation via pip
....................
Expand All @@ -25,6 +25,17 @@ Nuts uses `poetry <https://python-poetry.org/>`__ as a dependency manager.
#. Change into the cloned folder, then install all necessary dependencies: ``$ poetry install``
#. Install nuts: ``$ pip install .``

Installation via container
..........................

Nuts is also available in a dockerized version. It uses the GitHub registry.

.. code:: shell

docker pull ghcr.io/network-unit-testing-system/nuts:latest
docker run -it ghcr.io/network-unit-testing-system/nuts


Parsing with ntc-templates
--------------------------

Expand Down
20 changes: 12 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ build-backend = "poetry.core.masonry.api"
name = "nuts"
version = "3.2.0"
description = "Network Unit Testing System"
authors = ["Lukas Murer, Méline Sieber, Urs Baumann, Matthias Gabriel, Florian Bruhin", "Marco Martinez", "Severin Grimm"]
maintainers = ["Marco Martinez <marco.maritnez@ost.ch>", "Urs Baumann <github@m.ubaumann.ch>"]
authors = [
"Lukas Murer, Méline Sieber, Urs Baumann, Matthias Gabriel, Florian Bruhin",
"Marco Martinez",
"Severin Grimm",
]
maintainers = [
"Marco Martinez <marco.maritnez@ost.ch>",
"Urs Baumann <github@m.ubaumann.ch>",
]
classifiers = ["Framework :: Pytest", "Topic :: System :: Networking"]
homepage = "https://github.com/network-unit-testing-system/nuts"
repository = "https://github.com/network-unit-testing-system/nuts"
Expand Down Expand Up @@ -35,7 +42,7 @@ types-setuptools = "*"
types-toml = "*"

[tool.poetry.plugins."pytest11"]
"nuts"="nuts.plugin"
"nuts" = "nuts.plugin"
# why "pytest11": https://github.com/pytest-dev/pytest/commit/ed03eef81b220199a819632a27f9c452b8e1fb81
# https://docs.pytest.org/en/latest/how-to/writing_plugins.html#making-your-plugin-installable-by-others

Expand All @@ -50,12 +57,10 @@ filterwarnings = [
"ignore:Using or importing the ABCs from 'collections':DeprecationWarning:jnpr\\.junos\\.factcache",
"ignore:NutsYamlFile\\.fspath is deprecated and will be replaced by NutsYamlFile\\.path\\.",
]
markers = [
"nuts_test_ctx: A NutsContext to be used in tests."
]
markers = ["nuts_test_ctx: A NutsContext to be used in tests."]

[tool.mypy]
python_version = 3.8
python_version = "3.8"

### --strict
warn_unused_configs = true
Expand Down Expand Up @@ -149,4 +154,3 @@ commands = pytest {posargs} --junitxml=test-reports/pytest.xml --cov="{envsitepa
# envsitepackagesdir see: https://tox.readthedocs.io/en/latest/example/pytest.html

"""