Skip to content

Commit 7eb3b58

Browse files
authored
Merge pull request #27 from netgroup/add-more-github-actions
Add several GitHub actions
2 parents 37d2c3b + 9717330 commit 7eb3b58

File tree

12 files changed

+253
-94
lines changed

12 files changed

+253
-94
lines changed

.github/label-pr.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
- regExp: ".*\\.ts+$"
2+
labels: ["typescript"]
3+
- regExp: ".*\\.sql+$"
4+
labels: ["database", "critical"]
5+
- regExp: ".*/docs/"
6+
labels: ["documentation"]
7+
- regExp: ".*\\.png+$"
8+
labels: ["images"]
9+
- regExp: "^(pom\\.xml|package\\.json|build\\.gradle)$"
10+
labels: ["dependencies"]
11+
- regExp: ".*/requirements.txt"
12+
labels: ["dependencies"]
13+
- regExp: ".*\\.(zip|jar|war|ear)+$"
14+
labels: ["artifact", "invalid"]
15+
- regExp: ".*/setup.py"
16+
labels: ["build"]
17+
- regExp: "^.github/"
18+
labels: ["github-workflow"]
19+
- regExp: "^nets/8r-1c-in-band-isis/"
20+
labels: ["topology/8r-1c-in-band-isis"]
21+
- regExp: "^nets/8routers-isis-ipv6/"
22+
labels: ["topology/8routers-isis-ipv6"]
23+
- regExp: "^nets-unmantained/8r-1c-out-band-isis/"
24+
labels: ["topology/8r-1c-out-band-isis"]
25+
- regExp: "^nets-unmantained/3routers/"
26+
labels: ["topology/3routers"]
27+
- regExp: "^nets-unmantained/8routers/"
28+
labels: ["topology/8routers"]
29+
- regExp: "^nets-in-progress/8r-1c-srv6-pm/"
30+
labels: ["topology/8r-1c-srv6-pm"]
31+
- regExp: ".*/.env"
32+
labels: ["configuration"]

.github/pr-labeler.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
feature: ['feature/*', 'feat/*', 'feature-*', 'feat-*']
2+
bug: ['fix/*', 'fix-*']
3+
chore: ['chore/*', 'chore-*']

.github/release-drafter.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name-template: 'v$RESOLVED_VERSION 🌈'
2+
tag-template: 'v$RESOLVED_VERSION'
3+
categories:
4+
- title: '🚀 Features'
5+
labels:
6+
- 'feature'
7+
- 'enhancement'
8+
- title: '🐛 Bug Fixes'
9+
labels:
10+
- 'fix'
11+
- 'bugfix'
12+
- 'bug'
13+
- title: '🧰 Maintenance'
14+
label: 'chore'
15+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
16+
version-resolver:
17+
major:
18+
labels:
19+
- 'major'
20+
minor:
21+
labels:
22+
- 'minor'
23+
- 'feature'
24+
- 'enhancement'
25+
patch:
26+
labels:
27+
- 'patch'
28+
- 'fix'
29+
- 'bugfix'
30+
- 'bug'
31+
default: patch
32+
exclude-labels:
33+
- 'skip-changelog'
34+
template: |
35+
## Changes
36+
$CHANGES

.github/workflows/autopep8.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: autopep8
2+
on: pull_request
3+
jobs:
4+
autopep8:
5+
# Check if the PR is not raised by this workflow and is not from a fork
6+
if: startsWith(github.head_ref, 'autopep8-patches') == false && github.event.pull_request.head.repo.full_name == github.repository
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Set up Python 3
10+
uses: actions/setup-python@v2
11+
with:
12+
python-version: 3
13+
- name: Checkout Code
14+
uses: actions/checkout@v2
15+
with:
16+
ref: ${{ github.head_ref }}
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install setuptools wheel flake8 pytest
21+
- name: autopep8
22+
id: autopep8
23+
uses: peter-evans/autopep8@v1
24+
with:
25+
args: --exit-code --recursive --in-place --aggressive --aggressive .
26+
- name: Set autopep8 branch name
27+
id: vars
28+
run: echo ::set-output name=branch-name::"autopep8-patches/$GITHUB_HEAD_REF"
29+
- name: Create Pull Request
30+
if: steps.autopep8.outputs.exit-code == 2
31+
uses: peter-evans/create-pull-request@v2
32+
with:
33+
commit-message: autopep8 action fixes
34+
committer: Carmine Scarpitta <[email protected]>
35+
title: Fixes by autopep8 action
36+
body: This is an auto-generated PR with fixes by autopep8.
37+
labels: autopep8, automated pr
38+
reviewers: cscarpitta
39+
branch: ${{ steps.vars.outputs.branch-name }}
40+
- name: Fail if autopep8 made changes
41+
if: steps.autopep8.outputs.exit-code == 2
42+
run: exit 1

