Pipeline CI

This commit is contained in:
2026-04-15 07:11:01 +00:00
commit 7d6a8f0ad2
3 changed files with 66 additions and 0 deletions

15
.gitea/workflows/ci.yml Normal file
View File

@@ -0,0 +1,15 @@
name: Tests
on:
push:
branches: [master]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lancer les tests
run: |
chmod +x tests.sh
./tests.sh

11
index.html Normal file
View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Mon Site DevOps user3</title>
</head>
<body>
<h1>Bienvenue sur mon site user3</h1>
<p>Déployé automatiquement avec CI/CD !</p>
</body>
</html>

40
tests.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/bin/bash
ERRORS=0
echo "=== Tests du site ==="
# Test 1 : le fichier existe
if [ -f "index.html" ]; then
echo "✅ index.html existe"
else
echo "❌ index.html introuvable"
ERRORS=$((ERRORS + 1))
fi
# Test 2 : DOCTYPE présent
if grep -q "<!DOCTYPE html>" index.html; then
echo "✅ DOCTYPE présent"
else
echo "❌ DOCTYPE manquant"
ERRORS=$((ERRORS + 1))
fi
# Test 3 : balise title
if grep -q "<title>" index.html; then
echo "✅ Balise title présente"
else
echo "❌ Balise title manquante"
ERRORS=$((ERRORS + 1))
fi
# Test 4 : balise h1
if grep -q "<h1>" index.html; then
echo "✅ Balise h1 présente"
else
echo "❌ Balise h1 manquante"
ERRORS=$((ERRORS + 1))
fi
echo ""
echo "=== Résultat : $ERRORS erreur(s) ==="
exit $ERRORS