From b821b45904dcddaeb6fcffdbc0a881bd958d5211 Mon Sep 17 00:00:00 2001 From: Rassaby Ludovic Date: Wed, 15 Oct 2025 10:18:32 +0400 Subject: [PATCH] TP5: Configure CI for releases - Add release workflow and tag triggers --- .github/workflows/release.yml | 77 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 1 + 2 files changed, 78 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..594044b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,77 @@ +name: 🚀 Release - TP5 + +on: + push: + tags: [ 'v*' ] + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: 📥 Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: 🐳 Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: 🧪 Run tests before release + run: | + echo "Validation des tests avant release..." + docker compose up -d db backend + sleep 15 + 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 + + - name: 📝 Create Release Notes + id: release_notes + run: | + echo "notes<> $GITHUB_OUTPUT + echo "## 🎉 Release ${{ github.ref_name }}" >> $GITHUB_OUTPUT + echo "" >> $GITHUB_OUTPUT + echo "### Fonctionnalités principales" >> $GITHUB_OUTPUT + echo "- Système complet de réservation de salles" >> $GITHUB_OUTPUT + echo "- Interface de planning visuel avec grille horaire" >> $GITHUB_OUTPUT + echo "- Tests automatisés avec Pytest et GitHub Actions" >> $GITHUB_OUTPUT + echo "- Configuration Docker Compose multi-services" >> $GITHUB_OUTPUT + echo "- 5 salles pré-configurées" >> $GITHUB_OUTPUT + echo "- Documentation complète" >> $GITHUB_OUTPUT + echo "" >> $GITHUB_OUTPUT + echo "### Installation" >> $GITHUB_OUTPUT + echo "\`\`\`bash" >> $GITHUB_OUTPUT + echo "git clone https://github.com/SarTron-NorthBlue/dockezr.git" >> $GITHUB_OUTPUT + echo "cd dockezr" >> $GITHUB_OUTPUT + echo "docker-compose up -d" >> $GITHUB_OUTPUT + echo "\`\`\`" >> $GITHUB_OUTPUT + echo "" >> $GITHUB_OUTPUT + echo "### Accès" >> $GITHUB_OUTPUT + echo "- Frontend: http://localhost:3000" >> $GITHUB_OUTPUT + echo "- Backend API: http://localhost:8000" >> $GITHUB_OUTPUT + echo "- Documentation API: http://localhost:8000/docs" >> $GITHUB_OUTPUT + echo "" >> $GITHUB_OUTPUT + echo "Voir [CHANGELOG.md](CHANGELOG.md) pour plus de détails." >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: 🏷️ Create GitHub Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name }} + release_name: Release ${{ github.ref_name }} + body: ${{ steps.release_notes.outputs.notes }} + draft: false + prerelease: false diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6e4dc4d..d5aa1ff 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,6 +3,7 @@ name: 🧪 Tests API - TP4 on: push: branches: [ main, develop ] + tags: [ 'v*' ] pull_request: branches: [ main ]