Fine-tune LLMs from one YAML. Layer streaming trains an 8B model on a 4 GB laptop GPU.
Python cliconsumer-gpudpofine-tuningggufhuggingfacellmllmopslocal-ailocal-llmloralow-vrammachine-learningollamapeftpythonpytorchqlorasfttransformers
ci: a push to main runs the quick set per commit; the full matrix runs nightly (#1538)
Alpamys Makazhan1d6a428fa993
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex a13d2587..bbc40596 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -13,6 +13,12 @@ on:# matrix when a maintainer adds `ci:full` (see the comment above the `plan`# job); it stays a plain pull_request run -- never pull_request_target.types: [opened, synchronize, reopened, ready_for_review, labeled]+ # The full matrix on `main`, once a night: a push to `main` itself runs only the+ # quick set (see the comment above the `plan` job). `workflow_dispatch` lets a+ # maintainer start the same full run by hand.+ schedule:+ - cron: '23 3 * * *'+ workflow_dispatch:# Supersede, do not queue.#@@ -38,7 +44,15 @@ on:# already discards -- merge requires green on the CURRENT head -- which is why# it is the right thing to trade.#-# 2026-09-28: pushes to `main` now share ONE group, keyed 'main-push'. Measured+# 2026-10-01: every push is alone in its own group again -- keyed on the event and+# the commit -- because a push to `main` now runs only the QUICK set (about three+# jobs, not fifteen). The shared 'main-push' group below traded a result per commit+# for runner capacity; with a cheap per-commit run and the full matrix once a night+# the same capacity buys a green or red mark on every `main` commit, where the+# shared group left 'cancelled' on all but the last of a burst of merges (seen+# 2026-10-01: 22 merges in two hours, red crosses on every commit but two).+#+# 2026-09-28 (superseded by the paragraph above): pushes to `main` shared ONE group, keyed 'main-push'. Measured# that morning: 24 of 70 queued runs were full matrices for main commits (about# 15 merges plus credit commits in a day), each alone in its per-commit group,# so main's own history consumed roughly a third of the queue while every@@ -56,7 +70,7 @@ concurrency:# the pull request, and no later push cancels it. Adding `ci:full` keys on the# ref like every other pull-request event, so the full run supersedes the quick# one. The whole policy is in the comment above the `plan` job.- group: ${{ github.workflow }}-${{ github.event.action == 'labeled' && github.event.label.name != 'ci:full' && format('labeled-{0}', github.run_id) || github.event_name == 'pull_request' && github.ref || (github.ref == 'refs/heads/main' && 'main-push' || github.sha) }}+ group: ${{ github.workflow }}-${{ github.event.action == 'labeled' && github.event.label.name != 'ci:full' && format('labeled-{0}', github.run_id) || github.event_name == 'pull_request' && github.ref || format('{0}-{1}', github.event_name, github.sha) }}cancel-in-progress: ${{ github.event_name == 'pull_request' }}# Bound every job explicitly.@@ -116,9 +130,11 @@ jobs:# So `plan` picks one of three matrices, and every job except `lint` follows it:## push to release/** RELEASE: all nine test cells + the five gated jobs- # push to main, or a pull FULL: seven test cells (no Windows or macOS- # request labelled ci:full on 3.11) + the five gated jobs- # any other pull request run QUICK: lint + test (ubuntu-latest, 3.12)+ # nightly run on main, a manual FULL: seven test cells (no Windows or macOS+ # dispatch, or a pull request on 3.11) + the five gated jobs+ # labelled ci:full+ # push to main, any other pull QUICK: lint + test (ubuntu-latest, 3.12)+ # request run## 3.11 runs on ubuntu in every full run, and on Windows and macOS only for# release/**, where the release checklist needs every cell green on the tagged@@ -193,7 +209,7 @@ jobs:id: decideenv:RELEASE: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/') }}- FULL: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:full') }}+ FULL: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/')) || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci:full')) }}run: |set -euo pipefailif [ "$RELEASE" = "true" ]; then@@ -205,7 +221,7 @@ jobs:elsefull=falsematrix="$QUICK_MATRIX"- echo "::notice title=Quick CI run::lint and test (ubuntu-latest, 3.12) only. The other required test cells and the smoke jobs run when a maintainer adds the ci:full label."+ echo "::notice title=Quick CI run::lint and test (ubuntu-latest, 3.12) only. A pull request gets the other required test cells and the smoke jobs when a maintainer adds the ci:full label; main gets the full matrix every night."fi{echo "full=$full"@@ -630,7 +646,7 @@ jobs:files: coverage.xmlfail_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' && github.repository == 'MakazhanAlpamys/Soup'+ if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' && github.ref == 'refs/heads/main' && github.event_name == 'schedule' && github.repository == 'MakazhanAlpamys/Soup'run: |TESTS=$(python -c "import xml.etree.ElementTree as ETdiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 939601f4..3d0d23a7 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -528,7 +528,9 @@ as well as Ubuntu, Python 3.10 to 3.12 with 3.11 on Ubuntu only, plus the smokejobs) runs when a maintainer adds the `ci:full` label at approval, and on everylater push while the label stays. Until then the other `test (...)` checks showas *Expected* and the smoke jobs as *skipped*; neither is a failure on your side.-A PR is merged only when the full matrix is green on its current head.+A PR is merged only when the full matrix is green on its current head. After the+merge, `main` runs the same quick set on every commit and the full matrix once a+night (and on every push to a `release/**` branch).See `.github/workflows/ci.yml`.diff --git a/tests/test_ci_full_matrix_on_approval.py b/tests/test_ci_full_matrix_on_approval.pyindex 42b1a237..31b6935f 100644--- a/tests/test_ci_full_matrix_on_approval.py+++ b/tests/test_ci_full_matrix_on_approval.py@@ -7,9 +7,10 @@ three matrices by event:* RELEASE, every cell of the 3x3 support matrix, for pushes to ``release/**``-- the release checklist needs all of them green on the tagged commit;-* FULL, the same minus Windows and macOS on 3.11, for pushes to ``main`` and- pull requests a maintainer has labelled ``ci:full``;-* QUICK, ``test (ubuntu-latest, 3.12)`` alone, for any other pull-request run.+* FULL, the same minus Windows and macOS on 3.11, for the nightly run on ``main``,+ a manual dispatch, and pull requests a maintainer has labelled ``ci:full``;+* QUICK, ``test (ubuntu-latest, 3.12)`` alone, for a push to ``main`` and for any+ other pull-request run.The merge gate survives that because of one shape, and these tests pin it: the``test`` job's matrix is whatever the ``plan`` job outputs, so a quick run never@@ -335,19 +336,35 @@ def _render(template: str, context: dict[str, Any]) -> str:)-def _push(ref: str = "refs/heads/main", *, run_id: str = "900") -> dict[str, Any]:+def _push(+ ref: str = "refs/heads/main", *, run_id: str = "900", sha: str = "a" * 40+) -> dict[str, Any]:return {"github": {"workflow": "CI","event_name": "push","ref": ref,- "sha": "a" * 40,+ "sha": sha,"run_id": run_id,"event": {"ref": ref},}}+def _on_event(event_name: str, *, run_id: str = "800") -> dict[str, Any]:+ """A ``schedule`` or ``workflow_dispatch`` context: both run on main's tip."""+ return {+ "github": {+ "workflow": "CI",+ "event_name": event_name,+ "ref": "refs/heads/main",+ "sha": "c" * 40,+ "run_id": run_id,+ "event": {},+ }+ }++def _pull_request(action: str,*,@@ -394,7 +411,9 @@ def _release_for(context: dict[str, Any]) -> str:#: Which matrix each event must get: the one table both the expression tests and#: the end-to-end run of the step's shell read.EVENTS = [- pytest.param(_push("refs/heads/main"), "FULL", id="push-main"),+ pytest.param(_push("refs/heads/main"), "QUICK", id="push-main"),+ pytest.param(_on_event("schedule"), "FULL", id="nightly"),+ pytest.param(_on_event("workflow_dispatch"), "FULL", id="manual-dispatch"),pytest.param(_push("refs/heads/release/v0.76.0"), "RELEASE", id="push-release"),pytest.param(_pull_request("opened"), "QUICK", id="pr-opened"),pytest.param(_pull_request("synchronize", labels=("bug",)), "QUICK", id="pr-push-other-label"),@@ -466,6 +485,15 @@ class TestTriggers:def test_pushes_to_main_and_release_branches_still_trigger(self):assert _triggers()["push"]["branches"] == ["main", "release/**"]+ def test_the_nightly_full_run_and_the_manual_dispatch_exist(self):+ """A push to main runs only the quick set, so the full matrix on main has to come+ from somewhere: without these two the seven-cell run would never happen on main."""+ triggers = _triggers()+ schedule = triggers.get("schedule")+ assert isinstance(schedule, list) and len(schedule) == 1, schedule+ assert str(schedule[0].get("cron", "")).count(" ") == 4, schedule+ assert "workflow_dispatch" in triggers+class TestPlanDecision:def test_plan_is_short_unconditional_and_exports_its_decision(self):@@ -486,6 +514,20 @@ class TestPlanDecision:assert _full_for(context) == ("false" if kind == "QUICK" else "true")+class TestTheBadgeStep:+ def test_the_test_count_badge_is_updated_by_the_nightly_run(self):+ """The badge step needs the ubuntu / 3.11 cell, which a push to main no longer runs+ (it runs ubuntu / 3.12 only), so it moved to the nightly full run. A condition still+ gated on a push would never fire again and the badge would silently go stale."""+ steps = _jobs()["test"]["steps"]+ badge = [step for step in steps if step.get("name") == "Update test count badge"]+ assert len(badge) == 1, badge+ condition = str(badge[0].get("if", ""))+ assert "github.event_name == 'schedule'" in condition, condition+ assert "github.event_name == 'push'" not in condition, condition+ assert "github.ref == 'refs/heads/main'" in condition, condition++class TestGatedJobs:@pytest.mark.parametrize("name", GATED_JOBS)def test_the_smoke_and_contract_jobs_run_only_on_a_full_run(self, name):@@ -583,6 +625,19 @@ class TestConcurrency:assert push != _group(_pull_request("synchronize", run_id="1"))assert push != _group(_pull_request("labeled", label="bug", run_id="1"))+ def test_two_pushes_to_main_never_share_a_group(self):+ """Every main commit gets its own run. A shared group keeps one pending run and cancels+ the rest, which is how 22 merges in two hours left 'cancelled' on all but two."""+ first = _group(_push("refs/heads/main", run_id="1", sha="1" * 40))+ second = _group(_push("refs/heads/main", run_id="2", sha="2" * 40))+ assert first != second++ def test_the_nightly_and_manual_runs_are_not_in_the_group_of_a_push_to_the_same_commit(self):+ push = _group(_push("refs/heads/main", run_id="1", sha="c" * 40))+ assert _group(_on_event("schedule")) != push+ assert _group(_on_event("workflow_dispatch")) != push+ assert _group(_on_event("schedule")) != _group(_on_event("workflow_dispatch"))+def test_cancellation_stays_pull_request_only(self):concurrency = _workflow()["concurrency"]assert concurrency["cancel-in-progress"] == "${{ github.event_name == 'pull_request' }}"diff --git a/tests/test_issue1017_merge_freshness.py b/tests/test_issue1017_merge_freshness.pyindex da472aff..0b453b31 100644--- a/tests/test_issue1017_merge_freshness.py+++ b/tests/test_issue1017_merge_freshness.py@@ -558,16 +558,19 @@ class TestWorkflowPins:assert any("main:refs/remotes/origin/main" in run for run in runs)def test_ci_yml_concurrency_keys_prs_main_and_releases_apart(self):- """A PR supersedes itself, main pushes share one group, a release keeps its commit.+ """A PR supersedes itself; every push, nightly or manual run is alone in its group.The key is the enforcement, not ``cancel-in-progress``: a pending run is- superseded by a newer one in the same group whatever that flag says.+ superseded by a newer one in the same group whatever that flag says. Main pushes+ shared one group until 2026-10-01 and left 'cancelled' on all but two of a burst of+ 22 merges; a push now runs only the quick set, so it can afford its own group."""text = CI.read_text(encoding="utf-8")assert ("github.event_name == 'pull_request' && github.ref"- " || (github.ref == 'refs/heads/main' && 'main-push' || github.sha)"+ " || format('{0}-{1}', github.event_name, github.sha)") in text+ assert "main-push" not in yaml.safe_load(text)["concurrency"]["group"]assert "cancel-in-progress: ${{ github.event_name == 'pull_request' }}" in textdef test_the_script_uses_merge_tree_not_git_merge(self):diff --git a/tests/test_issue1414_ci_fork_badge.py b/tests/test_issue1414_ci_fork_badge.pyindex d31b4af8..73f28747 100644--- a/tests/test_issue1414_ci_fork_badge.py+++ b/tests/test_issue1414_ci_fork_badge.py@@ -27,8 +27,10 @@ def test_badge_condition_requires_the_upstream_repository() -> None:assert "||" not in condition, conditionterms = [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'"):+ # ...and the terms it was added to must still be there. The event is the nightly+ # schedule since #1538: a push to main runs only the quick set, which has no+ # ubuntu 3.11 cell, so the nightly full run is the one that updates the badge.+ for kept in ("github.ref == 'refs/heads/main'", "github.event_name == 'schedule'"):assert kept in terms, terms