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
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[run]
parallel = true
omit =
/*/test*
/tests
Expand Down
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: pip
directory: /
schedule:
interval: monthly
commit-message:
prefix: "[deps] "
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
commit-message:
prefix: "[ci] "
20 changes: 20 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Checklist

- [ ] I have read the [OpenWISP Contributing Guidelines](http://openwisp.io/docs/developer/contributing.html).
- [ ] I have manually tested the changes proposed in this pull request.
- [ ] I have written new test cases for new code and/or updated existing tests for changes to existing code.
- [ ] I have updated the documentation.

## Reference to Existing Issue

Closes #<issue-number>.

Please [open a new issue](https://github.com/openwisp/netengine/issues/new/choose) if there isn't an existing issue yet.

## Description of Changes

Please describe these changes.

## Screenshot

Please include any relevant screenshots.
42 changes: 42 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Backport fixes to stable branch

on:
push:
branches:
- master
issue_comment:
types: [created]

concurrency:
group: backport-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

permissions:
contents: write
pull-requests: write

jobs:
backport-on-push:
if: github.event_name == 'push'
uses: openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@master
with:
commit_sha: ${{ github.sha }}
secrets:
app_id: ${{ secrets.OPENWISP_BOT_APP_ID }}
private_key: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }}

backport-on-comment:
if: >
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.issue.pull_request.merged_at != null &&
github.event.issue.state == 'closed' &&
contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) &&
startsWith(github.event.comment.body, '/backport')
uses: openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@master
with:
pr_number: ${{ github.event.issue.number }}
comment_body: ${{ github.event.comment.body }}
secrets:
app_id: ${{ secrets.OPENWISP_BOT_APP_ID }}
private_key: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }}
2 changes: 1 addition & 1 deletion .github/workflows/bot-changelog-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
if echo "$PR_TITLE" | grep -qiE '^\[(feature|fix|change)\]'; then
if echo "$PR_TITLE" | grep -qiE '^\[(feature|fix|change!?)\]'; then
echo "has_noteworthy=true" >> $GITHUB_OUTPUT
fi

Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/bot-ci-failure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CI Failure Bot

on:
workflow_run:
workflows: ["Netengine CI Build"]
types:
- completed

permissions:
pull-requests: read
actions: read
contents: read

concurrency:
group: ci-failure-${{ github.repository }}-${{ github.event.workflow_run.pull_requests[0].number || github.event.workflow_run.head_branch }}
cancel-in-progress: true

jobs:
find-pr:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event == 'pull_request' }}
outputs:
pr_number: ${{ steps.pr.outputs.number }}
pr_author: ${{ steps.pr.outputs.author }}
steps:
- name: Find PR Number
id: pr
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
PR_NUMBER_PAYLOAD: ${{ github.event.workflow_run.pull_requests[0].number }}
EVENT_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
run: |
emit_pr() {
local pr_number="$1"
local pr_author
pr_author=$(gh pr view "$pr_number" --repo "$REPO" --json author --jq '.author.login // empty' 2>/dev/null || echo "")
if [ -z "$pr_author" ] || [ "$pr_author" = "null" ]; then
echo "::warning::Could not fetch PR author for PR #$pr_number"
fi
echo "number=$pr_number" >> "$GITHUB_OUTPUT"
echo "author=$pr_author" >> "$GITHUB_OUTPUT"
}
PR_NUMBER="$PR_NUMBER_PAYLOAD"
if [ -n "$PR_NUMBER" ]; then
echo "Found PR #$PR_NUMBER from workflow payload."
emit_pr "$PR_NUMBER"
exit 0
fi
HEAD_SHA="$EVENT_HEAD_SHA"
echo "Payload empty. Searching for PR via Commits API..."
PR_NUMBER=$(gh api repos/$REPO/commits/$HEAD_SHA/pulls -q '.[0].number' 2>/dev/null || true)
if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then
echo "Found PR #$PR_NUMBER using Commits API."
emit_pr "$PR_NUMBER"
exit 0
fi
echo "API lookup failed/empty. Scanning open PRs for matching head SHA..."
PR_NUMBER=$(gh pr list --repo "$REPO" --state open --limit 100 --json number,headRefOid --jq ".[] | select(.headRefOid == \"$HEAD_SHA\") | .number" | head -n 1)
if [ -n "$PR_NUMBER" ]; then
echo "Found PR #$PR_NUMBER by scanning open PRs."
emit_pr "$PR_NUMBER"
exit 0
fi
echo "::warning::No open PR found. This workflow run might not be attached to an open PR."
exit 0

call-ci-failure-bot:
needs: find-pr
if: ${{ needs.find-pr.outputs.pr_number != '' }}
permissions:
pull-requests: write
actions: write
contents: read
uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-ci-failure.yml@master
with:
pr_number: ${{ needs.find-pr.outputs.pr_number }}
head_sha: ${{ github.event.workflow_run.head_sha }}
head_repo: ${{ github.event.workflow_run.head_repository.full_name }}
base_repo: ${{ github.repository }}
run_id: ${{ github.event.workflow_run.id }}
pr_author: ${{ needs.find-pr.outputs.pr_author }}
actor: ${{ github.event.workflow_run.actor.login }}
secrets:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
APP_ID: ${{ secrets.OPENWISP_BOT_APP_ID }}
PRIVATE_KEY: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }}
81 changes: 41 additions & 40 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

name: Netengine CI Build

on:
Expand All @@ -11,61 +10,63 @@ on:
- master

jobs:

build:
name: Python==${{ matrix.python-version }}
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

strategy:
fail-fast: false
matrix:
python-version:
- 3.6
- 3.7
- 3.8
- 3.9
- "3.10"
- "3.11"
- "3.12"
- "3.13"

steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
**/requirements*.txt

