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
190 changes: 190 additions & 0 deletions .github/workflows/py2-py3-packages-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
name: CI

on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
release:
types: [published]

jobs:
tests:
name: Run unit tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7, 3.7]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install pip -U
pip install tox codecov
- name: Set TOXENV
run: |
python_version="${{ matrix.python-version }}"
py_version="${python_version/./}"
target_branch=${{ github.base_ref || github.ref }}
target_branch=(`[[ ${target_branch::10} == 'refs/heads' ]] && echo ${target_branch:11} || echo $target_branch`)
echo "target_branch =" $target_branch
is_master=(`[[ $target_branch == 'master' ]] && echo 'true' || echo 'false'`)
is_tag=${{ startsWith(github.ref, 'refs/tags') }}
echo "is_master =" $is_master
echo "is_tag =" $is_tag
branch=(`[[ $is_master == 'true' || $is_tag == 'true' ]] && echo 'master' || echo 'dev'`)
TOXENV="py$py_version-$branch"
echo $TOXENV
echo "TOXENV=$TOXENV" >> $GITHUB_ENV
- name: Run tox
run: tox
- name: Upload coverage report
uses: codecov/codecov-action@v1
with:
file: .coverage
fail_ci_if_error: true
verbose: true
pre-commit:
name: Run pre-commit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install pip -U
pip install tox
- name: Run pre-commit
env:
TOXENV: pre-commit
run: tox
build:
name: Build package
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install pip -U
pip install tox
- name: Build
env:
TOXENV: build
run: tox
check-version:
name: Check version
# only for PRs in master
if: ${{ github.base_ref == 'master' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check version
run: |
git clone https://github.com/${{ github.repository }}.git ${{ github.repository }}
cd ${{ github.repository }}
git checkout -qf ${{ github.head_ref }}
! git diff --exit-code --quiet origin/master version.txt
deploy-to-test-pypi:
needs: [tests, pre-commit, build]
if: ${{ github.ref == 'refs/heads/dev' && github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install pip -U
pip install tox
- name: Add id to a package version
run: sed -i -E "s/^([0-9]+\.[0-9]+\.[0-9]+)$/\1.${{ github.run_number }}/" version.txt
- name: Build
env:
TOXENV: build
run: tox
- name: Publish
uses: pypa/gh-action-pypi-publish@v1.4.1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
create-gh-release:
needs: [tests, pre-commit, build]
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install pip -U
pip install tox
- name: Build
env:
TOXENV: build
run: tox
- name: Set envs
run: |
version="$(cat version.txt | tr -d ' \t\n\r')"
repo_owner=${{ github.repository }}
index=`expr index "$repo_owner" /`
repo=${repo_owner:index}
echo "TAG=$version" >> $GITHUB_ENV
echo "REPO=$repo" >> $GITHUB_ENV
- name: Create GitHub release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "dist/*"
draft: true
name: ${{ env.REPO }} ${{ env.TAG }}
tag: ${{ env.TAG }}
commit: master
deploy-to-pypi:
needs: [tests, pre-commit, build]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install pip -U
pip install tox
- name: Build
env:
TOXENV: build
run: tox
- name: Publish
uses: pypa/gh-action-pypi-publish@v1.4.1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
89 changes: 0 additions & 89 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# cloudshell-networking-cisco
[![Build status](https://travis-ci.org/QualiSystems/cloudshell-networking-cisco.svg?branch=master)](https://travis-ci.org/QualiSystems/cloudshell-networking-cisco)
[![Build status](https://github.com/QualiSystems/cloudshell-networking-cisco/workflows/CI/badge.svg?branch=master)](https://github.com/QualiSystems/cloudshell-networking-cisco/actions?query=branch%3Amaster)
[![codecov](https://codecov.io/gh/QualiSystems/cloudshell-networking-cisco/branch/master/graph/badge.svg)](https://codecov.io/gh/QualiSystems/cloudshell-networking-cisco)
[![PyPI version](https://badge.fury.io/py/cloudshell-networking-cisco.svg)](https://badge.fury.io/py/cloudshell-networking-cisco)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def cisco_duplex_state_table(self):
)
if cisco_duplex_state_table:
self._cisco_duplex_state_table = {
v.get("portIfIndex", "").lower(): k
v.get("portIfIndex", "").safe_value.lower(): k
for k, v in cisco_duplex_state_table.items()
}
self._logger.info("Duplex portIfIndex table loaded")
Expand Down
5 changes: 3 additions & 2 deletions cloudshell/networking/cisco/autoload/cisco_snmp_if_port.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from cloudshell.snmp.autoload.core.snmp_oid_template import SnmpMibOidTemplate
from cloudshell.snmp.autoload.domain.if_entity.snmp_if_port_entity import SnmpIfPort
from cloudshell.snmp.core.domain.snmp_oid import SnmpMibObject


class CiscoSnmpIfPort(SnmpIfPort):
Expand Down Expand Up @@ -55,8 +56,8 @@ def _get_cisco_duplex(self):
cisco_duplex_id = state_table.get(str(self.if_index))
if cisco_duplex_id:
self._cisco_duplex = self._snmp.get_property(
"CISCO-STACK-MIB", "portDuplex", cisco_duplex_id
).replace("'", "")
SnmpMibObject("CISCO-STACK-MIB", "portDuplex", cisco_duplex_id)
).safe_value.replace("'", "")
return self._cisco_duplex

def _get_duplex(self):
Expand Down
11 changes: 1 addition & 10 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,4 @@ pre-commit
tox
tox-factor
-r test_requirements.txt
-e git+https://github.com/QualiSystems/cloudshell-logging.git@dev#egg=cloudshell-logging
-e git+https://github.com/QualiSystems/cloudshell-shell-core.git@dev#egg=cloudshell-shell-core
-e git+https://github.com/QualiSystems/cloudshell-cli.git@dev#egg=cloudshell-cli
-e git+https://github.com/QualiSystems/cloudshell-snmp.git@dev#egg=cloudshell-snmp
-e git+https://github.com/QualiSystems/cloudshell-snmp-autoload.git@dev#egg=cloudshell-snmp-autoload
-e git+https://github.com/QualiSystems/cloudshell-shell-flows.git@dev#egg=cloudshell-shell-flows
-e git+https://github.com/QualiSystems/cloudshell-shell-connectivity-flow.git@dev#egg=cloudshell-shell-connectivity-flow
-e git+https://github.com/QualiSystems/cloudshell-shell-flows.git@dev#egg=cloudshell-shell-flows
-e git+https://github.com/QualiSystems/cloudshell-shell-standards.git@dev#egg=cloudshell-shell-standards
-e git+https://github.com/QualiSystems/cloudshell-shell-networking-standard.git@dev#egg=cloudshell-shell-networking-standard
-r requirements.txt
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ commands = pre-commit run --all-files --show-diff-on-failure
[testenv:build]
skip_install = true
commands =
python setup.py sdist --format zip
python setup.py bdist_wheel --universal
python setup.py -q sdist --format zip
python setup.py -q bdist_wheel --universal

[isort]
line_length = 88
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.1
6.1.3