From 2bda4e311d21fc91d3a24a99aa776a7d8a718496 Mon Sep 17 00:00:00 2001 From: migatu Date: Sat, 18 Jul 2026 14:02:37 +0200 Subject: [PATCH 1/3] =?UTF-8?q?CI:=20uruchamianie=20test=C3=B3w=20przy=20k?= =?UTF-8?q?a=C5=BCdym=20pushu=20(GitHub=20Actions)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .github/workflows/tests.yml: - job "Testy warstwy logicznej": Python 3.12 (jak w obrazach Dockera), instalacja requirements-dev, pytest na services/logic/tests. Cache pip oraz cache jądra efemeryd JPL (de421.bsp ~17 MB), by nie pobierać go co run. - job "Kontrola składni": compileall na wszystkich warstwach (bez instalowania zależności, w tym AGPL-owego silnika swisseph). - Triggery: każdy push (dowolna gałąź) + pull requesty do master. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/tests.yml | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..0592701 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,51 @@ +name: Testy + +# Odpala się przy każdym pushu (dowolna gałąź) oraz dla pull requestów do master. +on: + push: + pull_request: + branches: [master] + +jobs: + logic-tests: + name: Testy warstwy logicznej (silnik) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Python 3.12 (jak w obrazach Dockera) + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + cache-dependency-path: services/logic/requirements-dev.txt + + # Jądro efemeryd JPL (de421.bsp, ~17 MB) pobiera Skyfield przy pierwszym + # użyciu. Cache'ujemy je, żeby nie ściągać przy każdym uruchomieniu. + - name: Cache jądra efemeryd + uses: actions/cache@v4 + with: + path: services/logic/.ephemeris + key: ephemeris-de421 + + - name: Instalacja zależności + run: pip install -r services/logic/requirements-dev.txt + + - name: Testy (pytest) + working-directory: services/logic + env: + PYTHONPATH: . + run: pytest tests -q + + compile-all: + name: Kontrola składni wszystkich warstw + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + # Sam kompilator — bez instalowania zależności warstw (w tym AGPL-owego + # silnika swisseph, który nie wchodzi do produktu). + - name: py_compile + run: python -m compileall -q services -- 2.52.0 From b28c612bf7106f72fed502b08f4ebe9ebd4921a4 Mon Sep 17 00:00:00 2001 From: migatu Date: Sat, 18 Jul 2026 14:47:50 +0200 Subject: [PATCH 2/3] =?UTF-8?q?CI:=20jawne=20pobranie=20j=C4=85dra=20efeme?= =?UTF-8?q?ryd=20+=20brak=20silnika=20=3D=20b=C5=82=C4=85d=20zamiast=20pom?= =?UTF-8?q?ijania?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pierwszy run CI dał 59 passed / 20 skipped zamiast 78/1: auto-pobranie jądra przez Skyfield nie powiodło się na runnerze, więc testy referencyjne (walidacja względem astro.com) cicho znikały. - workflow: jawne pobranie de421.bsp curlem z ssd.jpl.nasa.gov (naif zwraca 404), z retry; EPHEMERIS_DIR wskazany explicite; pytest z -rs (widoczne powody skipów). - conftest: gdy CI=true, niedostępny silnik kończy się pytest.fail zamiast skip — żeby utrata pokrycia nigdy więcej nie przeszła niezauważona. Lokalnie (dev bez pobranego jądra) nadal łagodny skip. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/tests.yml | 20 +++++++++++++++++--- services/logic/tests/conftest.py | 5 +++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0592701..54c3bd2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,22 +20,36 @@ jobs: cache: pip cache-dependency-path: services/logic/requirements-dev.txt - # Jądro efemeryd JPL (de421.bsp, ~17 MB) pobiera Skyfield przy pierwszym - # użyciu. Cache'ujemy je, żeby nie ściągać przy każdym uruchomieniu. + # Jądro efemeryd JPL (de421.bsp, ~17 MB). Cache'ujemy je między runami. - name: Cache jądra efemeryd uses: actions/cache@v4 with: path: services/logic/.ephemeris key: ephemeris-de421 + # Pobieramy jawnie (a nie licząc na auto-pobranie przez Skyfield), żeby + # brak jądra był twardym błędem, a nie cichym pomijaniem testów. + - name: Pobierz jądro efemeryd (gdy brak w cache) + run: | + mkdir -p services/logic/.ephemeris + if [ ! -s services/logic/.ephemeris/de421.bsp ]; then + curl -fSL --retry 3 --max-time 300 \ + -o services/logic/.ephemeris/de421.bsp \ + https://ssd.jpl.nasa.gov/ftp/eph/planets/bsp/de421.bsp + fi + ls -lh services/logic/.ephemeris/de421.bsp + - name: Instalacja zależności run: pip install -r services/logic/requirements-dev.txt + # CI=true (ustawiane przez GitHub) sprawia, że brak silnika = błąd, + # a nie pominięcie — patrz tests/conftest.py. - name: Testy (pytest) working-directory: services/logic env: PYTHONPATH: . - run: pytest tests -q + EPHEMERIS_DIR: ${{ github.workspace }}/services/logic/.ephemeris + run: pytest tests -q -rs compile-all: name: Kontrola składni wszystkich warstw diff --git a/services/logic/tests/conftest.py b/services/logic/tests/conftest.py index 627c59b..f6a6b88 100644 --- a/services/logic/tests/conftest.py +++ b/services/logic/tests/conftest.py @@ -7,6 +7,7 @@ służą jako wyrocznia (LOG-25). from __future__ import annotations import datetime as dt +import os import pytest @@ -28,4 +29,8 @@ def own_engine(): try: return SkyfieldEngine() except Exception as e: # brak efemeryd / brak sieci + # Lokalnie pomijamy (dev bez pobranego jądra), ale w CI to musi być błąd — + # inaczej testy referencyjne (walidacja względem astro.com) cicho znikają. + if os.getenv("CI"): + pytest.fail(f"CI: silnik efemeryd niedostępny — testy referencyjne muszą działać: {e}") pytest.skip(f"Nie można wczytać efemeryd: {e}") -- 2.52.0 From 88a1ecd3c4a2d78370f8a6c3727411da7dd3df84 Mon Sep 17 00:00:00 2001 From: migatu Date: Sat, 18 Jul 2026 18:04:16 +0200 Subject: [PATCH 3/3] test akcji --- test | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test diff --git a/test b/test new file mode 100644 index 0000000..e69de29 -- 2.52.0