Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
31 changes: 13 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,26 +102,21 @@ jobs:
cache-suffix: smoke
- name: Set up Python ${{ env.PYTHON_VERSION }}
run: uv python install ${{ env.PYTHON_VERSION }}
- name: Free up disk space
- name: Free up disk space when needed
run: |
# Clear some space (https://github.com/actions/runner-images/issues/2840)
echo "Disk usage before cleanup:"
df -h

# Remove unnecessary pre-installed software
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/share/swift

# Clean up docker to ensure we start fresh
# Large runners normally have hundreds of GiB free. Keep the fallback for
# smaller runners, but avoid spending minutes deleting unused toolchains.
docker_root=$(docker info --format '{{.DockerRootDir}}')
available_kib=$(df -Pk "$docker_root" | awk 'NR == 2 {print $4}')
if (( available_kib >= 30 * 1024 * 1024 )); then
Comment thread
CyMule marked this conversation as resolved.
echo "Skipping cleanup: $((available_kib / 1024 / 1024)) GiB free for Docker"
exit 0
fi
df -h "$docker_root"
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/share/boost \
/usr/local/lib/android /opt/hostedtoolcache/CodeQL /usr/local/.ghcup /usr/share/swift
docker system prune -af --volumes

echo "Disk usage after cleanup:"
df -h
df -h "$docker_root"
- name: Install smoke test dependencies
run: uv sync --only-group smoke --locked
- name: Build Dockerfile
Expand Down
12 changes: 9 additions & 3 deletions scripts/smoketest.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def send_document(
(".md", "README.md", "text/markdown"),
(".msg", "fake-email.msg", "application/x-ole-storage"),
(".odt", "fake.odt", "application/vnd.oasis.opendocument.text"),
(".pdf", "layout-parser-paper.pdf", "application/pdf"),
(".pdf", "layout-parser-paper-fast.pdf", "application/pdf"),
(".png", "english-and-korean.png", "image/png"),
(".ppt", "fake-power-point.ppt", "application/vnd.ms-powerpoint"),
(
Expand All @@ -89,12 +89,12 @@ def send_document(
(".json", "spring-weather.html.json", "application/json"),
(
".gz",
"layout-parser-paper.pdf.gz",
"layout-parser-paper-fast.pdf",
"application/gzip",
),
],
)
def test_happy_path_all_types(extension, example_filename: str, content_type: str):
def test_happy_path_all_types(extension, example_filename: str, content_type: str, tmp_path: Path):
"""
For the files in sample-docs, verify that we get a 200
and some structured response
Expand All @@ -113,6 +113,12 @@ def test_happy_path_all_types(extension, example_filename: str, content_type: st
pytest.skip("emulated hardware")

test_file = str(Path("sample-docs") / example_filename)
if extension == ".gz":
# Exercise the same PDF through gzip without repeatedly processing the
# full paper. Full-document inference stays in the table/strategy tests.
gzipped_file = tmp_path / f"{example_filename}.gz"
gzip_file(test_file, str(gzipped_file))
test_file = str(gzipped_file)

# Verify we can send with explicit content type
response = send_document(filenames=[test_file], content_type=content_type)
Expand Down
Loading