diff --git a/.github/workflows/Build-and-deploy-win.yml b/.github/workflows/Build-and-deploy-win.yml index c6da08d36..6ea95a81a 100644 --- a/.github/workflows/Build-and-deploy-win.yml +++ b/.github/workflows/Build-and-deploy-win.yml @@ -17,17 +17,22 @@ jobs: - uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: "3.10" - uses: conda-incubator/setup-miniconda@v2 with: - activate-environment: env-electron-python + activate-environment: nwb-guide environment-file: tools/anaconda-env/environment-Windows.yml auto-activate-base: false - uses: actions/setup-node@v3 with: - node-version: "14" + node-version: "16" + + - name: Test PyInstaller build (Windows only) + run: | + npm run build:flask:win + node tests/testPyinstallerExecutable.js - name: Install package.json modules and their dependencies run: npm install --ignore-scripts @@ -35,5 +40,4 @@ jobs: - name: Build and deploy on Windows env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - npm run deploy:win + run: npm run deploy:win diff --git a/package.json b/package.json index 02b83eef5..c4da26281 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "test:coverage": "npm run coverage:app && npm run coverage:server", "coverage:app": "vitest run --coverage", "coverage:server": "pytest pyflask/tests/ -s --cov=pyflask --cov-report=xml", - "deploy:win": "npm run build && npm run build:flask:win && npm run deploy:electron:win", + "deploy:win": "npm run build && npm run build:flask:win && node tests/testPyinstallerExecutable.js && npm run deploy:electron:win", "deploy:mac": "npm run build && npm run build:flask:unix && npm run deploy:electron:mac", "deploy:linux": "npm run build && npm run build:flask:unix && npm run deploy:electron:linux", "deploy:electron:win": "electron-builder build --win --publish always", diff --git a/tests/testPyinstallerExecutable.js b/tests/testPyinstallerExecutable.js index fd571429e..186e8212f 100644 --- a/tests/testPyinstallerExecutable.js +++ b/tests/testPyinstallerExecutable.js @@ -3,10 +3,10 @@ const child_process = require("child_process"); const fs = require("fs"); const port = 1234; -const script = - process.argv[2] || - path.resolve(__dirname, `../build/flask/nwb-guide/nwb-guide${process.platform === "win32" ? ".exe" : ""}`); - +const script = path.resolve( + __dirname, + `../build/flask/nwb-guide/nwb-guide${process.platform === "win32" ? ".exe" : ""}` +); console.log("Found file", fs.existsSync(script)); const proc2 = child_process.spawn(`${script}`, [port + 1]); @@ -28,14 +28,17 @@ function handleProcess(proc, id = "process") { console.log(`Time to Start: ${(started - now).toFixed(2)}ms`); } console.error(`[${id}]: ${data}`); + //throw new Error("The distributable pyflask failed to run!"); }); proc.on("error", (error) => { console.error(`[${id}] error: ${error.message}`); + throw new Error("The distributable pyflask failed to run!"); }); proc.on("close", (code) => { console.error(`[${id}] exit: ${code}`); + throw new Error("The distributable pyflask failed to run!"); }); } else console.error("child process failed to start on port" + port); }