.github/workflows/pr_labeler.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Workflow to associate labels automatically
2+
name: labeler
3+
4+
# Trigger the workflow on pull request events
5+
on: [pull_request]
6+
7+
jobs:
8+
label:
9+
runs-on: ubuntu-latest
10+
steps:
11+
# We need to checkout the repository to access the configured file (.github/label-pr.yml)
12+
- uses: actions/checkout@v2
13+
- name: Labeler
14+
uses: docker://decathlon/pull-request-labeler-action:2.0.0
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
# Here we can override the path for the action configuration. If none is provided, default one is `.github/label-pr.yml`
18+
# CONFIG_PATH: ${{ secrets.GITHUB_WORKSPACE }}/.github/label-pr.yml
19+
20+
pr-labeler:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: TimonVS/pr-labeler-action@v3
24+
# with:
25+
# configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-drafter.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
# branches to consider in the event; optional, defaults to all
6+
branches:
7+
- master
8+
9+
jobs:
10+
update_release_draft:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# Drafts your next Release notes as Pull Requests are merged into "master"
14+
- uses: release-drafter/release-drafter@v5
15+
# with:
16+
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
17+
# config-name: my-config.yml
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

nets-in-progress/8r-1c-srv6-pm/isis8d.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from mininet.util import dumpNodeConnections
2121

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

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

7979
def cleanup(self):
8080
def remove_if_exists(filename):
@@ -86,13 +86,13 @@ def remove_if_exists(filename):
8686
if os.path.exists(self.dir):
8787
shutil.rmtree(self.dir)
8888

89-
remove_if_exists(BASEDIR+self.name+"/zebra.pid")
90-
remove_if_exists(BASEDIR+self.name+"/zebra.log")
91-
remove_if_exists(BASEDIR+self.name+"/zebra.sock")
92-
remove_if_exists(BASEDIR+self.name+"/isis8d.pid")
93-
remove_if_exists(BASEDIR+self.name+"/isis8d.log")
94-
remove_if_exists(BASEDIR+self.name+"/isisd.log")
95-
remove_if_exists(BASEDIR+self.name+"/isisd.pid")
89+
remove_if_exists(BASEDIR + self.name + "/zebra.pid")
90+
remove_if_exists(BASEDIR + self.name + "/zebra.log")
91+
remove_if_exists(BASEDIR + self.name + "/zebra.sock")
92+
remove_if_exists(BASEDIR + self.name + "/isis8d.pid")
93+
remove_if_exists(BASEDIR + self.name + "/isis8d.log")
94+
remove_if_exists(BASEDIR + self.name + "/isisd.log")
95+
remove_if_exists(BASEDIR + self.name + "/isisd.pid")
9696

9797
remove_if_exists(OUTPUT_PID_TABLE_FILE)
9898

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

160160
def cleanup(self):
161161
# def remove_if_exists(filename):
@@ -171,8 +171,8 @@ def cleanup(self):
171171
# the add_link function creates a link and assigns the interface names
172172
# as node1-node2 and node2-node1
173173
def add_link(my_net, node1, node2):
174-
my_net.addLink(node1, node2, intfName1=node1.name+'-'+node2.name,
175-
intfName2=node2.name+'-'+node1.name)
174+
my_net.addLink(node1, node2, intfName1=node1.name + '-' + node2.name,
175+
intfName2=node2.name + '-' + node1.name)
176176

