Compare commits
3 Commits
v202602281
...
v202602282
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aee3733b49 | ||
|
|
51d9aab4a0 | ||
|
|
85b6aa0d0a |
@@ -17,9 +17,9 @@ jobs:
|
|||||||
- run: uv run pytest web/tests/ -x -q -p no:faulthandler
|
- run: uv run pytest web/tests/ -x -q -p no:faulthandler
|
||||||
- run: uv run ruff check web/src/ web/tests/
|
- run: uv run ruff check web/src/ web/tests/
|
||||||
|
|
||||||
# Creates v<N> tag after tests pass. The on-server supervisor polls for new
|
# Creates a v{YYYYMMDDHHMM} tag after tests pass on master.
|
||||||
# tags every 60s and deploys automatically. No SSH keys or deploy credentials
|
# The on-server supervisor polls for new tags every 60s and deploys
|
||||||
# needed in CI — only the built-in github.token.
|
# automatically. No SSH keys or deploy credentials needed in CI.
|
||||||
tag:
|
tag:
|
||||||
needs: [test]
|
needs: [test]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -32,5 +32,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git config user.name "CI"
|
git config user.name "CI"
|
||||||
git config user.email "ci@noreply"
|
git config user.email "ci@noreply"
|
||||||
git tag "v${{ github.run_number }}"
|
TAG="v$(date -u +%Y%m%d%H%M)"
|
||||||
git push origin "v${{ github.run_number }}"
|
git tag "$TAG"
|
||||||
|
git push origin "$TAG"
|
||||||
|
|||||||
@@ -279,12 +279,18 @@ def web_code_changed() -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def current_deployed_tag() -> str | None:
|
def current_deployed_tag() -> str | None:
|
||||||
"""Return the tag currently checked out, or None if not on a tag."""
|
"""Return the highest-version tag pointing at HEAD, or None.
|
||||||
|
|
||||||
|
Uses the same sort order as latest_remote_tag() so that when multiple
|
||||||
|
tags point to the same commit (e.g. a date-based tag and a CI integer
|
||||||
|
tag), we always compare apples-to-apples.
|
||||||
|
"""
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
["git", "describe", "--tags", "--exact-match", "HEAD"],
|
["git", "tag", "--list", "--sort=-version:refname", "--points-at", "HEAD", "v*"],
|
||||||
capture_output=True, text=True, timeout=10,
|
capture_output=True, text=True, timeout=10,
|
||||||
)
|
)
|
||||||
return result.stdout.strip() or None
|
tags = result.stdout.strip().splitlines()
|
||||||
|
return tags[0] if tags else None
|
||||||
|
|
||||||
|
|
||||||
def latest_remote_tag() -> str | None:
|
def latest_remote_tag() -> str | None:
|
||||||
@@ -321,6 +327,10 @@ def git_pull_and_sync() -> None:
|
|||||||
run_shell(f"git checkout --detach {latest}")
|
run_shell(f"git checkout --detach {latest}")
|
||||||
run_shell("sops --input-type dotenv --output-type dotenv -d .env.prod.sops > .env")
|
run_shell("sops --input-type dotenv --output-type dotenv -d .env.prod.sops > .env")
|
||||||
run_shell("uv sync --all-packages")
|
run_shell("uv sync --all-packages")
|
||||||
|
# Re-exec so the new code is loaded. os.execv replaces this process in-place;
|
||||||
|
# systemd sees it as the same PID and does not restart the unit.
|
||||||
|
logger.info("Deploy complete — re-execing to load new code")
|
||||||
|
os.execv(sys.executable, sys.argv)
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,22 +1,19 @@
|
|||||||
"""Create minimal seed files for SQLMesh staging models that require landing data."""
|
"""Create minimal seed files for SQLMesh staging models that require landing data.
|
||||||
|
|
||||||
|
Seeds are empty JSONL gzip files — they satisfy DuckDB's file-not-found check
|
||||||
|
while contributing zero rows to the staging models.
|
||||||
|
"""
|
||||||
import gzip
|
import gzip
|
||||||
import json
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
seed = {
|
# stg_playtomic_availability requires at least one morning and one recheck file
|
||||||
"date": "1970-01-01",
|
morning = Path("data/landing/playtomic/1970/01/availability_1970-01-01.jsonl.gz")
|
||||||
"captured_at_utc": "1970-01-01T00:00:00Z",
|
recheck = Path("data/landing/playtomic/1970/01/availability_1970-01-01_recheck_00.jsonl.gz")
|
||||||
"venue_count": 0,
|
|
||||||
"venues_errored": 0,
|
|
||||||
"venues": [],
|
|
||||||
}
|
|
||||||
morning = Path("data/landing/playtomic/1970/01/availability_1970-01-01.json.gz")
|
|
||||||
recheck = Path("data/landing/playtomic/1970/01/availability_1970-01-01_recheck_00.json.gz")
|
|
||||||
morning.parent.mkdir(parents=True, exist_ok=True)
|
morning.parent.mkdir(parents=True, exist_ok=True)
|
||||||
for p in [morning, recheck]:
|
for p in [morning, recheck]:
|
||||||
if not p.exists():
|
if not p.exists():
|
||||||
with gzip.open(p, "wt") as f:
|
with gzip.open(p, "wb") as f:
|
||||||
json.dump(seed, f)
|
pass # empty JSONL — 0 rows, no error
|
||||||
print("created", p)
|
print("created", p)
|
||||||
else:
|
else:
|
||||||
print("exists ", p)
|
print("exists ", p)
|
||||||
|
|||||||
Reference in New Issue
Block a user