0fb9cf1782
refresh-image-locks / refresh (push) Successful in 25s
lint / lint (push) Successful in 1m5s
prd-number-check / require-numbered-prds (pull_request) Successful in 10s
tracker-policy-pr / check-pr (pull_request) Successful in 12s
test / image-input-builds (pull_request) Successful in 20s
test / integration-docker (pull_request) Successful in 1m10s
test / unit (pull_request) Successful in 2m17s
test / coverage (pull_request) Successful in 23s
55 lines
1.8 KiB
YAML
55 lines
1.8 KiB
YAML
name: lint
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- "**.py"
|
|
- "Dockerfile*"
|
|
- "bot_bottle/contrib/*/Dockerfile"
|
|
- "bot_bottle/contrib/*/package.json"
|
|
- "bot_bottle/contrib/*/package-lock.json"
|
|
- "bot_bottle/contrib/codex/install.sh.sha256"
|
|
- "requirements.gateway.*"
|
|
- "image-build-args.json"
|
|
- ".pylintrc"
|
|
- ".gitea/workflows/lint.yml"
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Enforce immutable image inputs
|
|
run: python3 scripts/check_image_inputs.py
|
|
|
|
# No actions/setup-python: the runner image already ships Python 3.12,
|
|
# and older act_runner engines mishandle setup-python's PATH. Install
|
|
# into the ephemeral job container's system Python — the pylint/pyright
|
|
# console scripts land on /usr/local/bin (on PATH) so the steps below
|
|
# still resolve. --break-system-packages is safe: the container is
|
|
# disposable.
|
|
- name: Install dev dependencies
|
|
run: python3 -m pip install --break-system-packages -r requirements-dev.txt
|
|
|
|
- name: Run pylint
|
|
run: |
|
|
# Pylint's normal exit code is nonzero for any emitted finding,
|
|
# regardless of --fail-under. Preserve the full report but enforce
|
|
# the aggregate score this workflow promises.
|
|
set +e
|
|
find . -name '*.py' -not -path './.venv/*' -not -path './.git/*' \
|
|
| xargs pylint --fail-under=8.0 \
|
|
| tee /tmp/pylint-output.txt
|
|
set -e
|
|
SCORE=$(sed -n \
|
|
's/^Your code has been rated at \([-0-9.]*\)\/10.*/\1/p' \
|
|
/tmp/pylint-output.txt | tail -1)
|
|
test -n "$SCORE"
|
|
awk -v score="$SCORE" 'BEGIN { exit !(score >= 8.0) }'
|
|
|
|
- name: Run pyright
|
|
run: |
|
|
# Run pyright type checking
|
|
pyright .
|