Skip to content

Add lint action

Add lint action #8

Workflow file for this run

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 }}