From 19bed7d81211778b45e7ad554f7f50aa78293974 Mon Sep 17 00:00:00 2001 From: Daniel Dybing Date: Wed, 11 Mar 2026 16:24:56 +0100 Subject: [PATCH] Workflow: Final robust fix for Windows builds using environment overrides --- .gitea/workflows/build.yml | 68 ++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 40 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 0c13e5c..f3cf298 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -26,7 +26,7 @@ jobs: - name: Upload Linux Artifact uses: actions/upload-artifact@v3 with: - name: binary-linux + name: tamigo-cli-linux-binary path: dist/tamigo-cli build-windows: @@ -35,56 +35,44 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Build Windows executable (Headless Cross-Compile) + - name: Build Windows executable (Robust CP Method) run: | - # 1. Create a local Dockerfile with xvfb for headless UI support - cat < Dockerfile.win - FROM python:3.10-slim + CONTAINER_NAME="win-builder-${{ github.run_id }}" - ENV WINEDEBUG=-all - ENV DEBIAN_FRONTEND=noninteractive + # 1. Create and start container in background + docker run -d --name $CONTAINER_NAME --entrypoint tail cdrx/pyinstaller-windows -f /dev/null - RUN dpkg --add-architecture i386 && apt-get update && \ - apt-get install -y wine wine32 wine64 wget xvfb && \ - apt-get clean - - # Install Windows Python using xvfb-run to provide a dummy display - RUN wget https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe && \ - xvfb-run wine python-3.10.11-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 && \ - rm python-3.10.11-amd64.exe - - # Install dependencies - RUN xvfb-run wine python -m pip install --upgrade pip - RUN xvfb-run wine python -m pip install pyinstaller requests questionary rich python-dotenv - - WORKDIR /src - EOF - - # 2. Build local image - docker build -t headless-win-builder -f Dockerfile.win . - - # 3. Use unique container name - CONTAINER_NAME="win-build-${{ github.run_id }}" - - # 4. Run build - docker create --name $CONTAINER_NAME headless-win-builder xvfb-run wine python -m PyInstaller --onefile --name tamigo-cli tamigo.py + # 2. Copy source into container + docker exec $CONTAINER_NAME mkdir -p /src docker cp . $CONTAINER_NAME:/src - docker start -a $CONTAINER_NAME - # 5. Extract results + # 3. Run build with explicit environment variables to fix the /tmp bug + # We also use explicit paths for every PyInstaller directory + docker exec -w /src $CONTAINER_NAME sh -c " + export TMP=C:\\\\temp && \ + export TEMP=C:\\\\temp && \ + mkdir -p /src/build /src/dist_win && \ + pip install -r requirements.txt && \ + pyinstaller --onefile --name tamigo-cli \ + --workpath /src/build \ + --distpath /src/dist_win \ + --specpath /src/build \ + tamigo.py" + + # 4. Extract results mkdir -p win_dist - docker cp $CONTAINER_NAME:/src/dist/. ./win_dist/ - docker rm $CONTAINER_NAME + docker cp $CONTAINER_NAME:/src/dist_win/tamigo-cli.exe ./win_dist/tamigo-cli.exe + + # 5. Cleanup + docker rm -f $CONTAINER_NAME - name: Debug - List Files if: always() run: | - ls -R win_dist/ || echo "No win_dist folder" - find . -name "*.exe" + ls -R win_dist/ || echo "win_dist not found" - # Downgrade to v3 for Gitea compatibility - name: Upload Windows Artifact uses: actions/upload-artifact@v3 with: - name: binary-windows - path: win_dist/*.exe + name: tamigo-cli-windows-binary + path: win_dist/tamigo-cli.exe