Skip to content

Commit 0c0cab8

Browse files
Disable webpack production mode in packaging to fix issue in linux (#276)
* added start and end session banner, change path of backend sever exe * use multi directory way to package backend * placeholder to control optimization in webpack * fix typo * Update rpe_test.yml to verbose the copy of device.xml * Update main.js to fix typo --------- Co-authored-by: Shiva Ahir <[email protected]>
1 parent fb4d21f commit 0c0cab8

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

.github/workflows/rpe_test.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,11 @@ jobs:
9393
if: ${{ matrix.os != 'ubuntu-22.04' }}
9494
run: npm test
9595

96-
- name: E2E Playwright tests on Linux latest & MacOS
96+
- name: E2E Playwright tests on Linux latest
9797
if: ${{ matrix.os == 'ubuntu-latest' }}
9898
run: |
99-
cp -rf Raptor/etc backend
99+
cp -rvf Raptor/etc backend
100+
ls -l backend/etc/device.xml
100101
npm run compile && xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npx playwright test
101102
102103
- name: cat RPE log

main.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const log = require('electron-log');
1010
const config = require('./rpe.config.json');
1111
const { kill } = require('./cleanup');
1212
const { openProjectRequest, saveProjectRequest } = require('./projectFile');
13+
const now = new Date();
1314

1415
const logFormat = '[{h}:{i}:{s}.{ms}] [{level}] {text}';
1516
log.transports.console.format = logFormat;
@@ -154,6 +155,13 @@ if (!isDev) {
154155
});
155156
log.transports.console.level = false; // silent console
156157
}
158+
159+
console.log(`
160+
=================================================
161+
RPE - Session Start at ${now.toLocaleString()}
162+
=================================================
163+
`);
164+
157165
const template = [
158166
{
159167
label: 'File',
@@ -241,7 +249,7 @@ const template = [
241249
const startFlaskServer = () => {
242250
let apiServer;
243251
const RestAPIscript = path.join(__dirname, 'backend/restapi_server.py');
244-
const restAPIexe = path.join(app.getAppPath(), '..', '..', 'backend', 'restapi_server.exe');
252+
const restAPIexe = path.join(app.getAppPath(), '..', '..', 'backend', 'restapi_server.exe', 'restapi_server.exe');
245253

246254
const args = [
247255
'--port', store.get('port'),
@@ -307,7 +315,7 @@ const createWindow = () => {
307315
store.set('device_xml', arg.device_xml);
308316
store.set('useDefaultFile', arg.useDefaultFile);
309317

310-
serverProcess.kill();
318+
kill(serverProcess);
311319

312320
app.relaunch();
313321
app.quit();
@@ -340,5 +348,10 @@ app.on("before-quit", function () {
340348
})
341349

342350
app.on('window-all-closed', () => {
351+
console.log(`
352+
=================================================
353+
RPE - Session closed at ${now.toLocaleString()}
354+
=================================================
355+
`);
343356
if (process.platform !== 'darwin') app.quit();
344357
});

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"test:playwright": "npx playwright test",
1414
"postinstall": "electron-builder install-app-deps",
1515
"pack": "electron-builder --dir",
16-
"dist": "pyinstaller --distpath backend --workpath dist -y --clean -n restapi_server.exe --onefile backend/restapi_server.py && webpack --mode production && electron-builder -p never"
16+
"dist": "pyinstaller --distpath backend --workpath dist -y --clean -n restapi_server.exe backend/restapi_server.py && webpack --mode development && electron-builder -p never"
1717
},
1818
"build": {
1919
"appId": "org.rapidsilicon.rapid_power_estimator",
@@ -94,6 +94,7 @@
9494
"@babel/core": "^7.23.9",
9595
"@babel/preset-env": "^7.24.4",
9696
"@babel/preset-react": "^7.24.1",
97+
"@playwright/test": "^1.48.1",
9798
"@testing-library/jest-dom": "^6.5.0",
9899
"@testing-library/react": "^14.3.1",
99100
"@testing-library/user-event": "^14.5.2",
@@ -114,7 +115,6 @@
114115
"react-test-renderer": "^18.3.1",
115116
"style-loader": "^3.3.4",
116117
"webpack": "^5.90.1",
117-
"@playwright/test": "^1.48.1",
118118
"webpack-cli": "^5.1.4"
119119
},
120120
"dependencies": {
@@ -136,4 +136,4 @@
136136
"type": "git",
137137
"url": "https://github.com/os-fpga/rapid_power_estimator.git"
138138
}
139-
}
139+
}

webpack.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,9 @@ module.exports = (env, argv) => {
3939
path: path.resolve(__dirname, 'build'),
4040
clean: true,
4141
},
42+
// optimization: {
43+
// minimize: false,
44+
// usedExports: false,
45+
// },
4246
};
4347
};

0 commit comments

Comments
 (0)