VibecoderMcSwaggins commited on
Commit
bd5f74b
·
1 Parent(s): 1db3313

fix(ci,docker): resolve CI disk space and HF Spaces entrypoint issues

Browse files

CI Integration Tests:
- Skip HuggingFace download tests in CI (limited disk space)
- Make integration job manual via workflow_dispatch
- Add free-disk-space action for when integration tests are run
- Set HF_HOME to /tmp to avoid cache accumulation

HuggingFace Spaces:
- Reset ENTRYPOINT from DeepISLES base image
- Base image sets ENTRYPOINT to main.py, causing our CMD to be
passed as arguments instead of running our Gradio app

Root cause: DeepISLES base image ENTRYPOINT overrides our CMD

.github/workflows/ci.yml CHANGED
@@ -5,6 +5,13 @@ on:
5
  branches: [main]
6
  pull_request:
7
  branches: [main]
 
 
 
 
 
 
 
8
 
9
  jobs:
10
  lint:
@@ -69,10 +76,23 @@ jobs:
69
 
70
  integration:
71
  runs-on: ubuntu-latest
72
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
 
 
73
  steps:
74
  - uses: actions/checkout@v4
75
 
 
 
 
 
 
 
 
 
 
 
 
76
  - name: Install uv
77
  uses: astral-sh/setup-uv@v4
78
 
@@ -84,3 +104,5 @@ jobs:
84
 
85
  - name: Run integration tests
86
  run: uv run pytest -m integration --timeout=600
 
 
 
5
  branches: [main]
6
  pull_request:
7
  branches: [main]
8
+ workflow_dispatch:
9
+ inputs:
10
+ run_integration:
11
+ description: 'Run integration tests (requires HuggingFace download)'
12
+ required: false
13
+ default: 'false'
14
+ type: boolean
15
 
16
  jobs:
17
  lint:
 
76
 
77
  integration:
78
  runs-on: ubuntu-latest
79
+ # Only run integration tests when explicitly requested via workflow_dispatch
80
+ # These tests download large datasets from HuggingFace and require significant disk space
81
+ if: github.event_name == 'workflow_dispatch' && inputs.run_integration == true
82
  steps:
83
  - uses: actions/checkout@v4
84
 
85
+ - name: Free disk space
86
+ uses: jlumbroso/free-disk-space@main
87
+ with:
88
+ tool-cache: false
89
+ android: true
90
+ dotnet: true
91
+ haskell: true
92
+ large-packages: true
93
+ docker-images: false
94
+ swap-storage: true
95
+
96
  - name: Install uv
97
  uses: astral-sh/setup-uv@v4
98
 
 
104
 
105
  - name: Run integration tests
106
  run: uv run pytest -m integration --timeout=600
107
+ env:
108
+ HF_HOME: /tmp/hf_cache
Dockerfile CHANGED
@@ -55,6 +55,9 @@ USER user
55
  # Expose the Gradio port
56
  EXPOSE 7860
57
 
58
- # Set the default command
59
- # Use Gradio's built-in server settings for HF Spaces
 
 
 
60
  CMD ["python", "-m", "stroke_deepisles_demo.ui.app"]
 
55
  # Expose the Gradio port
56
  EXPOSE 7860
57
 
58
+ # IMPORTANT: Reset ENTRYPOINT from base image (DeepISLES sets ENTRYPOINT to main.py)
59
+ # Without this, our CMD gets passed as arguments to DeepISLES's main.py
60
+ ENTRYPOINT []
61
+
62
+ # Set the default command to run our Gradio app
63
  CMD ["python", "-m", "stroke_deepisles_demo.ui.app"]
tests/data/test_loader.py CHANGED
@@ -2,6 +2,7 @@
2
 
3
  from __future__ import annotations
4
 
 
5
  from typing import TYPE_CHECKING
6
 
7
  import pytest
@@ -13,6 +14,12 @@ from stroke_deepisles_demo.data.loader import load_isles_dataset
13
  if TYPE_CHECKING:
14
  from pathlib import Path
15
 
 
 
 
 
 
 
16
 
17
  def test_load_from_local_returns_local_dataset(synthetic_isles_dir: Path) -> None:
18
  """Test that loading from local path returns a LocalDataset."""
@@ -35,8 +42,13 @@ def test_load_hf_raises_on_invalid_dataset() -> None:
35
 
36
 
37
  @pytest.mark.integration
 
38
  def test_load_from_huggingface_returns_hf_dataset() -> None:
39
- """Test that loading from HuggingFace returns a HuggingFaceDataset."""
 
 
 
 
40
  with load_isles_dataset() as dataset: # Default is HuggingFace mode
41
  assert isinstance(dataset, HuggingFaceDataset)
42
  assert len(dataset) == 149
 
2
 
3
  from __future__ import annotations
4
 
5
+ import os
6
  from typing import TYPE_CHECKING
7
 
8
  import pytest
 
14
  if TYPE_CHECKING:
15
  from pathlib import Path
16
 
17
+ # Skip tests that download large datasets in CI (limited disk space)
18
+ SKIP_IN_CI = pytest.mark.skipif(
19
+ os.environ.get("CI") == "true",
20
+ reason="Skips large HuggingFace downloads in CI (disk space)",
21
+ )
22
+
23
 
24
  def test_load_from_local_returns_local_dataset(synthetic_isles_dir: Path) -> None:
25
  """Test that loading from local path returns a LocalDataset."""
 
42
 
43
 
44
  @pytest.mark.integration
45
+ @SKIP_IN_CI
46
  def test_load_from_huggingface_returns_hf_dataset() -> None:
47
+ """Test that loading from HuggingFace returns a HuggingFaceDataset.
48
+
49
+ Note: Skipped in CI due to large download size (~GB) and limited disk space.
50
+ Run locally with: pytest -m integration tests/data/test_loader.py
51
+ """
52
  with load_isles_dataset() as dataset: # Default is HuggingFace mode
53
  assert isinstance(dataset, HuggingFaceDataset)
54
  assert len(dataset) == 149