Test: fix e2e tests (#318)
* fix whisper check test * ifx test action * update test action * fix test in ubuntu * update test-enjoy-app.yml * update workflows * update test trigger * add sdl2 dependencies for macos * update workflows
This commit is contained in:
@@ -6,6 +6,13 @@ import fs from "fs-extra";
|
||||
import log from "electron-log";
|
||||
import * as i18n from "i18next";
|
||||
|
||||
if (process.env.SETTINGS_PATH) {
|
||||
settings.configure({
|
||||
dir: process.env.SETTINGS_PATH,
|
||||
prettify: true,
|
||||
});
|
||||
}
|
||||
|
||||
const logger = log.scope("settings");
|
||||
const language = () => {
|
||||
const _language = settings.getSync("language");
|
||||
@@ -28,7 +35,8 @@ const libraryPath = () => {
|
||||
if (!_library || typeof _library !== "string") {
|
||||
settings.setSync(
|
||||
"library",
|
||||
path.join(app.getPath("documents"), LIBRARY_PATH_SUFFIX)
|
||||
process.env.LIBRARY_PATH ||
|
||||
path.join(app.getPath("documents"), LIBRARY_PATH_SUFFIX)
|
||||
);
|
||||
} else if (path.parse(_library).base !== LIBRARY_PATH_SUFFIX) {
|
||||
settings.setSync("library", path.join(_library, LIBRARY_PATH_SUFFIX));
|
||||
|
||||
@@ -46,16 +46,23 @@ class Whipser {
|
||||
}
|
||||
|
||||
async initialize() {
|
||||
const bundleModels = fs.readdirSync(this.bundledModelsDir);
|
||||
const models = [];
|
||||
|
||||
const bundledModels = fs.readdirSync(this.bundledModelsDir);
|
||||
for (const file of bundledModels) {
|
||||
const model = WHISPER_MODELS_OPTIONS.find((m) => m.name == file);
|
||||
if (!model) continue;
|
||||
|
||||
models.push({
|
||||
...model,
|
||||
savePath: path.join(this.bundledModelsDir, file),
|
||||
});
|
||||
}
|
||||
|
||||
const dir = path.join(settings.libraryPath(), "whisper", "models");
|
||||
fs.ensureDirSync(dir);
|
||||
const files = fs.readdirSync(dir);
|
||||
|
||||
const availableModelFiles = bundleModels.concat(files);
|
||||
|
||||
const models = [];
|
||||
for (const file of availableModelFiles) {
|
||||
for (const file of files) {
|
||||
const model = WHISPER_MODELS_OPTIONS.find((m) => m.name == file);
|
||||
if (!model) continue;
|
||||
|
||||
@@ -106,6 +113,7 @@ class Whipser {
|
||||
await this.initialize();
|
||||
|
||||
const model = this.currentModel();
|
||||
logger.debug(`Checking whisper model: ${model}`);
|
||||
|
||||
const sampleFile = path.join(__dirname, "samples", "jfk.wav");
|
||||
const tmpDir = settings.cachePath();
|
||||
|
||||
Reference in New Issue
Block a user