Skip to content

Commit

Permalink
Merge pull request netgroup#27 from netgroup/add-more-github-actions
Browse files Browse the repository at this point in the history
Add several GitHub actions
  • Loading branch information
cscarpitta authored Jun 23, 2020
2 parents 37d2c3b + 9717330 commit 7eb3b58
Show file tree
Hide file tree
Showing 12 changed files with 253 additions and 94 deletions.
32 changes: 32 additions & 0 deletions .github/label-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
- regExp: ".*\\.ts+$"
labels: ["typescript"]
- regExp: ".*\\.sql+$"
labels: ["database", "critical"]
- regExp: ".*/docs/"
labels: ["documentation"]
- regExp: ".*\\.png+$"
labels: ["images"]
- regExp: "^(pom\\.xml|package\\.json|build\\.gradle)$"
labels: ["dependencies"]
- regExp: ".*/requirements.txt"
labels: ["dependencies"]
- regExp: ".*\\.(zip|jar|war|ear)+$"
labels: ["artifact", "invalid"]
- regExp: ".*/setup.py"
labels: ["build"]
- regExp: "^.github/"
labels: ["github-workflow"]
- regExp: "^nets/8r-1c-in-band-isis/"
labels: ["topology/8r-1c-in-band-isis"]
- regExp: "^nets/8routers-isis-ipv6/"
labels: ["topology/8routers-isis-ipv6"]
- regExp: "^nets-unmantained/8r-1c-out-band-isis/"
labels: ["topology/8r-1c-out-band-isis"]
- regExp: "^nets-unmantained/3routers/"
labels: ["topology/3routers"]
- regExp: "^nets-unmantained/8routers/"
labels: ["topology/8routers"]
- regExp: "^nets-in-progress/8r-1c-srv6-pm/"
labels: ["topology/8r-1c-srv6-pm"]
- regExp: ".*/.env"
labels: ["configuration"]
3 changes: 3 additions & 0 deletions .github/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
feature: ['feature/*', 'feat/*', 'feature-*', 'feat-*']
bug: ['fix/*', 'fix-*']
chore: ['chore/*', 'chore-*']
36 changes: 36 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name-template: 'v$RESOLVED_VERSION 🌈'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
label: 'chore'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
- 'feature'
- 'enhancement'
patch:
labels:
- 'patch'
- 'fix'
- 'bugfix'
- 'bug'
default: patch
exclude-labels:
- 'skip-changelog'
template: |
## Changes
$CHANGES
42 changes: 42 additions & 0 deletions .github/workflows/autopep8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: autopep8
on: pull_request
jobs:
autopep8:
# Check if the PR is not raised by this workflow and is not from a fork
if: startsWith(github.head_ref, 'autopep8-patches') == false && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: 3
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel flake8 pytest
- name: autopep8
id: autopep8
uses: peter-evans/autopep8@v1
with:
args: --exit-code --recursive --in-place --aggressive --aggressive .
- name: Set autopep8 branch name
id: vars
run: echo ::set-output name=branch-name::"autopep8-patches/$GITHUB_HEAD_REF"
- name: Create Pull Request
if: steps.autopep8.outputs.exit-code == 2
uses: peter-evans/create-pull-request@v2
with:
commit-message: autopep8 action fixes
committer: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
title: Fixes by autopep8 action
body: This is an auto-generated PR with fixes by autopep8.
labels: autopep8, automated pr
reviewers: cscarpitta
branch: ${{ steps.vars.outputs.branch-name }}
- name: Fail if autopep8 made changes
if: steps.autopep8.outputs.exit-code == 2
run: exit 1
27 changes: 27 additions & 0 deletions .github/workflows/pr_labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Workflow to associate labels automatically
name: labeler

# Trigger the workflow on pull request events
on: [pull_request]

