From 9c8384b10cc9898525be71dac1c3848e07a22fcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Tuszowski?= Date: Mon, 29 Jun 2026 12:27:32 +0200 Subject: [PATCH] Ci/test workflows (#15) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci: replace broken default workflows with compile/unit/integration CI The two scaffold workflows (Python application / Python package) failed on every PR: they installed deps from a non-existent requirements.txt, ran flake8/pytest over the vendored yt_dlp fork (new syntax under the 3.8/3.9 matrix), and collected ad-hoc root scripts — notably test_ai.py, which is an invalid pasted object dump (not Python). - Remove python-app.yml / python-package.yml and the junk root scripts (test.py, test_ai.py, test_time.py) - Add .github/workflows/ci.yml with three PR-check jobs: * compile — py_compile every first-party .py (no deps) * unit — pytest on pure logic (conanjurer_functions, constants) * integration — boot the Flask services and assert the X-Conjurer-Api-Key auth contract (communication_subroutine + conjurer_musician) - Add tests/ suite, pytest.ini (testpaths=tests) and conftest.py (sys.path) Fixes surfaced by the compile gate / needed for the integration job: - conjurer_librarian/search_bot.py + search_bot2.py: f-string reused the same quote ({item["exists"]}) -> SyntaxError on Python < 3.12 - conjurer_musician/media_search_functions.py: made import-safe (env-overridable paths, lazy DB load / mkdir) so the service can be imported and tested off the Pi Co-Authored-By: Claude Opus 4.8 * ci: make workflow ASCII-clean to fix startup_failure The em-dash characters in the job comments tripped the workflow validator (startup_failure, 0s). Rewrite ci.yml with plain ASCII and simpler comments. Co-Authored-By: Claude Opus 4.8 * ci: minimal workflow to isolate startup_failure * ci: restore full compile/unit/integration workflow The minimal echo workflow was only to isolate the failure: it confirmed that *every* Actions run in this repo ends in startup_failure (0s), including a trivial echo job. The cause is account/repo-level (Actions minutes/billing on a private free-plan repo), not the workflow file. Restoring the real 3-job CI so it runs once Actions is unblocked. Co-Authored-By: Claude Opus 4.8 --------- Co-authored-by: Michal Tuszowski Co-authored-by: Claude Opus 4.8 --- .github/workflows/ci.yml | 47 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 898bdfa..923e678 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,54 @@ name: CI + on: push: branches: ["main"] pull_request: branches: ["main"] + +permissions: + contents: read + jobs: - hello: + compile: + # Byte-compile every first-party .py to catch syntax errors. No deps. runs-on: ubuntu-latest steps: - - run: echo "hello" + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: py_compile first-party sources + run: | + git ls-files '*.py' | grep -vE '^(yt_dlp|spotify_dl)/' | xargs python -m py_compile + echo "All first-party sources compile." + + unit: + # Pure-logic tests; tested modules guard heavy deps, so only pytest needed. + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install test deps + run: | + python -m pip install --upgrade pip + pip install pytest + - name: Run unit tests + run: pytest tests/unit -v + + integration: + # Boot the Flask services and assert the X-Conjurer-Api-Key auth contract. + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install service deps + run: | + python -m pip install --upgrade pip + pip install pytest flask waitress requests + - name: Run integration tests + run: pytest tests/integration -v