CI/CD dentro GitHub
Prima del 2019, team che usavano GitHub dovevano integrare Travis CI, CircleCI, Jenkins, Drone esternamente. Microsoft (acquisita GitHub nel giugno 2018) vuole fornire CI/CD first-class integrato con repository, PR, release, security.
Il rilascio
GitHub Actions è annunciato nell’ottobre 2018, in beta 2019, generalmente disponibile il 13 novembre 2019. Inizialmente basato su HCL, poi riscritto a YAML. Gratis per repository pubblici (con limiti generosi), a consumo per privati.
Concetti
- Workflow — YAML in
.github/workflows/*.yml - Job — unità di esecuzione su runner
- Step — comando shell o action riusabile
- Action — unità modulare riusabile (JavaScript, Docker o composite)
- Event — trigger (push, pull_request, schedule, workflow_dispatch, release, webhook custom)
- Runner — macchina (hosted GitHub o self-hosted)
- Secrets — encrypted, injected come env var
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [18, 20, 22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: ${{ matrix.node }} }
- run: npm ci && npm test
Marketplace
GitHub Marketplace contiene 20.000+ actions community + vendor:
- Cloud deploy — AWS, Azure, GCP, Cloudflare
- Container — build Docker, push GHCR/DockerHub
- Security — CodeQL, Trivy, Snyk, Dependabot integration
- Testing — test runner, Playwright, Cypress
- Release — semantic-release, goreleaser, Sentry
- Notify — Slack, Discord, email, Jira
Feature avanzate
- Matrix build — espansione combinatoria
- Reusable workflow —
workflow_callper riuso cross-repo - Composite actions — step raggruppati
- Environment — protection rules, approval required, secrets separati
- OIDC — autenticazione cloud senza long-lived secrets (AWS/Azure/GCP IAM role)
- ARC (Actions Runner Controller) — runner K8s autoscaling
- Larger runners — 4-64 core su hosted
- GitHub-hosted Mac runners — Xcode/iOS builds
Confronto
| GitHub Actions | GitLab CI/CD | |
|---|---|---|
| Integrazione | GitHub native | GitLab native |
| Marketplace | Enorme (20k+) | Nativo + Catalog |
| Pricing | Gratis OSS, minute privato | Self-hosted gratis |
| Runner K8s | ARC (2023+) | Native dal 2015 |
Nel contesto italiano
GitHub Actions è il CI/CD dominante nelle aziende italiane con GitHub:
- Open source progetti italiani (ISI.it, Istat, CNR)
- Startup con GitHub organization
- Enterprise — banche, assicurazioni, fintech che hanno scelto GitHub Enterprise Cloud
- PA digitale — progetti PagoPA, App IO, Developers Italia su GitHub
- Bootcamp insegnano Actions come primo CI/CD
Alternativa principale: GitLab CI/CD per aziende che preferiscono GitLab self-hosted.
Riferimenti: GitHub Actions (GA 13 novembre 2019). GitHub (Microsoft dal 2018). YAML workflow in .github/workflows/. Marketplace 20k+ actions. OIDC cloud auth. ARC runner K8s (2023).
