Add automated tests with GitHub Actions - TP4
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
name: 🧪 Tests API - TP4
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: 📥 Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 🐳 Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: 🧪 Run tests with Docker Compose
|
||||
run: |
|
||||
echo "🚀 Démarrage des tests automatisés..."
|
||||
docker-compose --profile test up --build --abort-on-container-exit test
|
||||
|
||||
- name: 📊 Show test results
|
||||
if: always()
|
||||
run: |
|
||||
echo "📋 Résultats des tests:"
|
||||
docker-compose --profile test logs test
|
||||
|
||||
- name: 🧹 Cleanup
|
||||
if: always()
|
||||
run: |
|
||||
docker-compose --profile test down -v
|
||||
docker system prune -f
|
||||
Reference in New Issue
Block a user