added build configuration for linux #51
Workflow file for this run
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
| # Name des Workflows (wird im GitHub Actions Tab angezeigt) | |
| name: Build for Windows | |
| # Wann soll der Workflow ausgeführt werden? | |
| on: | |
| push: | |
| branches: [ main ] # Ausführen bei jedem Push auf den main Branch | |
| tags: [ '*' ] # <-- Das sorgt dafür, dass auch bei jedem Tag der Workflow läuft! | |
| pull_request: | |
| branches: [ main ] # Ausführen bei jedem Pull Request auf den main Branch | |
| # Jobs, die ausgeführt werden sollen | |
| jobs: | |
| build: | |
| # Auf welchem Runner soll der Job laufen? Für Windows Executables brauchen wir Windows. | |
| runs-on: windows-latest | |
| permissions: | |
| contents: write # Erlaubt dem Job, auf den Repository-Inhalt zuzugreifen notwendig für das Erstellen von Releases | |
| checks: write # Erlaubt dem Job, die Ergebnisse der Tests als Checks zu veröffentlichen | |
| # Schritte des Jobs | |
| steps: | |
| - name: Code auschecken | |
| uses: actions/checkout@v4 # Holt den Code aus deinem Repository | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Set up Python | |
| run: uv python install | |
| - name: static code analysis with ruff | |
| uses: astral-sh/ruff-action@v3 | |
| # - name: Python einrichten | |
| # # Richtet eine Python Umgebung ein. Wähle eine passende Version. | |
| # uses: actions/setup-python@v5 | |
| # with: | |
| # python-version: '3.x' # Verwende die neueste Python 3 Version | |
| # - name: Install Dependencies | |
| # # Installiert Pygame und PyInstaller. | |
| # # Wenn du eine requirements.txt hast, nutze: run: pip install -r requirements.txt | |
| # run: | | |
| # python -m pip install --upgrade pip | |
| # pip install pytest pygame-ce pyinstaller networkx | |
| - name: Run Unit Tests with Pytest | |
| run: uv run pytest --junitxml=test-results/report.xml | |
| - name: Publish Test Results to GitHub Checks | |
| # Verwendet eine spezielle GitHub Action, um den Report zu lesen und im UI anzuzeigen. | |
| uses: EnricoMi/publish-unit-test-result-action/windows@v2 | |
| with: | |
| # Der Pfad zur Report-Datei(en), die in Schritt vorher erstellt wurde(n). | |
| # Glob-Muster sind erlaubt. | |
| files: "test-results/**/*.xml" | |
| # Optional: Gib dem Check einen aussagekräftigen Namen im GitHub UI | |
| check_name: "Pytest Unit Tests Results" | |
| # Optional: Weitere Konfiguration für die Anzeige der Ergebnisse | |
| report_individual_runs: "true" # Zeigt Details zu einzelnen Testläufen an | |
| # z.B. suite_summary: "Always" # Zeigt eine Zusammenfassung der Test-Suites | |
| # z.B. failure_summary: "Truncate" # Beschränkt die Ausgabe bei vielen Fehlern | |
| - name: Anwendung mit PyInstaller bauen | |
| # Führt den PyInstaller Befehl aus. | |
| # Pfad zu main.py muss korrekt sein relativ zum Root des ausgecheckten Codes. | |
| # Wenn du Assets hast, füge --add-data "pfad/zu/assets;assets" hinzu | |
| run: uv run pyinstaller --onefile --windowed --name NodeGraphEditor main.py # | |
| # Release erstellen (nur bei Tag-Builds) | |
| - name: Zip EXE for Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: vimtor/action-zip@v1.2 | |
| with: | |
| files: dist/NodeGraphEditor.exe | |
| dest: dist/NodeGraphEditor-win.zip | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} (Windows) # Updated to reflect the correct release name | |
| draft: false | |
| prerelease: false | |
| files: dist/NodeGraphEditor-win.zip # Updated to reflect the correct zip file name | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Save built .exe as artifact | |
| # Speichert die gebaute .exe Datei, damit du sie als Workflow-Artifact herunterladen kannst (zusätzlich zur Release). | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: NodeGraphEditor-win | |
| path: dist/NodeGraphEditor.exe | |
| retention-days: 5 | |
| build_linux: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| checks: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Set up Python | |
| run: uv python install | |
| - name: Install dependencies | |
| run: uv pip install pytest pygame-ce pyinstaller networkx | |
| - name: Run Unit Tests with Pytest | |
| run: uv run pytest --junitxml=test-results/report.xml | |
| - name: Build with PyInstaller | |
| run: uv run pyinstaller --onefile --name NodeGraphEditor main.py | |
| - name: Save built binary as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: NodeGraphEditor-linux | |
| path: dist/NodeGraphEditor | |
| retention-days: 5 | |
| - name: Zip binary for Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: vimtor/action-zip@v1.2 | |
| with: | |
| files: dist/NodeGraphEditor | |
| dest: dist/NodeGraphEditor-linux.zip | |
| - name: Create Release (Linux) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} (Linux) | |
| draft: false | |
| prerelease: false | |
| files: dist/NodeGraphEditor-linux.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |