Skip to content

Commit c60527c

Browse files
authored
Add ci.yml (#164)
* Added ci.yml * Updated ci.yml * Run virtualenv as a module to fix issue with CI in GitHub Actions * Run virtualenv as a module to fix issue with CI in GitHub Actions * Fixed linting error * Install/upgrade pip setuptools and wheel when running tests * Fixed linting errors * Requirements are installed in venv, no need to install them at the sytem level
1 parent a473a13 commit c60527c

5 files changed

Lines changed: 39 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: CI
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- master
8+
9+
jobs:
10+
tests:
11+
runs-on: ubuntu-latest
12+
env:
13+
USING_COVERAGE: '3.6,3.8'
14+
strategy:
15+
matrix:
16+
python-version: ["3.6", "3.8"]
17+
steps:
18+
- uses: actions/checkout@v2
19+
with:
20+
submodules: recursive
21+
- uses: "actions/setup-python@v2"
22+
with:
23+
python-version: "${{ matrix.python-version }}"
24+
- name: Install requirements
25+
run: pip install --upgrade pip setuptools wheel
26+
- name: Run tests
27+
run: "./test.bash"

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ help: ## Display help
1919
all: clean venv_python_viptela check test dist ## Setup python-viptela env and run tests
2020

2121
venv: ## Creates the needed virtual environment.
22-
test -d $(VENV) || virtualenv -p $(PYTHON_EXE) $(VENV) $(ARGS)
22+
test -d $(VENV) || $(PYTHON_EXE) -m venv $(VENV) $(ARGS)
2323

2424
$(VENV): $(VENV_BIN)/activate ## Build virtual environment
2525

2626
$(VENV_BIN)/activate: requirements.txt test-requirements.txt
27-
test -d $(VENV) || virtualenv -p $(PYTHON_EXE) $(VENV)
27+
test -d $(VENV) || $(PYTHON_EXE) -m venv $(VENV)
2828
echo "export TOP_DIR=$(TOPDIR)" >> $(VENV_BIN)/activate
29-
. $(VENV_BIN)/activate; pip install -U pip; pip install -r requirements.txt -r test-requirements.txt
29+
. $(VENV_BIN)/activate; pip install --upgrade pip setuptools wheel; pip install -r requirements.txt -r test-requirements.txt
3030

3131
deps: venv ## Installs the needed dependencies into the virtual environment.
32-
$(VENV_BIN)/pip install -U pip
32+
$(VENV_BIN)/pip install --upgrade pip setuptools wheel
3333
$(VENV_BIN)/pip install -r requirements.txt -r test-requirements.txt
3434

3535
dev: deps ## Installs python_viptela in develop mode.
@@ -65,7 +65,7 @@ dist: build ## Creates the distribution.
6565

6666

6767
test: deps ## Run python-viptela tests
68-
. $(VENV_BIN)/activate; pip install -U pip; pip install -r requirements.txt -r test-requirements.txt;tox -r
68+
. $(VENV_BIN)/activate; pip install --upgrade pip setuptools wheel; pip install -r requirements.txt -r test-requirements.txt;tox -r
6969

7070
clean: ## Clean python-viptela $(VENV)
7171
$(RM) -rf $(VENV)

vmanage/cli/deactivate/central_policy.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55

66
@click.command('central-policy')
77
@click.option('--name', '-n', help="Name of policy to deactivate.")
8-
@click.option('--id', '-i', help="Id of policy to deactivate.")
8+
@click.option('--id', '-i', 'policy_id', help="Id of policy to deactivate.")
99
@click.pass_obj
10-
def central_policy(ctx, name, id):
10+
def central_policy(ctx, name, policy_id):
1111
"""
1212
deactivate Central Policy
1313
"""
1414

1515
vmanage_central_policy = CentralPolicy(ctx.auth, ctx.host, ctx.port)
1616
vmanage_utilities = Utilities(ctx.auth, ctx.host, ctx.port)
1717
central_policy_dict = vmanage_central_policy.get_central_policy_dict(remove_key=True)
18-
if id:
19-
vmanage_central_policy.deactivate_central_policy(id)
18+
if policy_id:
19+
vmanage_central_policy.deactivate_central_policy(policy_id)
2020
elif name:
2121
if name in central_policy_dict:
2222
click.echo(f'Deactivating Central Policy {name}')

vmanage/cli/decommission/device.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44

55
@click.command('device')
6-
@click.argument('device', required=True)
6+
@click.argument('device_name', required=True)
77
@click.pass_obj
8-
def device(ctx, device):
8+
def device(ctx, device_name):
99
"""
1010
Decommission device
1111
"""
1212

1313
vmanage_device = Device(ctx.auth, ctx.host, ctx.port)
14-
status = vmanage_device.get_device_status(device, key='host-name')
14+
status = vmanage_device.get_device_status(device_name, key='host-name')
1515
if 'uuid' in status:
1616
vmanage_device.put_device_decommission(status['uuid'])
1717
else:

vmanage/cli/reset/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from vmanage.cli.reset.interface import interface
33

44

5-
65
@click.group('reset')
76
def reset():
87
"""

0 commit comments

Comments
 (0)