177177

178178
def create_topo(my_net):
@@ -311,8 +311,8 @@ def stop_all():
311311

312312

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

317317

318318
def simple_test():

nets-unmantained/3routers/ospf3r.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from mininet.util import dumpNodeConnections
1717

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

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

5454
def cleanup(self):
5555
def remove_if_exists(filename):
@@ -61,11 +61,11 @@ def remove_if_exists(filename):
6161
if os.path.exists(self.dir):
6262
shutil.rmtree(self.dir)
6363

64-
remove_if_exists(BASEDIR+self.name+"/zebra.pid")
65-
remove_if_exists(BASEDIR+self.name+"/zebra.log")
66-
remove_if_exists(BASEDIR+self.name+"/zebra.sock")
67-
remove_if_exists(BASEDIR+self.name+"/ospfd.pid")
68-
remove_if_exists(BASEDIR+self.name+"/ospfd.log")
64+
remove_if_exists(BASEDIR + self.name + "/zebra.pid")
65+
remove_if_exists(BASEDIR + self.name + "/zebra.log")
66+
remove_if_exists(BASEDIR + self.name + "/zebra.sock")
67+
remove_if_exists(BASEDIR + self.name + "/ospfd.pid")
68+
remove_if_exists(BASEDIR + self.name + "/ospfd.log")
6969
remove_if_exists(OUTPUT_PID_TABLE_FILE)
7070

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

9797

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

102102

103103
def create_topo(my_net):
@@ -137,8 +137,8 @@ def stop_all():
137137

138138

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

143143

144144
def simple_test():

nets-unmantained/8r-1c-out-band-isis/isis8d.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from mininet.util import dumpNodeConnections
2121

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

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

7979
def cleanup(self):
8080
def remove_if_exists(filename):
@@ -86,13 +86,13 @@ def remove_if_exists(filename):
8686
if os.path.exists(self.dir):
8787
shutil.rmtree(self.dir)
8888

89-
remove_if_exists(BASEDIR+self.name+"/zebra.pid")
90-
remove_if_exists(BASEDIR+self.name+"/zebra.log")
91-
remove_if_exists(BASEDIR+self.name+"/zebra.sock")
92-
remove_if_exists(BASEDIR+self.name+"/isis8d.pid")
93-
remove_if_exists(BASEDIR+self.name+"/isis8d.log")
94-
remove_if_exists(BASEDIR+self.name+"/isisd.log")
95-
remove_if_exists(BASEDIR+self.name+"/isisd.pid")
89+
remove_if_exists(BASEDIR + self.name + "/zebra.pid")
90+
remove_if_exists(BASEDIR + self.name + "/zebra.log")
91+
remove_if_exists(BASEDIR + self.name + "/zebra.sock")
92+
remove_if_exists(BASEDIR + self.name + "/isis8d.pid")
93+
remove_if_exists(BASEDIR + self.name + "/isis8d.log")
94+
remove_if_exists(BASEDIR + self.name + "/isisd.log")
95+
remove_if_exists(BASEDIR + self.name + "/isisd.pid")
9696

9797
remove_if_exists(OUTPUT_PID_TABLE_FILE)
9898

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

159159
def cleanup(self):
160160
# def remove_if_exists(filename):
@@ -170,8 +170,8 @@ def cleanup(self):
170170
# the add_link function creates a link and assigns the interface names
171171
# as node1-node2 and node2-node1
172172
def add_link(my_net, node1, node2):
173-
my_net.addLink(node1, node2, intfName1=node1.name+'-'+node2.name,
174-
intfName2=node2.name+'-'+node1.name)
173+
my_net.addLink(node1, node2, intfName1=node1.name + '-' + node2.name,
174+
intfName2=node2.name + '-' + node1.name)
175175

176176

177177
def create_topo(my_net):
@@ -310,8 +310,8 @@ def stop_all():
310310

311311

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

316316

317317
def simple_test():

0 commit comments

Comments
 (0)