feat: add complete timer application with multi-platform support #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # GitHub Actions Workflow - Build Multi-Plateforme Minuteur | |
| # Génère des exécutables pour Windows, Linux et macOS automatiquement | |
| name: 🚀 Build Multi-Platform Executables | |
| # Déclencheurs | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: # Permet le déclenchement manuel | |
| # Variables d'environnement globales | |
| env: | |
| PYTHON_VERSION: "3.12" | |
| APP_NAME: "Minuteur" | |
| jobs: | |
| # Job de build pour chaque OS | |
| build: | |
| name: 🔨 Build ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false # Continue même si un OS échoue | |
| matrix: | |
| include: | |
| # Configuration Windows | |
| - os: windows-latest | |
| os_name: windows | |
| executable_ext: .exe | |
| artifact_name: minuteur-windows | |
| build_command: python build_exe_ci.py | |
| # Configuration Linux | |
| - os: ubuntu-latest | |
| os_name: linux | |
| executable_ext: "" | |
| artifact_name: minuteur-linux | |
| build_command: python build_exe_ci.py | |
| setup_display: true # Nécessaire pour pystray | |
| # Configuration macOS | |
| - os: macos-latest | |
| os_name: macos | |
| executable_ext: "" | |
| artifact_name: minuteur-macos | |
| build_command: python build_exe_ci.py | |
| steps: | |
| # 1. Checkout du code source | |
| - name: 📥 Checkout Repository | |
| uses: actions/checkout@v4 | |
| # 2. Configuration Python avec cache | |
| - name: 🐍 Setup Python ${{ env.PYTHON_VERSION }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| cache: 'pip' | |
| # 3. Configuration spécifique Linux (display virtuel) | |
| - name: 🖥️ Setup Virtual Display (Linux) | |
| if: matrix.setup_display | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y xvfb | |
| export DISPLAY=:99 | |
| Xvfb :99 -screen 0 1024x768x24 & | |
| echo "DISPLAY=:99" >> $GITHUB_ENV | |
| # 4. Installation Poetry | |
| - name: 📦 Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| version: latest | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| installer-parallel: true | |
| # 5. Configuration cache Poetry | |
| - name: 💾 Load Cached Poetry Dependencies | |
| id: cached-poetry-dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }} | |
| # 6. Installation des dépendances | |
| - name: 🔧 Install Dependencies | |
| if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
| run: poetry install --no-interaction --no-ansi | |
| # 7. Installation PyInstaller (dépendance dev) | |
| - name: ⚙️ Install PyInstaller | |
| run: poetry add --group dev pyinstaller | |
| # 8. Informations système (debug) | |
| - name: 🔍 System Information | |
| run: | | |
| echo "🖥️ OS: ${{ matrix.os_name }}" | |
| echo "🐍 Python: $(python --version)" | |
| echo "📦 Poetry: $(poetry --version)" | |
| poetry show | grep -E "(customtkinter|pystray|pillow|pyinstaller)" || true | |
| # 9. Build de l'exécutable | |
| - name: 🔨 Build Executable | |
| run: | | |
| echo "🚀 Building ${{ env.APP_NAME }} for ${{ matrix.os_name }}..." | |
| poetry run ${{ matrix.build_command }} | |
| # 10. Vérification du build | |
| - name: ✅ Verify Build Output | |
| run: | | |
| echo "📋 Checking build output..." | |
| if [ -d "dist/${{ env.APP_NAME }}" ]; then | |
| echo "✅ Build directory found" | |
| ls -la "dist/${{ env.APP_NAME }}/" | |
| # Vérifier la présence de l'exécutable | |
| if [ -f "dist/${{ env.APP_NAME }}/${{ env.APP_NAME }}${{ matrix.executable_ext }}" ]; then | |
| echo "🎯 Executable found: ${{ env.APP_NAME }}${{ matrix.executable_ext }}" | |
| file_size=$(du -sh "dist/${{ env.APP_NAME }}/" | cut -f1) | |
| echo "📏 Total size: $file_size" | |
| else | |
| echo "❌ Executable not found!" | |
| ls -la "dist/${{ env.APP_NAME }}/" | |
| exit 1 | |
| fi | |
| else | |
| echo "❌ Build directory not found!" | |
| ls -la dist/ || echo "No dist directory" | |
| exit 1 | |
| fi | |
| shell: bash | |
| # 11. Préparation de l'artifact | |
| - name: 📦 Prepare Artifact | |
| run: | | |
| echo "📦 Preparing artifact for ${{ matrix.os_name }}..." | |
| # Créer un dossier propre pour l'artifact | |
| mkdir -p "release/${{ matrix.artifact_name }}" | |
| # Copier les fichiers de build | |
| cp -r "dist/${{ env.APP_NAME }}/"* "release/${{ matrix.artifact_name }}/" | |
| # Créer un README pour l'utilisateur final | |
| cat > "release/${{ matrix.artifact_name }}/README.txt" << 'EOF' | |
| # Minuteur Application | |
| ## Comment utiliser: | |
| 1. Double-cliquez sur 'Minuteur' (ou 'Minuteur.exe' sur Windows) | |
| 2. Définissez votre temps de minuteur | |
| 3. Cliquez sur 'Démarrer' | |
| 4. L'application peut être réduite dans la barre système | |
| ## Fonctionnalités: | |
| - Interface moderne CustomTkinter | |
| - System tray avec temps restant affiché | |
| - Notifications de fin de minuteur | |
| - Clic simple sur tray = afficher, double-clic = fermer | |
| Généré automatiquement par GitHub Actions | |
| EOF | |
| # Informations de l'artifact | |
| echo "📊 Artifact contents:" | |
| ls -la "release/${{ matrix.artifact_name }}/" | |
| shell: bash | |
| # 12. Upload de l'artifact | |
| - name: 📤 Upload Build Artifact | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: release/${{ matrix.artifact_name }}/ | |
| retention-days: 90 | |
| # 13. Test rapide de l'exécutable (si possible) | |
| - name: 🧪 Quick Test (Non-GUI) | |
| if: matrix.os != 'ubuntu-latest' # Skip sur Linux (problèmes GUI en CI) | |
| run: | | |
| echo "🧪 Quick test of executable..." | |
| cd "release/${{ matrix.artifact_name }}" | |
| # Test avec timeout (l'app va se lancer mais on la ferme rapidement) | |
| timeout 10s ./${{ env.APP_NAME }}${{ matrix.executable_ext }} || echo "✅ App launched successfully (timeout expected)" | |
| shell: bash | |
| continue-on-error: true # Ne pas échouer si le test GUI ne marche pas en CI | |
| # Job de release (seulement pour les tags) | |
| release: | |
| name: 🚀 Create GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') # Seulement pour les tags version | |
| steps: | |
| # Télécharger tous les artifacts | |
| - name: 📥 Download All Artifacts | |
| uses: actions/download-artifact@v3 | |
| # Créer les archives ZIP pour chaque plateforme | |
| - name: 📦 Create Release Archives | |
| run: | | |
| echo "📦 Creating release archives..." | |
| # Windows | |
| if [ -d "minuteur-windows" ]; then | |
| zip -r "minuteur-windows.zip" minuteur-windows/ | |
| echo "✅ Created minuteur-windows.zip" | |
| fi | |
| # Linux | |
| if [ -d "minuteur-linux" ]; then | |
| tar -czf "minuteur-linux.tar.gz" minuteur-linux/ | |
| echo "✅ Created minuteur-linux.tar.gz" | |
| fi | |
| # macOS | |
| if [ -d "minuteur-macos" ]; then | |
| tar -czf "minuteur-macos.tar.gz" minuteur-macos/ | |
| echo "✅ Created minuteur-macos.tar.gz" | |
| fi | |
| # Liste des fichiers créés | |
| echo "📋 Release files:" | |
| ls -la *.zip *.tar.gz || echo "No archives created" | |
| # Créer la release GitHub | |
| - name: 🚀 Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: "Minuteur ${{ github.ref_name }}" | |
| body: | | |
| # 🎉 Minuteur ${{ github.ref_name }} | |
| Application de minuteur avec interface moderne et support du system tray. | |
| ## 📥 Téléchargements | |
| - **Windows**: `minuteur-windows.zip` | |
| - **Linux**: `minuteur-linux.tar.gz` | |
| - **macOS**: `minuteur-macos.tar.gz` | |
| ## 🚀 Installation | |
| 1. Téléchargez l'archive pour votre OS | |
| 2. Extraire l'archive | |
| 3. Lancer l'exécutable `Minuteur` (ou `Minuteur.exe`) | |
| ## ✨ Fonctionnalités | |
| - ⏰ Interface utilisateur moderne | |
| - 📌 System tray avec temps restant | |
| - 🔔 Notifications de fin | |
| - 🎨 Thème sombre/clair automatique | |
| --- | |
| *Généré automatiquement par GitHub Actions* | |
| files: | | |
| minuteur-windows.zip | |
| minuteur-linux.tar.gz | |
| minuteur-macos.tar.gz | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |