mirror of
https://github.com/wiltodelta/remove-ai-watermarks.git
synced 2026-12-05 11:43:35 +01:00
139 lines
4.9 KiB
YAML
139 lines
4.9 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: tests-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
- name: Sync dev environment
|
|
run: uv sync --frozen --extra dev
|
|
- name: Check C2PA soft-binding registry snapshot
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: uv run python scripts/sync_c2pa_soft_bindings.py --check
|
|
- name: Ruff lint
|
|
run: uv run ruff check
|
|
- name: Ruff format check
|
|
run: uv run ruff format --check
|
|
|
|
security:
|
|
name: lockfile vulnerability scan
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
with:
|
|
enable-cache: false
|
|
# Policy and triaged blocks: docs/development.md "Known security-gate blocks".
|
|
- name: Scan uv.lock with uv-secure
|
|
run: uvx uv-secure uv.lock
|
|
|
|
test:
|
|
name: test ${{ matrix.os }} py${{ matrix.python-version }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# Exercise every supported minor. The floor and latest minor run on all
|
|
# operating systems; intermediate minors run on Linux to bound the
|
|
# matrix without leaving a declared Python version untested.
|
|
include:
|
|
- os: ubuntu-latest
|
|
python-version: "3.11"
|
|
- os: macos-latest
|
|
python-version: "3.11"
|
|
- os: windows-latest
|
|
python-version: "3.11"
|
|
- os: ubuntu-latest
|
|
python-version: "3.12"
|
|
- os: ubuntu-latest
|
|
python-version: "3.13"
|
|
- os: ubuntu-latest
|
|
python-version: "3.14"
|
|
- os: macos-latest
|
|
python-version: "3.14"
|
|
- os: windows-latest
|
|
python-version: "3.14"
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Sync dev environment
|
|
run: uv sync --frozen --extra dev
|
|
- name: Require offline video payload
|
|
run: >-
|
|
uv run --no-sync python -c
|
|
"from remove_ai_watermarks.video_tools import bundled_video_tools_available; assert bundled_video_tools_available()"
|
|
- name: Run tests
|
|
run: uv run pytest -q -n auto
|
|
|
|
transport-contract-python-314:
|
|
name: versioned transport contracts py3.14
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
with:
|
|
python-version: "3.14"
|
|
- name: Create clean runtime contract environment
|
|
run: uv venv --python 3.14 .venv-contract
|
|
- name: Install runtime contract dependencies
|
|
run: >-
|
|
uv pip install --python .venv-contract/bin/python
|
|
".[pixels,heif]" "numpy>=2,<3" "pytest>=8"
|
|
- name: Run versioned transport contract tests
|
|
run: >-
|
|
.venv-contract/bin/python -m pytest -q
|
|
tests/test_forensic_metadata.py
|
|
tests/test_metadata_record.py
|
|
tests/test_pixel_evidence.py
|
|
|
|
video-e2e:
|
|
name: video full-clip end-to-end
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
with:
|
|
python-version: "3.12"
|
|
- name: Sync dev environment
|
|
run: uv sync --frozen --extra dev
|
|
- name: Activate the packaged offline FFmpeg tools
|
|
run: |
|
|
uv run python - <<'PY'
|
|
import os
|
|
from pathlib import Path
|
|
from remove_ai_watermarks.video_tools import require_video_tool
|
|
|
|
os.environ["PATH"] = ""
|
|
directories = {str(Path(require_video_tool(name)).parent) for name in ("ffmpeg", "ffprobe")}
|
|
with open(os.environ["GITHUB_PATH"], "a", encoding="utf-8") as output:
|
|
output.write("\n".join(sorted(directories)) + "\n")
|
|
PY
|
|
- name: Run full-clip video test
|
|
run: >-
|
|
uv run pytest -vv -o faulthandler_timeout=60
|
|
tests/test_video.py::TestVideoVisibleFullClip
|
|
tests/test_video_fidelity_probe.py
|
|
tests/test_video_seedance.py
|
|
tests/test_seedance_video_study.py
|
|
tests/test_video_audio.py
|
|
tests/test_video_messages.py
|
|
tests/test_media_removal_benchmark.py
|