jobs:
label:
runs-on: ubuntu-latest
steps:
# We need to checkout the repository to access the configured file (.github/label-pr.yml)
- uses: actions/checkout@v2
- name: Labeler
uses: docker://decathlon/pull-request-labeler-action:2.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Here we can override the path for the action configuration. If none is provided, default one is `.github/label-pr.yml`
# CONFIG_PATH: ${{ secrets.GITHUB_WORKSPACE }}/.github/label-pr.yml

pr-labeler:
runs-on: ubuntu-latest
steps:
- uses: TimonVS/pr-labeler-action@v3
# with:
# configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 19 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
# with:
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# config-name: my-config.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 changes: 18 additions & 18 deletions nets-in-progress/8r-1c-srv6-pm/isis8d.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from mininet.util import dumpNodeConnections

# BASEDIR = "/home/user/mytests/ospf3routers/nodeconf/"
BASEDIR = os.getcwd()+"/nodeconf/"
BASEDIR = os.getcwd() + "/nodeconf/"
OUTPUT_PID_TABLE_FILE = "/tmp/pid_table_file.txt"

PRIVDIR = '/var/priv'
Expand Down Expand Up @@ -72,9 +72,9 @@ def config(self, **kwargs):
# first = False
# self.cmd('ip a a %s dev %s' %(kwargs['mgmtip'], intf.name))
# let's write the hostname in /var/mininet/hostname
self.cmd("echo '" + self.name + "' > "+PRIVDIR+"/hostname")
if os.path.isfile(BASEDIR+self.name+"/start.sh"):
self.cmd('source %s' % BASEDIR+self.name+"/start.sh")
self.cmd("echo '" + self.name + "' > " + PRIVDIR + "/hostname")
if os.path.isfile(BASEDIR + self.name + "/start.sh"):
self.cmd('source %s' % BASEDIR + self.name + "/start.sh")

def cleanup(self):
def remove_if_exists(filename):
Expand All @@ -86,13 +86,13 @@ def remove_if_exists(filename):
if os.path.exists(self.dir):
shutil.rmtree(self.dir)

remove_if_exists(BASEDIR+self.name+"/zebra.pid")
remove_if_exists(BASEDIR+self.name+"/zebra.log")
remove_if_exists(BASEDIR+self.name+"/zebra.sock")
remove_if_exists(BASEDIR+self.name+"/isis8d.pid")
remove_if_exists(BASEDIR+self.name+"/isis8d.log")
remove_if_exists(BASEDIR+self.name+"/isisd.log")
remove_if_exists(BASEDIR+self.name+"/isisd.pid")
remove_if_exists(BASEDIR + self.name + "/zebra.pid")
remove_if_exists(BASEDIR + self.name + "/zebra.log")
remove_if_exists(BASEDIR + self.name + "/zebra.sock")
remove_if_exists(BASEDIR + self.name + "/isis8d.pid")
remove_if_exists(BASEDIR + self.name + "/isis8d.log")
remove_if_exists(BASEDIR + self.name + "/isisd.log")
remove_if_exists(BASEDIR + self.name + "/isisd.pid")

remove_if_exists(OUTPUT_PID_TABLE_FILE)

Expand Down Expand Up @@ -153,9 +153,9 @@ def config(self, **kwargs):
# first = False
# self.cmd('ip a a %s dev %s' %(kwargs['mgmtip'], intf.name))
# let's write the hostname in /var/mininet/hostname
self.cmd("echo '" + self.name + "' > "+PRIVDIR+"/hostname")
if os.path.isfile(BASEDIR+self.name+"/start.sh"):
self.cmd('source %s' % BASEDIR+self.name+"/start.sh")
self.cmd("echo '" + self.name + "' > " + PRIVDIR + "/hostname")
if os.path.isfile(BASEDIR + self.name + "/start.sh"):
self.cmd('source %s' % BASEDIR + self.name + "/start.sh")

def cleanup(self):
# def remove_if_exists(filename):
Expand All @@ -171,8 +171,8 @@ def cleanup(self):
# the add_link function creates a link and assigns the interface names
# as node1-node2 and node2-node1
def add_link(my_net, node1, node2):
my_net.addLink(node1, node2, intfName1=node1.name+'-'+node2.name,
intfName2=node2.name+'-'+node1.name)
my_net.addLink(node1, node2, intfName1=node1.name + '-' + node2.name,
intfName2=node2.name + '-' + node1.name)


