Un workflow GitHub Actions per il machine learning
Esegua lint, test e addestramento a ogni push.
Un workflow GitHub Actions per il machine learning è una lezione MLOps Academy gratuita su CoddyKit. Questa è la lezione 2 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento MLOps Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso MLOps Academy include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
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.
Domande Frequenti
La lezione «Un workflow GitHub Actions per il machine learning» è gratuita?
Sì — il testo completo di «Un workflow GitHub Actions per il machine learning» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso MLOps Academy, passa a CoddyKit PRO. Il corso MLOps Academy include 4 lezioni in totale.
Cosa imparerò in «Un workflow GitHub Actions per il machine learning»?
Esegua lint, test e addestramento a ogni push. Eserciti MLOps Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare MLOps Academy?
Non è richiesta alcuna esperienza precedente. MLOps Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 2 di 4.
Quanto tempo richiede la lezione «Un workflow GitHub Actions per il machine learning»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione MLOps Academy?
Sì. Ogni lezione MLOps Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Cosa significa CI/CD per i modelli
- Un workflow GitHub Actions per il machine learning
- Vincolare i merge alla qualità del modello
- Creare e inviare l'immagine al rilascio