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: 0 additions & 1 deletion .buildbot/tox-bionic/test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/sh

tox -e lint-basic || exit 1
tox
1 change: 0 additions & 1 deletion .buildbot/tox-jammy/test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/sh

tox -e lint || exit 1
tox -e py310
61 changes: 61 additions & 0 deletions .github/workflows/tox-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Tox Linter Tests

on:
push:
branches: [master, main, v0.6]
pull_request:
branches: [master, main, v0.6]

jobs:
lint:
name: "${{ matrix.tox-env }} / python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
tox-env: [bandit, flake8, pycodestyle, pylint]
python-version: ["2.7", "3.10"]
include:
- python-version: "2.7"
container: "python:2.7-buster"
tox-suffix: "-py27"
- python-version: "3.10"
tox-suffix: ""

steps:
# ── System packages ────────────────────────────────────────
# Container (Python 2): runs as root, needs git for checkout
- name: Install system dependencies (container)
if: matrix.python-version == '2.7'
run: |
sed -i 's|deb.debian.org|archive.debian.org|g' /etc/apt/sources.list
sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list
sed -i '/buster-updates/d' /etc/apt/sources.list
apt-get update -q
apt-get install -qy git libcap-dev

# Host VM (Python 3): git is pre-installed, just need libcap-dev
- name: Install system dependencies
if: matrix.python-version != '2.7'
run: |
sudo apt-get update -q
sudo apt-get install -qy libcap-dev

- name: Checkout repository
uses: actions/checkout@v4

# ── Python 3 ───────────────────────────────────────────────
- name: Set up Python ${{ matrix.python-version }}
if: matrix.python-version != '2.7'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

# ── Common ─────────────────────────────────────────────────
- name: Install tox
run: |
pip install "tox<4" "virtualenv<20.22.0"

- name: Run tox -e ${{ matrix.tox-env }}${{ matrix.tox-suffix }}
run: tox -e ${{ matrix.tox-env }}${{ matrix.tox-suffix }}
80 changes: 80 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,74 @@ deps =
pylint
commands = pylint --rcfile=tox.ini --exit-zero pybitmessage

[testenv:bandit]
skip_install = true
basepython = python3
deps =
bandit
commands =
bandit -r -s B101,B411,B413,B608 \
-x checkdeps.*,bitmessagecurses,bitmessageqt,tests pybitmessage

[testenv:flake8]
skip_install = true
basepython = python3
deps =
flake8
commands =
flake8 --config=tox.ini pybitmessage --count --select=E9,F63,F7,F82 \
--show-source --statistics

[testenv:pylint]
skip_install = true
basepython = python3
deps =
-rrequirements.txt
pylint
commands = pylint --rcfile=tox.ini --exit-zero pybitmessage

[testenv:pycodestyle]
skip_install = true
basepython = python3
deps =
pycodestyle
commands =
- pycodestyle --config=tox.ini pybitmessage

[testenv:bandit-py27]
skip_install = true
basepython = python2.7
deps =
bandit<1.7.0
commands =
bandit -r -s B101,B411,B413,B603,B608 \
-x checkdeps.*,bitmessagecurses,bitmessageqt,tests pybitmessage

[testenv:flake8-py27]
skip_install = true
basepython = python2.7
deps =
flake8<4.0.0
commands =
flake8 --config=tox.ini pybitmessage --count --select=E9,F63,F7,F82 \
--show-source --statistics

[testenv:pycodestyle-py27]
skip_install = true
basepython = python2.7
deps =
pycodestyle<2.6.0
commands =
pycodestyle --config=tox.ini pybitmessage

[testenv:pylint-py27]
skip_install = true
basepython = python2.7
deps =
-rrequirements.txt
pylint<2.0.0
commands = pylint --rcfile=tox.ini --exit-zero pybitmessage

[testenv:py27]
sitepackages = true

Expand Down Expand Up @@ -79,6 +147,18 @@ omit =
[coverage:report]
ignore_errors = true

[pycodestyle]
max-line-length = 119
ignore = E402,E722,W503

[flake8]
max-line-length = 119
exclude = bitmessagecli.py,bitmessagecurses,bitmessageqt,plugins,tests,umsgpack
ignore = E722,F841,W503
# E722: pylint is preferred for bare-except
# F841: pylint is preferred for unused-variable
# W503: deprecated: https://bugs.python.org/issue26763 - https://www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator

[pylint.main]
disable =
invalid-name,consider-using-f-string,fixme,raise-missing-from,
Expand Down
Loading