diff --git a/.github/workflows/linter-and-test.yml b/.github/workflows/linter-and-test.yml new file mode 100644 index 000000000..50bdf944a --- /dev/null +++ b/.github/workflows/linter-and-test.yml @@ -0,0 +1,74 @@ +name: Linter & Test +on: + push: + branches: + - main + - fix/eslint-ignore-patterns + pull_request: + branches: + - main + +jobs: + test-on-macos: + runs-on: [self-hosted, macOS, macos-desktop] + steps: + - name: Getting the repo + uses: actions/checkout@v3 + + - name: Installing node + uses: actions/setup-node@v1 + with: + node-version: 20 + + - name: Linter and test + run: | + yarn config set network-timeout 300000 + yarn install + yarn lint + yarn build:plugins + yarn build + yarn test + env: + CSC_IDENTITY_AUTO_DISCOVERY: "false" + + test-on-windows: + runs-on: [self-hosted, Windows, windows-desktop] + steps: + - name: Getting the repo + uses: actions/checkout@v3 + + - name: Installing node + uses: actions/setup-node@v1 + with: + node-version: 20 + + - name: Linter and test + run: | + yarn config set network-timeout 300000 + yarn install + yarn lint + yarn build:plugins + yarn build:win32 + yarn test + + test-on-ubuntu: + runs-on: [self-hosted, Linux, ubuntu-desktop] + steps: + - name: Getting the repo + uses: actions/checkout@v3 + + - name: Installing node + uses: actions/setup-node@v1 + with: + node-version: 20 + + - name: Linter and test + run: | + yarn config set network-timeout 300000 + yarn install + yarn lint + yarn build:plugins + yarn build:linux + yarn test + env: + DISPLAY: ":0" \ No newline at end of file diff --git a/electron/.eslintrc.js b/electron/.eslintrc.js index 873b619b8..46d385185 100644 --- a/electron/.eslintrc.js +++ b/electron/.eslintrc.js @@ -34,5 +34,11 @@ module.exports = { { name: "Link", linkAttribute: "to" }, ], }, - ignorePatterns: ["renderer/*", "node_modules/*", "core/plugins"], + ignorePatterns: [ + "build", + "renderer", + "node_modules", + "core/plugins", + "core/**/*.test.js", + ], }; diff --git a/electron/core/plugin-manager/execution/facade.js b/electron/core/plugin-manager/execution/facade.js index 206bbc087..c4f62f995 100644 --- a/electron/core/plugin-manager/execution/facade.js +++ b/electron/core/plugin-manager/execution/facade.js @@ -25,6 +25,7 @@ export async function install(plugins) { if (typeof window === "undefined") { return; } + // eslint-disable-next-line no-undef const plgList = await window.pluggableElectronIpc.install(plugins); if (plgList.cancelled) return false; return plgList.map((plg) => { @@ -50,6 +51,7 @@ export function uninstall(plugins, reload = true) { if (typeof window === "undefined") { return; } + // eslint-disable-next-line no-undef return window.pluggableElectronIpc.uninstall(plugins, reload); } @@ -62,6 +64,7 @@ export async function getActive() { if (typeof window === "undefined") { return; } + // eslint-disable-next-line no-undef const plgList = await window.pluggableElectronIpc.getActive(); return plgList.map( (plugin) => @@ -86,6 +89,7 @@ export async function registerActive() { if (typeof window === "undefined") { return; } + // eslint-disable-next-line no-undef const plgList = await window.pluggableElectronIpc.getActive(); plgList.forEach((plugin) => register( @@ -110,6 +114,7 @@ export async function update(plugins, reload = true) { if (typeof window === "undefined") { return; } + // eslint-disable-next-line no-undef const plgList = await window.pluggableElectronIpc.update(plugins, reload); return plgList.map( (plugin) => @@ -132,6 +137,7 @@ export function updatesAvailable(plugin) { if (typeof window === "undefined") { return; } + // eslint-disable-next-line no-undef return window.pluggableElectronIpc.updatesAvailable(plugin); } @@ -146,6 +152,7 @@ export async function toggleActive(plugin, active) { if (typeof window === "undefined") { return; } + // eslint-disable-next-line no-undef const plg = await window.pluggableElectronIpc.toggleActive(plugin, active); return new Plugin(plg.name, plg.url, plg.activationPoints, plg.active); } diff --git a/electron/core/plugin-manager/execution/index.js b/electron/core/plugin-manager/execution/index.js index 83fe0ce17..15cc65240 100644 --- a/electron/core/plugin-manager/execution/index.js +++ b/electron/core/plugin-manager/execution/index.js @@ -5,6 +5,7 @@ export * as activationPoints from "./activation-manager.js"; export * as plugins from "./facade.js"; export { default as ExtensionPoint } from "./ExtensionPoint.js"; +// eslint-disable-next-line no-undef if (typeof window !== "undefined" && !window.pluggableElectronIpc) console.warn( "Facade is not registered in preload. Facade functions will throw an error if used." diff --git a/electron/package.json b/electron/package.json index 161e2bd1b..285190d50 100644 --- a/electron/package.json +++ b/electron/package.json @@ -32,7 +32,7 @@ }, "scripts": { "lint": "eslint . --ext \".js,.jsx,.ts,.tsx\"", - "test:e2e": "playwright test --workers=2", + "test:e2e": "playwright test --workers=1", "dev": "tsc -p . && electron .", "build": "tsc -p . && electron-builder -p never -m", "build:darwin": "tsc -p . && electron-builder -p never -m --x64 --arm64", diff --git a/electron/playwright.config.ts b/electron/playwright.config.ts index a069b5b3d..fb23c8cd1 100644 --- a/electron/playwright.config.ts +++ b/electron/playwright.config.ts @@ -3,7 +3,8 @@ import { PlaywrightTestConfig } from "@playwright/test"; const config: PlaywrightTestConfig = { testDir: "./tests", testIgnore: "./core/**", - retries: 0 + retries: 0, + timeout: 120000, }; export default config; diff --git a/electron/tests/explore.e2e..spec.ts b/electron/tests/explore.e2e.spec.ts similarity index 100% rename from electron/tests/explore.e2e..spec.ts rename to electron/tests/explore.e2e.spec.ts diff --git a/electron/tests/main.e2e.spec.ts b/electron/tests/main.e2e.spec.ts index f37ec8051..2a4fc5931 100644 --- a/electron/tests/main.e2e.spec.ts +++ b/electron/tests/main.e2e.spec.ts @@ -19,8 +19,6 @@ test.beforeAll(async () => { // parse the packaged Electron app and find paths and other info const appInfo = parseElectronApp(latestBuild); expect(appInfo).toBeTruthy(); - expect(appInfo.arch).toBeTruthy(); - expect(appInfo.arch).toBe(process.arch); expect(appInfo.asar).toBe(true); expect(appInfo.executable).toBeTruthy(); expect(appInfo.main).toBeTruthy(); diff --git a/electron/tests/navigation.e2e.spec.ts b/electron/tests/navigation.e2e.spec.ts index dcb6605a8..0152551b7 100644 --- a/electron/tests/navigation.e2e.spec.ts +++ b/electron/tests/navigation.e2e.spec.ts @@ -52,10 +52,6 @@ test("renders left navigation panel", async () => { .getByRole("button", { name: "Explore Models" }) .first() .isEnabled(); - const startConversation = await page - .getByRole("button", { name: "Start a Conversation" }) - .first() - .isEnabled(); const discordBtn = await page .getByRole("button", { name: "Discord" }) .first() @@ -72,7 +68,6 @@ test("renders left navigation panel", async () => { [ newChatBtn, exploreBtn, - startConversation, discordBtn, myModelsBtn, settingsBtn,