Ein GitHub-Actions-Workflow für ML
Führen Sie bei jedem Push Linting, Tests und Training aus.
Ein GitHub-Actions-Workflow für ML ist eine kostenlose MLOps Academy-Lektion auf CoddyKit. Dies ist Lektion 2 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des MLOps Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der MLOps Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Meet GitHub Actions
GitHub Actions runs your scripts on GitHub's servers whenever something happens in your repo, like a push, so you never run CI by hand again. ⚙️
Workflows Live in YAML
A workflow is a YAML file inside .github/workflows. GitHub reads it and follows your instructions step by step on each trigger.
.github/workflows/ml.ymlThe on: Trigger
The on key says when to run. Here it fires on every push, so each commit kicks off your ML checks automatically.
on:
push:
branches: [main]Jobs Run the Work
A workflow holds one or more jobs. Each job runs on a fresh virtual machine, so your pipeline always starts from a clean, predictable state.
jobs:
build:
runs-on: ubuntu-latestSteps Are the Recipe
Inside a job, steps run in order from top to bottom. Each step is either a reusable action or a plain shell command you write.
Check Out Your Code
The first step almost always uses the checkout action to copy your repo onto the runner. Without it, the machine has no code to test.
- uses: actions/checkout@v4Set Up Python
For an ML repo you set up Python next, choosing the exact version so the runner matches the environment your team trains in.
- uses: actions/setup-python@v5
with:
python-version: "3.11"Install Dependencies
Then you install your pinned packages so the runner has the same libraries you use locally. This makes every CI run reproducible.
- run: pip install -r requirements.txtLint, Then Test
Now add the ML checks: a lint step to catch style issues, then pytest to run your data and model tests on the fresh runner.
- run: ruff check .
- run: pytestTrain on a Sample
A final step can train on a small sample to prove the pipeline works end to end, keeping CI fast while still exercising real code.
- run: python train.py --sample 1000Watch It Run
Push your YAML and open the Actions tab. GitHub shows a live log of each step, with a green check when your ML pipeline passes. ✅
Quick Check
Where must a GitHub Actions workflow file live to be picked up?
Recap
A workflow YAML in .github/workflows defines triggers, jobs, and ordered steps. For ML you check out code, set up Python, install deps, then lint, test, and train.
Häufig gestellte Fragen
Ist die Lektion „Ein GitHub-Actions-Workflow für ML“ kostenlos?
Ja — der vollständige Text von „Ein GitHub-Actions-Workflow für ML“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des MLOps Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der MLOps Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Ein GitHub-Actions-Workflow für ML“?
Führen Sie bei jedem Push Linting, Tests und Training aus. Du übst MLOps Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um MLOps Academy zu starten?
Keine Vorkenntnisse erforderlich. MLOps Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 2 von 4.
Wie lange dauert die Lektion „Ein GitHub-Actions-Workflow für ML“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser MLOps Academy-Lektion Code schreiben und ausführen?
Ja. Jede MLOps Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Was CI/CD für Modelle bedeutet
- Ein GitHub-Actions-Workflow für ML
- Merges von der Modellqualität abhängig machen
- Das Image beim Release bauen und übertragen