def create_topo(my_net):
Expand Down Expand Up @@ -311,8 +311,8 @@ def stop_all():


def extract_host_pid(dumpline):
temp = dumpline[dumpline.find('pid=')+4:]
return int(temp[:len(temp)-2])
temp = dumpline[dumpline.find('pid=') + 4:]
return int(temp[:len(temp) - 2])


def simple_test():
Expand Down
26 changes: 13 additions & 13 deletions nets-unmantained/3routers/ospf3r.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from mininet.util import dumpNodeConnections

# BASEDIR = "/home/user/mytests/ospf3routers/nodeconf/"
BASEDIR = os.getcwd()+"/nodeconf/"
BASEDIR = os.getcwd() + "/nodeconf/"
OUTPUT_PID_TABLE_FILE = "/tmp/pid_table_file.txt"

PRIVDIR = '/var/priv'
Expand Down Expand Up @@ -47,9 +47,9 @@ def config(self, **kwargs):
# first = False
# self.cmd('ip a a %s dev %s' %(kwargs['mgmtip'], intf.name))
# let's write the hostname in /var/mininet/hostname
self.cmd("echo '" + self.name + "' > "+PRIVDIR+"/hostname")
if os.path.isfile(BASEDIR+self.name+"/start.sh"):
self.cmd('source %s' % BASEDIR+self.name+"/start.sh")
self.cmd("echo '" + self.name + "' > " + PRIVDIR + "/hostname")
if os.path.isfile(BASEDIR + self.name + "/start.sh"):
self.cmd('source %s' % BASEDIR + self.name + "/start.sh")

def cleanup(self):
def remove_if_exists(filename):
Expand All @@ -61,11 +61,11 @@ def remove_if_exists(filename):
if os.path.exists(self.dir):
shutil.rmtree(self.dir)

remove_if_exists(BASEDIR+self.name+"/zebra.pid")
remove_if_exists(BASEDIR+self.name+"/zebra.log")
remove_if_exists(BASEDIR+self.name+"/zebra.sock")
remove_if_exists(BASEDIR+self.name+"/ospfd.pid")
remove_if_exists(BASEDIR+self.name+"/ospfd.log")
remove_if_exists(BASEDIR + self.name + "/zebra.pid")
remove_if_exists(BASEDIR + self.name + "/zebra.log")
remove_if_exists(BASEDIR + self.name + "/zebra.sock")
remove_if_exists(BASEDIR + self.name + "/ospfd.pid")
remove_if_exists(BASEDIR + self.name + "/ospfd.log")
remove_if_exists(OUTPUT_PID_TABLE_FILE)

# if os.path.exists(BASEDIR+self.name+"/zebra.pid"):
Expand Down Expand Up @@ -96,8 +96,8 @@ def __init__(self, name, *args, **kwargs):


def add_link(node1, node2):
Link(node1, node2, intfName1=node1.name+'-'+node2.name,
intfName2=node2.name+'-'+node1.name)
Link(node1, node2, intfName1=node1.name + '-' + node2.name,
intfName2=node2.name + '-' + node1.name)


def create_topo(my_net):
Expand Down Expand Up @@ -137,8 +137,8 @@ def stop_all():


def extract_host_pid(dumpline):
temp = dumpline[dumpline.find('pid=')+4:]
return int(temp[:len(temp)-2])
temp = dumpline[dumpline.find('pid=') + 4:]
return int(temp[:len(temp) - 2])


def simple_test():
Expand Down
36 changes: 18 additions & 18 deletions nets-unmantained/8r-1c-out-band-isis/isis8d.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from mininet.util import dumpNodeConnections

