Skip to content

Commit 084abdb

Browse files
authored
Tim fiola GitHub actions migration (#61)
* Create python-package-conda.yml * Added initial mods to migrate from travis-ci to github actions * mods to ci.yml to fix workflow problems * added files to git * bumping to trigger workflow * bumping to trigger workflow (modded ci.yml) * fixed error in ci.yml - bumping to trigger workflow for real this time (modded ci.yml) * fixed error in ci.yml * fixed errors where a space was needed before the "." (current dir) in ci.yml * fixed black errors * black versioning troubleshooting * black formatting corrections * updated changelog.rst * updated changelog.rst and matched the new version in changelog.rst and setup.py
1 parent 1dca959 commit 084abdb

19 files changed

+146
-129
lines changed

.github/workflows/ci.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
- "tim-fiola-github-actions-migration"
8+
tags:
9+
- "v*"
10+
pull_request:
11+
branches:
12+
- "master"
13+
workflow_dispatch: {}
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
quality:
21+
name: Code Quality Check
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout Repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 1
28+
29+
- name: Set up Python 3.10
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: "3.10"
33+
cache: 'pip'
34+
35+
- name: Install Linting Tools
36+
run: |
37+
python -m pip install --upgrade pip
38+
if [ -f requirements_dev.txt ]; then
39+
pip install -r requirements_dev.txt
40+
else
41+
pip install black flake8
42+
fi
43+
44+
- name: Validate black version
45+
# Fixed: Added space between --check and .
46+
run: black --version
47+
48+
- name: Check Formatting (Black)
49+
# Fixed: Added space between --check and .
50+
run: black --check .
51+
52+
- name: Run Linter (Flake8)
53+
# Fixed: Added space between flake8 and .
54+
run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
55+
56+
tests:
57+
name: Test (Python ${{ matrix.python-version }})
58+
needs: quality
59+
runs-on: ubuntu-latest
60+
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
python-version: ["3.8", "3.9", "3.10", "3.11", "pypy-3.9"]
65+
66+
steps:
67+
- name: Checkout Repository
68+
uses: actions/checkout@v4
69+
with:
70+
fetch-depth: 0
71+
72+
- name: Set up Python ${{ matrix.python-version }}
73+
uses: actions/setup-python@v5
74+
with:
75+
python-version: ${{ matrix.python-version }}
76+
cache: 'pip'
77+
78+
- name: Install Dependencies
79+
run: |
80+
python -m pip install --upgrade pip
81+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
82+
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
83+
pip install -e .
84+
85+
- name: Run Tests
86+
run: |
87+
python -m pytest --verbose

.github/workflows/docs.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Documentation Build
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'docs/**'
7+
- '*.rst'
8+
- '*.md'
9+
- 'pyNTM/**' # Code changes can affect docstrings
10+
11+
jobs:
12+
build_docs:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.10"
19+
20+
- name: Install Dependencies
21+
run: |
22+
pip install sphinx sphinx-rtd-theme
23+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
24+
pip install -e.
25+
26+
- name: Build HTML
27+
run: |
28+
cd docs
29+
make html

.travis.yml

Lines changed: 0 additions & 90 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Thank you!
1010

1111

1212
[![PyPI](https://img.shields.io/pypi/v/pyntm.svg)](https://pypi.python.org/pypi/pyNTM)
13-
[![Build Status](https://app.travis-ci.com/tim-fiola/network_traffic_modeler_py3.svg?branch=master)](https://app.travis-ci.com/tim-fiola/network_traffic_modeler_py3)
13+
[![CI](https://github.com/tim-fiola/network_traffic_modeler_py3/actions/workflows/ci.yml/badge.svg)](https://github.com/tim-fiola/network_traffic_modeler_py3/actions/workflows/ci.yml)
1414
[![Coverage Status](https://coveralls.io/repos/github/tim-fiola/network_traffic_modeler_py3/badge.svg?branch=master)](https://coveralls.io/github/tim-fiola/network_traffic_modeler_py3?branch=master)
1515
[![Documentation Status](https://readthedocs.org/projects/pyntm/badge/?version=latest)](https://pyntm.readthedocs.io/en/latest/?badge=latest)
1616

docs/changelog.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
3.5.1
5+
-----
6+
* Migrated from TravisCI to GitHub actions for testing pipeline
7+
* Added Python support for 3.9, 3.10, 3.11
8+
* Supported Python versions are 3.8-3.11 and pypy3.9
9+
* These changes will allow development to move forward while keeping the robust 90+% code testing coverage in place
10+
411
3.4.1
512
-----
613
* Updated test environment to Focal linux (from Xenial) to allow ``dash`` and ``dash-cytoscape`` package import in CI/CD for visualization

examples/network_modeling_with_visualization.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- access to graph_network folder in syspath
77
88
"""
9+
910
# This is a temp hack to get this to see pyNTM and let it import
1011
import sys # noqa
1112

pyNTM/interface.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,18 @@ def __hash__(self):
7979
return hash(self.name + self.node_object.name)
8080

8181
def __repr__(self):
82-
return "%s(name = %r, cost = %s, capacity = %s, node_object = %r, \
83-
remote_node_object = %r, circuit_id = %r)" % (
84-
self.__class__.__name__,
85-
self.name,
86-
self.cost,
87-
self.capacity,
88-
self.node_object,
89-
self.remote_node_object,
90-
self.circuit_id,
82+
return (
83+
"%s(name = %r, cost = %s, capacity = %s, node_object = %r, \
84+
remote_node_object = %r, circuit_id = %r)"
85+
% (
86+
self.__class__.__name__,
87+
self.name,
88+
self.cost,
89+
self.capacity,
90+
self.node_object,
91+
self.remote_node_object,
92+
self.circuit_id,
93+
)
9194
)
9295

9396
@property
@@ -291,7 +294,6 @@ def demands(self, model):
291294
demand for demand in model.demand_objects if demand.path != "Unrouted"
292295
)
293296
for demand in routed_demands:
294-
295297
for dmd_path in demand.path:
296298
# If dmd_path is an RSVP LSP and self is in dmd_path.path['interfaces'] ,
297299
# look at the LSP path and get demands on the LSP and add them to dmd_set

pyNTM/master_model.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ def simulation_diagnostics(self):
121121
lsps_routed_with_demands_gen = iter(lsps_routed_with_demands)
122122

123123
# Update generators in simulation_data
124-
simulation_data[
125-
"routed LSPs with no demands generator"
126-
] = lsps_routed_no_demands_gen
127-
simulation_data[
128-
"routed LSPs with demands generator"
129-
] = lsps_routed_with_demands_gen
124+
simulation_data["routed LSPs with no demands generator"] = (
125+
lsps_routed_no_demands_gen
126+
)
127+
simulation_data["routed LSPs with demands generator"] = (
128+
lsps_routed_with_demands_gen
129+
)
130130
simulation_data["demands riding LSPs generator"] = dmds_riding_lsps_gen
131131

132132
return simulation_data
@@ -244,7 +244,6 @@ def _route_parallel_lsp_groups(self, parallel_demand_groups, parallel_lsp_groups
244244

245245
# Route LSPs by source, dest (parallel) groups
246246
for group, lsps in parallel_lsp_groups.items():
247-
248247
num_lsps_in_group = len(lsps)
249248

250249
print(
@@ -755,7 +754,6 @@ def unfail_interface(self, interface_name, node_name, raise_exception=False):
755754
self.get_node_object(interface_object.node_object.name).failed is False
756755
and self.get_node_object(remote_interface.node_object.name).failed is False
757756
):
758-
759757
remote_interface.failed = False
760758
remote_interface.reserved_bandwidth = 0
761759
interface_object.failed = False
@@ -816,7 +814,6 @@ def unfail_node(self, node_name):
816814
ints_to_unfail_iterator = iter(self.get_node_interfaces(node_name))
817815

818816
for interface in ints_to_unfail_iterator:
819-
820817
# Unfail the interfaces if the remote node is not failed
821818
if not interface.remote_node_object.failed:
822819
# Unfail the specific interface

pyNTM/performance_model.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,6 @@ def _update_interface_utilization(self):
12931293

12941294
# Get the interfaces for each LSP in the demand's path
12951295
for lsp in lsps_for_demand:
1296-
12971296
lsp_path_interfaces = lsp.path["interfaces"]
12981297

12991298
# Now that all interfaces are known,

pyNTM/rsvp.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""A class to represent an RSVP label-switched-path in the network model """
1+
"""A class to represent an RSVP label-switched-path in the network model"""
22

33
import random
44
from .exceptions import ModelException
@@ -37,7 +37,6 @@ def __init__(
3737
configured_setup_bandwidth=None,
3838
configured_manual_metric=None,
3939
):
40-
4140
self.source_node_object = source_node_object
4241
self.dest_node_object = dest_node_object
4342
self.lsp_name = lsp_name

0 commit comments

Comments
 (0)