Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and Deploy Windows #283

Closed
wants to merge 12 commits into from
14 changes: 9 additions & 5 deletions .github/workflows/Build-and-deploy-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,27 @@ 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

- name: Build and deploy on Windows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run deploy:win
run: npm run deploy:win
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 7 additions & 4 deletions tests/testPyinstallerExecutable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand All @@ -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);
}