91 lines
2.9 KiB
YAML
91 lines
2.9 KiB
YAML
name: Build Tamigo CLI
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main", "master" ]
|
|
pull_request:
|
|
branches: [ "main", "master" ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-linux:
|
|
name: Build Linux Binary
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
- name: Build
|
|
run: pyinstaller --onefile --name tamigo-cli tamigo.py
|
|
- name: Upload Linux Artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: binary-linux
|
|
path: dist/tamigo-cli
|
|
|
|
build-windows:
|
|
name: Build Windows Binary
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Build Windows executable (Headless Cross-Compile)
|
|
run: |
|
|
# 1. Create a local Dockerfile with xvfb for headless UI support
|
|
cat <<EOF > Dockerfile.win
|
|
FROM python:3.10-slim
|
|
|
|
ENV WINEDEBUG=-all
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
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
|
|
docker cp . $CONTAINER_NAME:/src
|
|
docker start -a $CONTAINER_NAME
|
|
|
|
# 5. Extract results
|
|
mkdir -p win_dist
|
|
docker cp $CONTAINER_NAME:/src/dist/. ./win_dist/
|
|
docker rm $CONTAINER_NAME
|
|
|
|
- name: Debug - List Files
|
|
if: always()
|
|
run: |
|
|
ls -R win_dist/ || echo "No win_dist folder"
|
|
find . -name "*.exe"
|
|
|
|
# Downgrade to v3 for Gitea compatibility
|
|
- name: Upload Windows Artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: binary-windows
|
|
path: win_dist/*.exe
|