Skip to content

ci: only publish the Docker image from master #3

ci: only publish the Docker image from master

ci: only publish the Docker image from master #3

Workflow file for this run

name: test
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install ruff
run: pip install ruff
- name: Ruff (fail only on real errors, not style)
# E9=syntax, F63=invalid comparisons, F7=misplaced statements,
# F82=undefined names. Style/formatting is intentionally not enforced.
run: ruff check --select E9,F63,F7,F82 --exclude examples --target-version py310 --output-format github .
smoke:
name: smoke (py${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# 3.10+ only: solarcam.py uses a match statement.
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install package
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Byte-compile all sources (excluding examples)
run: python -m compileall -q $(git ls-files '*.py' | grep -v '^examples/')
- name: Import smoke test
run: python -c "import dvrip, asyncio_dvrip; print('import OK')"
- name: dvrip and asyncio_dvrip must keep identical return codes
# Enforces the repo convention: new codes go into CODES/OK_CODES in
# BOTH clients (see CLAUDE.md).
run: |
python - <<'PY'
import dvrip, asyncio_dvrip
s, a = dvrip.DVRIPCam, asyncio_dvrip.DVRIPCam
assert s.CODES == a.CODES, "CODES drift between dvrip.py and asyncio_dvrip.py"
assert s.OK_CODES == a.OK_CODES, "OK_CODES drift between dvrip.py and asyncio_dvrip.py"
print("return-code tables in sync:", len(s.CODES), "codes, OK_CODES", s.OK_CODES)
PY