Add automated checks for desktop app runtime #233
- Add automation script for building, packaging, installing, executing and verifying Electron distrubtions across macOS, Ubuntu and Windows. - Add GitHub workflow to run the script to test distributions using the script. - Update README with new workflow status badge. - Add application initialization log to desktop applications to be able to test against crashes before application initialization.
This commit is contained in:
34
scripts/check-desktop-runtime-errors/app/extractors/linux.js
Normal file
34
scripts/check-desktop-runtime-errors/app/extractors/linux.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import { access, chmod } from 'fs/promises';
|
||||
import { constants } from 'fs';
|
||||
import { findSingleFileByExtension } from '../../utils/io.js';
|
||||
import { log } from '../../utils/log.js';
|
||||
|
||||
export async function prepareLinuxApp(desktopDistPath) {
|
||||
const { absolutePath: appFile } = await findSingleFileByExtension(
|
||||
'AppImage',
|
||||
desktopDistPath,
|
||||
);
|
||||
await makeExecutable(appFile);
|
||||
return {
|
||||
appExecutablePath: appFile,
|
||||
};
|
||||
}
|
||||
|
||||
async function makeExecutable(appFile) {
|
||||
if (!appFile) { throw new Error('missing file'); }
|
||||
if (await isExecutable(appFile)) {
|
||||
log('AppImage is already executable.');
|
||||
return;
|
||||
}
|
||||
log('Making it executable...');
|
||||
await chmod(appFile, 0o755);
|
||||
}
|
||||
|
||||
async function isExecutable(file) {
|
||||
try {
|
||||
await access(file, constants.X_OK);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user