Skip to content

Commit 946613f

Browse files
authored
Add screen size configuration, update default (#9)
* Pass xvfb-server-args to start-xvfb.bash * Change to only screen size arg * Remove source map * Update default screen size. Echo screen size when running.
1 parent 5124e2e commit 946613f

File tree

8 files changed

+19
-16
lines changed

8 files changed

+19
-16
lines changed

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ inputs:
2828
description: 'directory where commands from `run` will be executed - defaults to cwd'
2929
required: false
3030
default: ""
31+
xvfb-screen-size:
32+
description: 'screen size passed to Xvfb'
33+
required: false
34+
default: '1280x1024x24'
3135
# snake_case alternatives for backward-compatibility
3236
# not adding deprecation notice at this time, but it can be done with
3337
# <input_id>.deprecationMessage: "don't use this!"

dist/index.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require('./sourcemap-register.js');/******/ (() => { // webpackBootstrap
1+
/******/ (() => { // webpackBootstrap
22
/******/ var __webpack_modules__ = ({
33

44
/***/ 109:
@@ -100,7 +100,7 @@ function startXvfb(env) {
100100
return __awaiter(this, void 0, void 0, function* () {
101101
console.log("::group::starting XVfb");
102102
const options = { env: env };
103-
const output = yield exec.getExecOutput("bash", [__nccwpck_require__.ab + "start-xvfb.bash"], options);
103+
const output = yield exec.getExecOutput("bash", [__nccwpck_require__.ab + "start-xvfb.bash", core.getInput("xvfb-screen-size")], options);
104104
if (output.exitCode == 0) {
105105
const result = output.stdout.split("\n");
106106
console.log("sleep for 1000ms");
@@ -157,8 +157,8 @@ function main() {
157157
console.log(`running on ${process.platform}`);
158158
if (process.platform == "linux") {
159159
yield installDeps(env);
160-
const [pid, display] = yield startXvfb(env);
161-
console.log(`xvfb pid=${pid}, display=${display}`);
160+
const [pid, display, screen] = yield startXvfb(env);
161+
console.log(`xvfb pid=${pid}, display=${display}, screen=${screen}`);
162162
env.DISPLAY = `:${display}`;
163163
yield linuxSetup(env);
164164
}
@@ -4303,5 +4303,4 @@ module.exports = require("util");
43034303
/******/ module.exports = __webpack_exports__;
43044304
/******/
43054305
/******/ })()
4306-
;
4307-
//# sourceMappingURL=index.js.map
4306+
;

dist/index.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/sourcemap-register.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/start-xvfb.bash

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ find_free_servernum() {
2121
}
2222

2323
SERVERNUM=$(find_free_servernum)
24+
SCREEN_SIZE=${1:-"1280x1024x24"}
2425

25-
# TODO: allow configuration of screen
26-
Xvfb :$SERVERNUM -screen 0, 1024x768x16 > /tmp/xvfb-output 2>&1 &
26+
Xvfb :"$SERVERNUM" -screen 0 "$SCREEN_SIZE" > /tmp/xvfb-output 2>&1 &
2727

2828
echo "$!"
2929
echo "$SERVERNUM"
30+
echo "$SCREEN_SIZE"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"format": "prettier --write '**/*.ts'",
99
"format-check": "prettier --check '**/*.ts'",
1010
"lint": "eslint src/**/*.ts",
11-
"package": "ncc build --source-map --license licenses.txt && npm run _copy-files-dist",
11+
"package": "ncc build --license licenses.txt && npm run _copy-files-dist",
1212
"test": "jest",
1313
"all": "npm run build && npm run format && npm run lint && npm run package && npm test",
1414
"_copy-files-lib": "cp src/start-xvfb.bash lib/",

src/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async function startXvfb(env: { [key: string]: string }): Promise<string[]> {
7474
const options: exec.ExecOptions = { env: env };
7575
const output: exec.ExecOutput = await exec.getExecOutput(
7676
"bash",
77-
[`${__dirname}/start-xvfb.bash`],
77+
[`${__dirname}/start-xvfb.bash`, core.getInput("xvfb-screen-size")],
7878
options
7979
);
8080
if (output.exitCode == 0) {
@@ -135,8 +135,8 @@ async function main() {
135135

136136
if (process.platform == "linux") {
137137
await installDeps(env);
138-
const [pid, display] = await startXvfb(env);
139-
console.log(`xvfb pid=${pid}, display=${display}`);
138+
const [pid, display, screen] = await startXvfb(env);
139+
console.log(`xvfb pid=${pid}, display=${display}, screen=${screen}`);
140140
env.DISPLAY = `:${display}`;
141141
await linuxSetup(env);
142142
}

src/start-xvfb.bash

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ find_free_servernum() {
2121
}
2222

2323
SERVERNUM=$(find_free_servernum)
24+
SCREEN_SIZE=${1:-"1280x1024x24"}
2425

25-
# TODO: allow configuration of screen
26-
Xvfb :$SERVERNUM -screen 0, 1024x768x16 > /tmp/xvfb-output 2>&1 &
26+
Xvfb :"$SERVERNUM" -screen 0 "$SCREEN_SIZE" > /tmp/xvfb-output 2>&1 &
2727

2828
echo "$!"
2929
echo "$SERVERNUM"
30+
echo "$SCREEN_SIZE"

0 commit comments

Comments
 (0)