Skip to content

Update tox-lint action for gitea compatibility #9

Update tox-lint action for gitea compatibility

Update tox-lint action for gitea compatibility #9

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
# actions/checkout needs Node.js which isn't available in the
# buster container on Gitea runners — use a plain git clone there
- name: Checkout repository
if: matrix.python-version != '2.7'
uses: actions/checkout@v4
- name: Checkout repository (container)
if: matrix.python-version == '2.7'
env:
TOKEN: ${{ github.token }}
run: |
git config --global --add safe.directory "$PWD"
git init
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
git -c "http.extraHeader=Authorization: token ${TOKEN}" \
fetch --depth 1 origin "${GITHUB_SHA}"
git checkout FETCH_HEAD
# ── 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 }}