- name: Install Dependencies
id: deps
run: |
pip install -U wheel setuptools
pip install -e .
pip install -U -r requirements-test.txt
- name: Install Dependencies
id: deps
run: |
pip install -U pip wheel setuptools
pip install -U -r requirements-test.txt
pip install -U -e .

- name: Run QA Checks
run: ./run-qa-checks
- name: Run QA Checks
run: ./run-qa-checks

- name: Run tests
if: ${{ !cancelled() && steps.deps.conclusion == 'success' }}
run: coverage run --source=netengine ./runtests.py
- name: Run tests
if: ${{ !cancelled() && steps.deps.conclusion == 'success' }}
run: |
coverage run runtests.py
coverage combine
coverage xml

- name: Upload Coverage
if: ${{ success() }}
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: python-${{ matrix.python-version }}
COVERALLS_PARALLEL: true
- name: Upload Coverage
if: ${{ success() }}
uses: coverallsapp/github-action@v2
with:
parallel: true
format: cobertura
flag-name: python-${{ matrix.python-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}

coveralls:
name: Finish Coveralls
needs: build
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
python3 -m pip install --upgrade coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
13 changes: 13 additions & 0 deletions .github/workflows/version-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Replicate Commits to Version Branch

on:
push:
branches:
- master

jobs:
version-branch:
uses: openwisp/openwisp-utils/.github/workflows/reusable-version-branch.yml@master
with:
module_name: netengine
install_package: true
15 changes: 10 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
=========
netengine
=========

Expand All @@ -13,16 +12,21 @@ netengine
.. image:: https://badge.fury.io/py/netengine.svg
:target: http://badge.fury.io/py/netengine

------------------------------
----

.. image:: https://raw.githubusercontent.com/openwisp/netengine/master/docs/source/images/netengine-logo.png

Abstraction layer for extracting information from network devices.

Documentation: http://netengine.rtfd.org

Supported Python Versions
-------------------------

NetEngine supports Python 3.10, 3.11, 3.12, and 3.13.

Contribute
==========
----------

1. Join the `OpenWISP mailing list`_
2. Fork this repo
Expand All @@ -34,5 +38,6 @@ Contribute
8. Document your changes
9. Send pull request

.. _PEP8, Style Guide for Python Code: http://www.python.org/dev/peps/pep-0008/
.. _OpenWISP mailing list: https://groups.google.com/g/openwisp
.. _openwisp mailing list: https://groups.google.com/g/openwisp

.. _pep8, style guide for python code: http://www.python.org/dev/peps/pep-0008/
Loading
Loading