Skip to content

Merge pull request #43 from devon-mar/dependabot/github_actions/actio… #184

Merge pull request #43 from devon-mar/dependabot/github_actions/actio…

Merge pull request #43 from devon-mar/dependabot/github_actions/actio… #184

Workflow file for this run

---
name: CI
"on":
push:
branches:
- master
- devel
pull_request:
env:
PYTHON_VERSION: "3.10"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cache-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
- name: Run poetry install
run: poetry install
if: steps.cache-poetry-dependencies.outputs.cache-hit != 'true'
- uses: psf/black@stable
- name: Lint with flake8
run: |
poetry run flake8 nornir_routeros --count --max-line-length=120 --show-source --statistics
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python 3.8
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cache-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
- name: Run poetry install
run: poetry install
if: steps.cache-poetry-dependencies.outputs.cache-hit != 'true'
- name: Build docs
working-directory: ./docs
run: poetry run make html SPHINXOPTS="-n"
test:
strategy:
matrix:
ros_version:
- 7.10.1
# Long-term
- 6.48.6
runs-on: ubuntu-latest
services:
routeros:
image: ghcr.io/devon-mar/docker-routeros:${{ matrix.ros_version }}
ports:
- 2222:22
- 8728:8728
- 8729:8729
volumes:
- /dev/net/tun:/dev/net/tun
options: >-
--cap-add=NET_ADMIN
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
# https://stackoverflow.com/questions/62977821/how-to-cache-poetry-install-for-github-actions
- name: Load cached venv
id: cache-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
- name: Run poetry install
run: poetry install
if: steps.cache-poetry-dependencies.outputs.cache-hit != 'true'
- name: Setup the router
run: tests/ros_setup.sh
- name: Run pytest
run: |
poetry run pytest -vv --cov=./nornir_routeros --cov-report=xml --cov-branch
- name: Upload coverage to codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}