Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/us10783-validation/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:3.14.7-slim-bookworm@sha256:998acd06f485adfd6890e3e15a4b542543e0cf22ff904310095da328a5e3e561

ENV PYTHONDONTWRITEBYTECODE=1 \
UV_PYTHON_DOWNLOADS=never \
UV_PROJECT_ENVIRONMENT=/sources/C/.venv \
UV_CACHE_DIR=/validation/uv-cache
COPY sources /sources
COPY helpers /validation
COPY evidence /validation/evidence
COPY core.whl /validation/evidence/core.whl
COPY uv.tar.gz /validation/evidence/uv.tar.gz
RUN tar -xzf /validation/evidence/uv.tar.gz -C /opt
WORKDIR /sources/C
RUN /opt/uv-x86_64-unknown-linux-gnu/uv sync --locked --extra dev --no-python-downloads --python /usr/local/bin/python3.14
RUN /sources/C/.venv/bin/python -B /validation/remote.py qualify
26 changes: 26 additions & 0 deletions .github/us10783-validation/atomic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Hash files and publish new JSON records without replacing evidence."""

import hashlib
import json
import os
from pathlib import Path


def sha256_file(path):
digest = hashlib.sha256()
with Path(path).open("rb") as stream:
for block in iter(lambda: stream.read(1024 * 1024), b""):
digest.update(block)
return digest.hexdigest()


def write_new_json(path, value):
path = Path(path)
temporary = path.with_name(path.name + ".partial")
with temporary.open("x") as stream:
json.dump(value, stream, indent=2, sort_keys=True, allow_nan=False)
stream.write("\n")
stream.flush()
os.fsync(stream.fileno())
os.link(temporary, path)
temporary.unlink()
Loading
Loading