Skip to content

Act - Test local des workflows

Pourquoi ?

Sans act :

commit "fix pipeline" → push → échec
commit "fix pipeline v2" → push → échec
commit "fix pipeline v3" → push → succès
→ Historique pollué avec 3 commits pour un seul fix

Avec act :

act → échec (local)
modifier → act → succès (local)
commit "fix pipeline" → push → succès
→ 1 seul commit propre

act exécute les GitHub/Gitea Actions localement dans Docker, sans pousser vers le serveur.

Installation

curl -sL https://github.com/nektos/act/releases/latest/download/act_Linux_x86_64.tar.gz | tar xz act
sudo mv act /usr/local/bin/

Utilisation

cd /chemin/vers/mon-repo

# Lister les workflows disponibles
act -l

# Exécuter le workflow par défaut (push)
act

# Exécuter un workflow spécifique
act -W .gitea/workflows/build.yml

# Exécuter un job spécifique
act -j build

Différence avec act_runner

Outil Quand l'utiliser
act Développement, debug, test avant push
act_runner Exécution automatique après push (serveur)

Exemple

# Tester localement
cd ~/labs/gitlab/test
act -W .gitea/workflows/test.yml

# Une fois validé, pusher
git push origin master
# → act_runner exécute automatiquement sur le serveur