Skip to content

armgit / Soup

Public Imported from GitHub
0

Fine-tune LLMs from one YAML. Layer streaming trains an 8B model on a 4 GB laptop GPU.

Fix/1414 ci fork badge (#1458)

Krishna5a196c8bea6f
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7921205f..0a6554cb 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -501,7 +501,7 @@ jobs:
files: coverage.xml
fail_ci_if_error: false
- name: Update test count badge
- if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' && github.ref == 'refs/heads/main' && github.event_name == 'push'
+ if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' && github.ref == 'refs/heads/main' && github.event_name == 'push' && github.repository == 'MakazhanAlpamys/Soup'
run: |
TESTS=$(python -c "
import xml.etree.ElementTree as ET
diff --git a/tests/test_issue1414_ci_fork_badge.py b/tests/test_issue1414_ci_fork_badge.py
new file mode 100644
index 00000000..d31b4af8
--- /dev/null
+++ b/tests/test_issue1414_ci_fork_badge.py
@@ -0,0 +1,37 @@
+"""Regression coverage for issue #1414: the test-count badge step runs only upstream."""
+
+from pathlib import Path
+
+import yaml
+
+ROOT = Path(__file__).resolve().parents[1]
+CI_WORKFLOW = ROOT / ".github" / "workflows" / "ci.yml"
+UPSTREAM_GUARD = "github.repository == 'MakazhanAlpamys/Soup'"
+
+
+def _badge_step() -> dict:
+ workflow = yaml.safe_load(CI_WORKFLOW.read_text(encoding="utf-8"))
+ steps = [
+ step
+ for step in workflow["jobs"]["test"]["steps"]
+ if step.get("name") == "Update test count badge"
+ ]
+ assert len(steps) == 1, "expected exactly one 'Update test count badge' step in jobs.test"
+ return steps[0]
+
+
+def test_badge_condition_requires_the_upstream_repository() -> None:
+ condition = _badge_step()["if"]
+ # The guard has to be one AND-ed term of the whole condition. An `||` anywhere would
+ # let the step run whenever the guard is true, i.e. on every upstream event.
+ assert "||" not in condition, condition
+ terms = [term.strip() for term in condition.split("&&")]
+ assert UPSTREAM_GUARD in terms, terms
+ # ...and the terms it was added to must still be there.
+ for kept in ("github.ref == 'refs/heads/main'", "github.event_name == 'push'"):
+ assert kept in terms, terms
+
+
+def test_badge_step_stays_blocking() -> None:
+ # continue-on-error would hide an expired GIST_TOKEN upstream (ruling on #1414).
+ assert "continue-on-error" not in _badge_step()