Ci/github actions #1
@@ -20,22 +20,36 @@ jobs:
|
|||||||
cache: pip
|
cache: pip
|
||||||
cache-dependency-path: services/logic/requirements-dev.txt
|
cache-dependency-path: services/logic/requirements-dev.txt
|
||||||
|
|
||||||
# Jądro efemeryd JPL (de421.bsp, ~17 MB) pobiera Skyfield przy pierwszym
|
# Jądro efemeryd JPL (de421.bsp, ~17 MB). Cache'ujemy je między runami.
|
||||||
# użyciu. Cache'ujemy je, żeby nie ściągać przy każdym uruchomieniu.
|
|
||||||
- name: Cache jądra efemeryd
|
- name: Cache jądra efemeryd
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: services/logic/.ephemeris
|
path: services/logic/.ephemeris
|
||||||
key: ephemeris-de421
|
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
|
- name: Instalacja zależności
|
||||||
run: pip install -r services/logic/requirements-dev.txt
|
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)
|
- name: Testy (pytest)
|
||||||
working-directory: services/logic
|
working-directory: services/logic
|
||||||
env:
|
env:
|
||||||
PYTHONPATH: .
|
PYTHONPATH: .
|
||||||
run: pytest tests -q
|
EPHEMERIS_DIR: ${{ github.workspace }}/services/logic/.ephemeris
|
||||||
|
run: pytest tests -q -rs
|
||||||
|
|
||||||
compile-all:
|
compile-all:
|
||||||
name: Kontrola składni wszystkich warstw
|
name: Kontrola składni wszystkich warstw
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ służą jako wyrocznia (LOG-25).
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
|
import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@@ -28,4 +29,8 @@ def own_engine():
|
|||||||
try:
|
try:
|
||||||
return SkyfieldEngine()
|
return SkyfieldEngine()
|
||||||
except Exception as e: # brak efemeryd / brak sieci
|
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}")
|
pytest.skip(f"Nie można wczytać efemeryd: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user