Skip to content

Commit 771ce96

Browse files
committed
add CI
1 parent 44f53a4 commit 771ce96

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

.github/workflows/runpyci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# SPDX-License-Identifier: 0BSD
2+
# last update: 2026-01-07
3+
# https://github.com/hannob/codingstyle
4+
---
5+
name: runpyci
6+
"on":
7+
- pull_request
8+
- push
9+
10+
jobs:
11+
build:
12+
strategy:
13+
matrix:
14+
python-version: [3.12, 3.x]
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v6
18+
- name: Set up Python ${{ matrix.python-version }} ${{ matrix.os }}
19+
uses: actions/setup-python@v6
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
- name: Install dependencies and linters
23+
run: |
24+
[ -e requirements.txt ] && pip install -r requirements.txt
25+
pip install pycodestyle pyupgrade pyflakes dlint pylint ruff
26+
- name: Run tests
27+
env:
28+
RUN_ONLINETESTS: 1
29+
run: |
30+
./runpyci.sh

runpyci.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: 0BSD
3+
# last update: 2025-11-24
4+
# https://github.com/hannob/codingstyle
5+
set -euo pipefail
6+
7+
PYLINTIG="consider-using-with,design,fixme,invalid-name,missing-docstring,modified-iterating-list,no-member,possibly-used-before-assignment,protected-access,too-many-lines,unused-argument,broad-exception-caught,c-extension-no-member,duplicate-code,global-statement,global-variable-not-assigned,import-error,import-outside-toplevel,inconsistent-return-statements,redefined-outer-name,unspecified-encoding"
8+
RUFFIG="ANN,C90,D,FIX001,FIX002,ICN001,PLR0911,PLR0912,PLR0913,PLR0915,PTH,S314,S501,S603,SLF001,T201,TD002,TD003,B008,BLE001,COM812,FBT002,I001,N802,N806,PERF203,PERF401,PLC0415,PLR2004,PLW0602,PLW0603,PT009,RET505,RUF100,S202,S310,S607,S608,SIM102,SIM105,SIM108,SIM113,SIM114,SIM115,TD001,TD004,TRY300"
9+
10+
pyfind=$(find -name \*.py)
11+
pygrep=$(grep -rl --exclude-dir=.ruff_cache '^#!/usr/bin/python\|^#!/usr/bin/env python' . || true)
12+
pyfiles=$(echo "$pyfind" "$pygrep" | sort -u)
13+
14+
pycodestyle --max-line-length=100 --ignore=W503,E203 $pyfiles
15+
pyupgrade --py313-plus $pyfiles
16+
pyflakes $pyfiles
17+
flake8 --select=DUO --ignore=DUO107,DUO123,DUO131 $pyfiles
18+
isort --line-length=100 --diff --check-only .
19+
pylint --disable=$PYLINTIG $pyfiles
20+
ruff check --line-length=100 --select=ALL --ignore=$RUFFIG $pyfiles
21+
22+
if [ -d tests ]; then
23+
python -m unittest -v
24+
fi

0 commit comments

Comments
 (0)