Skip to content

Restructure project with organized file layout and improved CI/CD #40

Restructure project with organized file layout and improved CI/CD

Restructure project with organized file layout and improved CI/CD #40

Workflow file for this run

# .github/workflows/windows-build.yml
# This workflow builds the Windows application and stores it as an artifact.
# Use the separate "Create Release" workflow to manually create releases from these builds.
name: Build Windows App
on:
push:
tags:
- 'v*' # Triggers on version tags like v1.0.0
pull_request:
branches: [ main ]
paths:
- 'src/**'
- 'requirements.txt'
- '.github/workflows/windows-build.yml'
jobs:
build-windows:
runs-on: windows-latest
permissions:
contents: read # To checkout code
actions: write # To upload artifacts
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python for Nuitka build process
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install zstd decompressor
run: choco install zstandard -y
- name: Prepare Portable Python Runtime
shell: pwsh
run: |
# 1. Download the specified full, pre-built, standalone Python distribution.
$url = "https://github.com/astral-sh/python-build-standalone/releases/download/20250808/cpython-3.11.13+20250808-x86_64-pc-windows-msvc-pgo-full.tar.zst"
Write-Host "Downloading Python runtime from hardcoded URL: $url"
Invoke-WebRequest -Uri $url -OutFile "python-standalone.tar.zst"
# 2. Decompress the archive in two steps: zstd -> tar.
Write-Host "Decompressing python-standalone.tar.zst..."
zstd -d python-standalone.tar.zst -o python-standalone.tar
Write-Host "Extracting python-standalone.tar..."
tar -xf python-standalone.tar
# 3. Move the contents from the correct 'python\install' subfolder.
New-Item -ItemType Directory -Force -Path python_runtime
Write-Host "Moving extracted runtime from 'python\install' to 'python_runtime'..."
Move-Item -Path "python\install\*" -Destination "python_runtime"
Remove-Item "python", "python-standalone.tar.zst", "python-standalone.tar" -Recurse -Force
Write-Host "Python runtime prepared."
- name: Install dependencies for Nuitka build
run: pip install -r requirements.txt
- name: Build app with Nuitka
run: |
python -m nuitka `
--standalone `
--enable-plugin=pyside6 `
--include-qt-plugins=platforms `
--output-dir=NodeEditor_Build `
--include-package=src `
--nofollow-import-to=tkinter,unittest,setuptools,pip,wheel `
--windows-disable-console `
--remove-output `
--lto=yes `
--include-data-dir=examples=examples `
--include-data-dir=resources=resources `
--include-data-file=dark_theme.qss=dark_theme.qss `
--assume-yes-for-downloads `
src/main.py
- name: Copy Python runtime after Nuitka build
shell: pwsh
run: |
$distDir = "NodeEditor_Build\main.dist"
Write-Host "Copying python_runtime to $distDir..."
Copy-Item -Path "python_runtime" -Destination $distDir -Recurse -Force
- name: Prepare build artifact
id: package
run: |
$version = "${{ github.ref_name }}"
$build_dir = "NodeEditor_Build"
$dist_dir = Join-Path $build_dir "main.dist"
$new_dir_name = "PyFlowGraph $version"
$zip_file_name = "PyFlowGraph_Windows_$version.zip"
Rename-Item -Path $dist_dir -NewName $new_dir_name
$archive_source = Join-Path $build_dir $new_dir_name
Compress-Archive -Path "$archive_source\*" -DestinationPath $zip_file_name
echo "zip_name=$zip_file_name" >> $env:GITHUB_OUTPUT
echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Upload build artifact
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: PyFlowGraph-Windows-${{ steps.package.outputs.version }}
path: ${{ steps.package.outputs.zip_name }}
retention-days: 90
compression-level: 0 # Already compressed
- name: Build summary (Tag Build)
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "## Tag Build Complete" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** ${{ steps.package.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "**Artifact:** ${{ steps.package.outputs.zip_name }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Next Steps:" >> $GITHUB_STEP_SUMMARY
echo "1. Download the artifact from this build to test locally" >> $GITHUB_STEP_SUMMARY
echo "2. Once verified, use the 'Create Release' workflow to publish" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "[Download Artifact](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY
- name: Build summary (PR Build)
if: github.event_name == 'pull_request'
run: |
echo "## PR Build Complete" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Build verification passed for this pull request.**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "The application builds successfully with the proposed changes." >> $GITHUB_STEP_SUMMARY