build-windows: comment frontend build step #1
This file contains 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: Build Windows Executable | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
cache: 'pnpm' | |
cache-dependency-path: './dweam_web/pnpm-lock.yaml' | |
- name: Install Visual Studio Build Tools | |
uses: microsoft/setup-msbuild@v2 | |
with: | |
msbuild-architecture: x64 | |
- name: Cache Poetry dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
./.venv | |
C:\Users\runneradmin\AppData\Local\pypoetry\Cache | |
C:\Users\runneradmin\AppData\Local\pip\Cache | |
key: ${{ runner.os }}-poetry-deps-${{ hashFiles('poetry.lock') }} | |
- name: Install Poetry | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install poetry poetry-pyinstaller-plugin | |
poetry config installer.parallel false | |
# - name: Cache frontend build | |
# uses: actions/cache@v4 | |
# with: | |
# path: ./dweam_web/dist | |
# key: ${{ runner.os }}-pnpm-build-${{ hashFiles('dweam_web/src/**') }} | |
# restore-keys: | | |
# ${{ runner.os }}-pnpm-build- | |
- name: Build frontend | |
shell: cmd | |
run: | | |
cd dweam_web | |
pnpm install | |
pnpm run build | |
if not exist dist\server ( | |
echo Frontend build failed - server directory missing | |
exit 1 | |
) | |
if not exist dist\client ( | |
echo Frontend build failed - client directory missing | |
exit 1 | |
) | |
cd .. | |
- name: Install Python dependencies | |
run: | | |
poetry config virtualenvs.in-project true | |
poetry install --no-interaction -E local | |
poetry add pyinstaller | |
- name: Prepare Node.js | |
shell: cmd | |
run: | | |
echo Copying Node.js executable... | |
copy "C:\Program Files\nodejs\node.exe" "node.exe" | |
if not exist node.exe ( | |
echo Failed to copy node.exe | |
exit 1 | |
) | |
echo Installing production dependencies... | |
copy dweam_web\package.json package.json | |
copy dweam_web\pnpm-lock.yaml pnpm-lock.yaml | |
pnpm install --prod --frozen-lockfile --shamefully-hoist | |
echo Copying Node.js built-in modules... | |
robocopy "C:\Program Files\nodejs\node_modules" "node_modules" /E /NFL /NDL /NJH /NJS /nc /ns /np || exit 0 | |
echo Verifying critical dependencies... | |
if not exist "node_modules\react" ( | |
echo ERROR: React module is missing! | |
dir /s node_modules | |
exit 1 | |
) | |
if not exist "node_modules\@astrojs" ( | |
echo ERROR: Astro modules are missing! | |
dir /s node_modules | |
exit 1 | |
) | |
echo Pruning unnecessary files... | |
for /d %%d in (node_modules\*) do ( | |
if exist "%%d\.git" rmdir /s /q "%%d\.git" | |
if exist "%%d\test" rmdir /s /q "%%d\test" | |
if exist "%%d\tests" rmdir /s /q "%%d\tests" | |
if exist "%%d\docs" rmdir /s /q "%%d\docs" | |
if exist "%%d\example" rmdir /s /q "%%d\example" | |
if exist "%%d\examples" rmdir /s /q "%%d\examples" | |
) | |
- name: Build Windows executable | |
shell: cmd | |
run: | | |
REM echo Building release version... | |
REM poetry run pyinstaller main.py --name dweam --onefile --noconsole ^ | |
REM --add-data "frontend\server;frontend\server" ^ | |
REM --add-data "frontend\client;frontend\client" ^ | |
REM --add-binary "node.exe;." ^ | |
REM --add-data "node_modules;node_modules" ^ | |
REM --debug all ^ | |
REM --log-level DEBUG | |
echo Building debug version... | |
poetry run pyinstaller main.py --name dweam-debug ^ | |
--add-data "dweam_web\dist\server;frontend\server" ^ | |
--add-data "dweam_web\dist\client;frontend\client" ^ | |
--add-binary "node.exe;." ^ | |
--add-data "node_modules;node_modules" ^ | |
--log-level INFO > pyinstaller_build.log 2>&1 | |
echo Verifying build output... | |
dir dist\dweam-debug\_internal\frontend /s | |
if not exist "dist\dweam-debug\_internal\frontend\client" ( | |
echo ERROR: Frontend client files are missing from build output! | |
exit 1 | |
) | |
if not exist "dist\dweam-debug\_internal\frontend\server" ( | |
echo ERROR: Frontend server files are missing from build output! | |
exit 1 | |
) | |
type pyinstaller_build.log | |
# - name: Upload release artifact | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: dweam-windows | |
# path: dist/dweam.exe | |
- name: Upload debug artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dweam-windows-debug | |
path: dist/dweam-debug/* |