Skip to content

Commit 8060b2d

Browse files
authored
ci: use self-hosted runners (#1107)
* ci: use self-hosted runners
1 parent 074dbf2 commit 8060b2d

6 files changed

Lines changed: 33 additions & 24 deletions

File tree

.github/workflows/node.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
build:
14-
runs-on: ubuntu-latest
14+
runs-on: self-hosted-arc
1515

1616
strategy:
1717
matrix:

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ permissions:
1515
jobs:
1616
publish:
1717
name: Publishing to NPM
18-
runs-on: ubuntu-latest
18+
runs-on: self-hosted-arc
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v4

.github/workflows/standalone-e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
integration-test:
9-
runs-on: ubuntu-latest
9+
runs-on: self-hosted-arc
1010
strategy:
1111
matrix:
1212
node-version: [20.18.1]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import _ from "lodash";
2+
import { BrowserName } from "../../../src/browser/types";
3+
4+
export const BROWSER_NAME = (process.env.BROWSER || "chrome").toLowerCase() as keyof typeof BrowserName;
5+
6+
export const BROWSER_CONFIG = {
7+
desiredCapabilities: {
8+
browserName: BROWSER_NAME,
9+
},
10+
headless: true,
11+
system: {
12+
debug: Boolean(process.env.DEBUG) || false,
13+
},
14+
};
15+
16+
if (/chrome/i.test(BROWSER_NAME)) {
17+
_.set(BROWSER_CONFIG.desiredCapabilities, "goog:chromeOptions", {
18+
args: ["--no-sandbox", "--disable-dev-shm-usage"],
19+
});
20+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { launchBrowser } from "../../../src/browser/standalone";
2+
import { BROWSER_CONFIG } from "./constants";
3+
4+
exports.mochaGlobalSetup = async function (): Promise<void> {
5+
// Here we trigger downloading browsers before running tests
6+
const browser = await launchBrowser(BROWSER_CONFIG);
7+
await browser.deleteSession();
8+
};

test/integration/standalone/standalone.test.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { strict as assert } from "assert";
2-
import _ from "lodash";
32
import { launchBrowser } from "../../../src/browser/standalone";
4-
import { BrowserName } from "../../../src/browser/types";
3+
import { BROWSER_CONFIG } from "./constants";
54

65
describe("Standalone Browser E2E Tests", function () {
76
this.timeout(25000);
@@ -16,32 +15,14 @@ describe("Standalone Browser E2E Tests", function () {
1615

1716
let browser: WebdriverIO.Browser;
1817

19-
const browserName = (process.env.BROWSER || "chrome").toLowerCase() as keyof typeof BrowserName;
20-
2118
after(async function () {
2219
if (browser) {
2320
await browser.deleteSession();
2421
}
2522
});
2623

2724
it("should launch browser and access a website", async function () {
28-
const browserConfig = {
29-
desiredCapabilities: {
30-
browserName,
31-
},
32-
headless: true,
33-
system: {
34-
debug: Boolean(process.env.DEBUG) || false,
35-
},
36-
};
37-
38-
if (/chrome/i.test(browserName)) {
39-
_.set(browserConfig.desiredCapabilities, "goog:chromeOptions", {
40-
args: ["--no-sandbox", "--disable-dev-shm-usage"],
41-
});
42-
}
43-
44-
browser = await launchBrowser(browserConfig);
25+
browser = await launchBrowser(BROWSER_CONFIG);
4526

4627
assert.ok(browser, "Browser should be initialized");
4728
assert.ok(browser.sessionId, "Browser should have a valid session ID");

0 commit comments

Comments
 (0)