add container-based linting workflow using Forgejo Container Registry
Some checks failed
Build Deb-Mock Package / build (push) Successful in 1m36s
Lint Code / Lint All Code (push) Failing after 2s
Test Deb-Mock Build / test (push) Failing after 49s

This commit is contained in:
robojerk 2025-08-04 03:13:13 +00:00
parent 508a9beec9
commit c33e3aa9ac
2 changed files with 24 additions and 84 deletions

View file

@ -8,9 +8,11 @@ on:
workflow_dispatch:
jobs:
yaml-lint:
name: Lint YAML Files
lint-all:
name: Lint All Code
runs-on: ubuntu-latest
container:
image: git.raines.xyz/robojerk/deb-mock-linter:latest
steps:
- name: Checkout code
run: |
@ -18,47 +20,16 @@ jobs:
cp -r /tmp/deb-mock/* .
cp -r /tmp/deb-mock/.* . 2>/dev/null || true
- name: Install yamllint
run: |
sudo apt update
sudo apt install -y yamllint
- name: Lint YAML files
run: |
echo "=== Linting YAML files ==="
yamllint .forgejo/workflows/ deb_mock/configs/ test-config.yaml
echo "✅ YAML linting completed successfully"
python-lint:
name: Lint Python Code
runs-on: ubuntu-latest
steps:
- name: Checkout code
run: |
git clone https://git.raines.xyz/robojerk/deb-mock.git /tmp/deb-mock
cp -r /tmp/deb-mock/* .
cp -r /tmp/deb-mock/.* . 2>/dev/null || true
- name: Set up Python
run: |
sudo apt update
sudo apt install -y python3.12 python3.12-venv python3-pip
- name: Set up virtual environment
run: |
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
- name: Install Python linters
run: |
source venv/bin/activate
pip install flake8 black isort bandit
- name: Lint Python files
run: |
source venv/bin/activate
echo "=== Linting Python files ==="
source /opt/venv/bin/activate
echo "Running flake8..."
flake8 deb_mock/ tests/ --max-line-length=120 --ignore=E203,W503
echo "Running black check..."
@ -68,42 +39,12 @@ jobs:
echo "Running bandit security check..."
bandit -r deb_mock/ -f json -o bandit-report.json || true
echo "✅ Python linting completed successfully"
shell-lint:
name: Lint Shell Scripts
runs-on: ubuntu-latest
steps:
- name: Checkout code
run: |
git clone https://git.raines.xyz/robojerk/deb-mock.git /tmp/deb-mock
cp -r /tmp/deb-mock/* .
cp -r /tmp/deb-mock/.* . 2>/dev/null || true
- name: Install shellcheck
run: |
sudo apt update
sudo apt install -y shellcheck
- name: Lint shell scripts
run: |
echo "=== Linting shell scripts ==="
find . -name "*.sh" -exec shellcheck {} \;
echo "✅ Shell linting completed successfully"
debian-lint:
name: Lint Debian Files
runs-on: ubuntu-latest
steps:
- name: Checkout code
run: |
git clone https://git.raines.xyz/robojerk/deb-mock.git /tmp/deb-mock
cp -r /tmp/deb-mock/* .
cp -r /tmp/deb-mock/.* . 2>/dev/null || true
- name: Install Debian linting tools
run: |
sudo apt update
sudo apt install -y lintian devscripts
- name: Lint Debian files
run: |
@ -113,22 +54,6 @@ jobs:
echo "Checking debian/control..."
lintian --check debian/control || echo "Note: lintian check completed"
echo "✅ Debian linting completed successfully"
markdown-lint:
name: Lint Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
run: |
git clone https://git.raines.xyz/robojerk/deb-mock.git /tmp/deb-mock
cp -r /tmp/deb-mock/* .
cp -r /tmp/deb-mock/.* . 2>/dev/null || true
- name: Install markdownlint
run: |
sudo apt update
sudo apt install -y nodejs npm
sudo npm install -g markdownlint-cli
- name: Lint documentation
run: |

View file

@ -20,10 +20,24 @@ test-coverage: ## Run tests with coverage
python -m pytest tests/ --cov=deb_mock --cov-report=html --cov-report=term
lint: ## Run linting checks
@echo "=== Running all linting checks with Docker container ==="
docker run --rm -v $(PWD):/app git.raines.xyz/robojerk/deb-mock-linter:latest /bin/bash -c "\
echo '=== Linting YAML files ===' && \
yamllint .forgejo/workflows/ deb_mock/configs/ test-config.yaml && \
echo '=== Linting Python files ===' && \
source /opt/venv/bin/activate && \
flake8 deb_mock/ tests/ --max-line-length=120 --ignore=E203,W503 && \
black --check --line-length=120 deb_mock/ tests/ && \
isort --check-only --profile=black deb_mock/ tests/ && \
echo '=== Linting shell scripts ===' && \
find . -name '*.sh' -exec shellcheck {} \; && \
echo '✅ All linting checks passed!'"
lint-local: ## Run linting checks locally (requires tools installed)
@echo "=== Running Python linting ==="
flake8 deb_mock/ tests/ --max-line-length=120 --ignore=E203,W503
black --check --line-length=120 deb_mock/ tests/
isort --check-only --profile=black deb_mock/ tests/
venv/bin/flake8 deb_mock/ tests/ --max-line-length=120 --ignore=E203,W503
venv/bin/black --check --line-length=120 deb_mock/ tests/
venv/bin/isort --check-only --profile=black deb_mock/ tests/
@echo "=== Running YAML linting ==="
yamllint .forgejo/workflows/ deb_mock/configs/ test-config.yaml
@echo "=== Running shell linting ==="
@ -50,7 +64,8 @@ install-system-deps: ## Install system dependencies (requires sudo)
sudo apt install -y sbuild schroot debhelper build-essential debootstrap yamllint shellcheck
install-lint-deps: ## Install linting dependencies
pip install flake8 black isort bandit
python3 -m venv venv
venv/bin/pip install flake8 black isort bandit
sudo apt install -y yamllint shellcheck nodejs npm
sudo npm install -g markdownlint-cli