# BASEDIR = "/home/user/mytests/ospf3routers/nodeconf/"
BASEDIR = os.getcwd()+"/nodeconf/"
BASEDIR = os.getcwd() + "/nodeconf/"
OUTPUT_PID_TABLE_FILE = "/tmp/pid_table_file.txt"

PRIVDIR = '/var/priv'
Expand Down Expand Up @@ -72,9 +72,9 @@ def config(self, **kwargs):
# first = False
# self.cmd('ip a a %s dev %s' %(kwargs['mgmtip'], intf.name))
# let's write the hostname in /var/mininet/hostname
self.cmd("echo '" + self.name + "' > "+PRIVDIR+"/hostname")
if os.path.isfile(BASEDIR+self.name+"/start.sh"):
self.cmd('source %s' % BASEDIR+self.name+"/start.sh")
self.cmd("echo '" + self.name + "' > " + PRIVDIR + "/hostname")
if os.path.isfile(BASEDIR + self.name + "/start.sh"):
self.cmd('source %s' % BASEDIR + self.name + "/start.sh")

def cleanup(self):
def remove_if_exists(filename):
Expand All @@ -86,13 +86,13 @@ def remove_if_exists(filename):
if os.path.exists(self.dir):
shutil.rmtree(self.dir)

remove_if_exists(BASEDIR+self.name+"/zebra.pid")
remove_if_exists(BASEDIR+self.name+"/zebra.log")
remove_if_exists(BASEDIR+self.name+"/zebra.sock")
remove_if_exists(BASEDIR+self.name+"/isis8d.pid")
remove_if_exists(BASEDIR+self.name+"/isis8d.log")
remove_if_exists(BASEDIR+self.name+"/isisd.log")
remove_if_exists(BASEDIR+self.name+"/isisd.pid")
remove_if_exists(BASEDIR + self.name + "/zebra.pid")
remove_if_exists(BASEDIR + self.name + "/zebra.log")
remove_if_exists(BASEDIR + self.name + "/zebra.sock")
remove_if_exists(BASEDIR + self.name + "/isis8d.pid")
remove_if_exists(BASEDIR + self.name + "/isis8d.log")
remove_if_exists(BASEDIR + self.name + "/isisd.log")
remove_if_exists(BASEDIR + self.name + "/isisd.pid")

remove_if_exists(OUTPUT_PID_TABLE_FILE)

Expand Down Expand Up @@ -152,9 +152,9 @@ def config(self, **kwargs):
# first = False
# self.cmd('ip a a %s dev %s' %(kwargs['mgmtip'], intf.name))
# let's write the hostname in /var/mininet/hostname
self.cmd("echo '" + self.name + "' > "+PRIVDIR+"/hostname")
if os.path.isfile(BASEDIR+self.name+"/start.sh"):
self.cmd('source %s' % BASEDIR+self.name+"/start.sh")
self.cmd("echo '" + self.name + "' > " + PRIVDIR + "/hostname")
if os.path.isfile(BASEDIR + self.name + "/start.sh"):
self.cmd('source %s' % BASEDIR + self.name + "/start.sh")

def cleanup(self):
# def remove_if_exists(filename):
Expand All @@ -170,8 +170,8 @@ def cleanup(self):
# the add_link function creates a link and assigns the interface names
# as node1-node2 and node2-node1
def add_link(my_net, node1, node2):
my_net.addLink(node1, node2, intfName1=node1.name+'-'+node2.name,
intfName2=node2.name+'-'+node1.name)
my_net.addLink(node1, node2, intfName1=node1.name + '-' + node2.name,
intfName2=node2.name + '-' + node1.name)


def create_topo(my_net):
Expand Down Expand Up @@ -310,8 +310,8 @@ def stop_all():


def extract_host_pid(dumpline):
temp = dumpline[dumpline.find('pid=')+4:]
return int(temp[:len(temp)-2])
temp = dumpline[dumpline.find('pid=') + 4:]
return int(temp[:len(temp) - 2])


def simple_test():
Expand Down
Loading

0 comments on commit 7eb3b58

Please sign in to comment.