Workflow: Final robust fix for Windows builds using environment overrides
Some checks failed
Build Tamigo CLI / Build Windows Binary (push) Successful in 42s
Build Tamigo CLI / Build Linux Binary (push) Successful in 51s
Release Tamigo CLI / Build & Release Linux (release) Successful in 45s
Release Tamigo CLI / Build & Release Windows (release) Failing after 4s
Some checks failed
Build Tamigo CLI / Build Windows Binary (push) Successful in 42s
Build Tamigo CLI / Build Linux Binary (push) Successful in 51s
Release Tamigo CLI / Build & Release Linux (release) Successful in 45s
Release Tamigo CLI / Build & Release Windows (release) Failing after 4s
This commit is contained in:
@@ -26,7 +26,7 @@ jobs:
|
|||||||
- name: Upload Linux Artifact
|
- name: Upload Linux Artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: binary-linux
|
name: tamigo-cli-linux-binary
|
||||||
path: dist/tamigo-cli
|
path: dist/tamigo-cli
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
@@ -35,56 +35,44 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Build Windows executable (Headless Cross-Compile)
|
- name: Build Windows executable (Robust CP Method)
|
||||||
run: |
|
run: |
|
||||||
# 1. Create a local Dockerfile with xvfb for headless UI support
|
CONTAINER_NAME="win-builder-${{ github.run_id }}"
|
||||||
cat <<EOF > Dockerfile.win
|
|
||||||
FROM python:3.10-slim
|
|
||||||
|
|
||||||
ENV WINEDEBUG=-all
|
# 1. Create and start container in background
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
docker run -d --name $CONTAINER_NAME --entrypoint tail cdrx/pyinstaller-windows -f /dev/null
|
||||||
|
|
||||||
RUN dpkg --add-architecture i386 && apt-get update && \
|
# 2. Copy source into container
|
||||||
apt-get install -y wine wine32 wine64 wget xvfb && \
|
docker exec $CONTAINER_NAME mkdir -p /src
|
||||||
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
|
|
||||||
docker cp . $CONTAINER_NAME:/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
|
mkdir -p win_dist
|
||||||
docker cp $CONTAINER_NAME:/src/dist/. ./win_dist/
|
docker cp $CONTAINER_NAME:/src/dist_win/tamigo-cli.exe ./win_dist/tamigo-cli.exe
|
||||||
docker rm $CONTAINER_NAME
|
|
||||||
|
# 5. Cleanup
|
||||||
|
docker rm -f $CONTAINER_NAME
|
||||||
|
|
||||||
- name: Debug - List Files
|
- name: Debug - List Files
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
ls -R win_dist/ || echo "No win_dist folder"
|
ls -R win_dist/ || echo "win_dist not found"
|
||||||
find . -name "*.exe"
|
|
||||||
|
|
||||||
# Downgrade to v3 for Gitea compatibility
|
|
||||||
- name: Upload Windows Artifact
|
- name: Upload Windows Artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: binary-windows
|
name: tamigo-cli-windows-binary
|
||||||
path: win_dist/*.exe
|
path: win_dist/tamigo-cli.exe
|
||||||
|
|||||||
Reference in New Issue
Block a user