Skip to content

Commit

Permalink
autumn cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan authored and Stefan committed Nov 1, 2021
1 parent 96c4d29 commit e692b61
Show file tree
Hide file tree
Showing 20 changed files with 7,528 additions and 3,835 deletions.
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ RUN source $NVM_DIR/nvm.sh \
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH

RUN curl https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb > /root/google-chrome-stable_current_amd64.deb
RUN apt install -y /root/google-chrome-stable_current_amd64.deb

RUN mkdir /server
RUN mkdir /build
RUN mkdir /src
Expand Down
Binary file added Linux_results.ods
Binary file not shown.
36 changes: 15 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,24 @@
"bench": "cd webdriver-ts && cross-env LANG=\"en_US.UTF-8\" node dist/benchmarkRunner.js",
"results": "cd webdriver-ts && npm run results",
"bench-all": "cd webdriver-ts && npm run bench && npm run results",
"selenium": "cd webdriver-ts && npm run bench && npm run results",
"compile-webdriver-ts": "cd webdriver-ts && npm run compile",
"install-webdriver-ts": "cd webdriver-ts && npm install && npm run compile",
"install-webdriver-ts-results": "cd webdriver-ts-results && npm install",
"install-local": "npm run install-webdriver-ts && npm run install-webdriver-ts-results",
"docker-build-image": "docker build -t js-framework-benchmark-ubuntu -f Dockerfile .",
"docker-start": "cross-env-shell docker run --rm -d -p 8080:8080 --name js-framework-benchmark --volume ${INIT_CWD}:/src --volume js-framework-benchmark:/build js-framework-benchmark-ubuntu",
"docker-stop": "docker stop js-framework-benchmark",
"docker-sync": "docker exec -it js-framework-benchmark rsync -avC --exclude /index.html --exclude /framework/**/dist --exclude /webdriver-ts*/dist --exclude node_modules --exclude /webdriver-ts/results*/ /src/ /build/",
"docker-sync-package-lock-back": "docker exec -it js-framework-benchmark bash sync-package-lock.sh",
"docker-build-frameworks": "npm run docker-sync && docker exec -it js-framework-benchmark npm install && docker exec -it js-framework-benchmark node rebuild-all.js --ci --docker --",
"docker-build-frameworks-non-ci": "npm run docker-sync && docker exec -it js-framework-benchmark npm install && docker exec -it js-framework-benchmark node rebuild-all.js --docker --",
"docker-install-webdriver": "npm run docker-sync && docker exec -it js-framework-benchmark npm run install-local",
"docker-create-index": "docker exec -it -w /build/webdriver-ts js-framework-benchmark npm run index",
"docker-rebuild": "docker exec -it js-framework-benchmark cp /src/rebuild-single.js /build/ && docker exec -it js-framework-benchmark node rebuild-single.js --docker",
"docker-rebuild-ci": "docker exec -it js-framework-benchmark cp /src/rebuild-single.js /build/ && docker exec -it js-framework-benchmark node rebuild-single.js --ci --docker",
"docker-bench": "docker exec -it -w /build/webdriver-ts js-framework-benchmark node dist/benchmarkRunner.js --headless",
"docker-results": "docker exec -it -w /build/webdriver-ts js-framework-benchmark npm run results",
"docker-shell": "docker exec -it js-framework-benchmark /bin/bash",
"docker-dev-webdriver": "npm run docker-sync && docker exec -it -w /build/webdriver-ts js-framework-benchmark npm run compile && docker exec -it -w /build/webdriver-ts js-framework-benchmark node dist/benchmarkRunner.js --headless",
"lerna-bootstrap": "lerna bootstrap",
"lerna-build-all": "lerna run build-prod",
"docker-lerna-bootstrap": "npm run docker-sync && docker exec -it js-framework-benchmark npm run lerna-bootstrap",
"docker-lerna-build-all": "npm run docker-sync && docker exec -it js-framework-benchmark npm run lerna-build-all"
"docker-build-image": "podman build -t js-framework-benchmark-ubuntu -f Dockerfile .",
"docker-start": "cross-env-shell podman run --rm -d -p 8080:8080 --name js-framework-benchmark --ipc=host -v /dev/shm:/dev/shm --volume ${INIT_CWD}:/src --volume js-framework-benchmark:/build js-framework-benchmark-ubuntu",
"docker-stop": "podman stop js-framework-benchmark",
"docker-sync": "podman exec -it js-framework-benchmark rsync -avC --exclude /index.html --exclude /framework/**/dist --exclude /webdriver-ts*/dist --exclude node_modules --exclude /webdriver-ts/results*/ /src/ /build/",
"docker-sync-package-lock-back": "podman exec -it js-framework-benchmark bash sync-package-lock.sh",
"docker-build-frameworks": "npm run docker-sync && podman exec -it js-framework-benchmark npm install && podman exec -it js-framework-benchmark node rebuild-all.js --ci --docker --",
"docker-build-frameworks-non-ci": "npm run docker-sync && podman exec -it js-framework-benchmark npm install && podman exec -it js-framework-benchmark node rebuild-all.js --docker --",

"rebuild": "node rebuild-single.js --",
"rebuild-ci": "node rebuild-single.js -- --ci",
"docker-rebuild": "node rebuild-single.js -- --docker",
"docker-rebuild-ci": "node rebuild-single.js -- --ci --docker",

"docker-shell": "podman exec -it js-framework-benchmark /bin/bash"
},
"keywords": [
"benchmark",
Expand Down Expand Up @@ -62,6 +57,5 @@
"yargs": "^15.3.1"
},
"devDependencies": {
"lerna": "^3.22.1"
}
}
76 changes: 76 additions & 0 deletions rebuild-build-single.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
var _ = require('lodash');
var exec = require('child_process').execSync;
var fs = require('fs');
var path = require('path');
var yargs = require('yargs');
const rimraf = require('rimraf');

let args = process.argv.length <= 2 ? [] : process.argv.slice(2, process.argv.length);

// Use npm ci or npm install ?
let ci = args.includes("--ci");
// Copy package-lock back for docker build or build locally?
let docker = args.includes("--docker");

let frameworks = args.filter(a => !a.startsWith("--"));

console.log("rebuild-build-single.js started: args", args, "ci", ci, "docker", docker, "frameworks", frameworks);

/*
rebuild-single.js [--ci] [--docker] [keyed/framework1 ... non-keyed/frameworkN]
This script rebuilds a single framework
By default it rebuilds from scratch, deletes all package.json and package-lock.json files
and invokes npm install and npm run build-prod for the benchmark
With argument --ci it rebuilds using the package-lock.json dependencies, i.e.
it calls npm ci and npm run build-prod for the benchmark
Pass list of frameworks
*/


if (frameworks.length == 0) {
console.log("ERROR: Missing arguments. Command: docker-rebuild keyed/framework1 non-keyed/framework2 ...");
process.exit(1);
}

for (f of frameworks) {
let components = f.split("/");
if (components.length != 2) {
console.log(`ERROR: invalid name ${f}. It must contain exactly one /.`)
process.exit(1);
}
let [keyed, name] = components;
let path = `frameworks/${keyed}/${name}`
if (docker) {
if (fs.existsSync(path)) {
console.log("deleting folder ", path);
exec(`rm -r ${path}`);
}
let rsync_cmd = `rsync -avC --exclude elm-stuff --exclude dist --exclude output ${ci ? '' : '--exclude package-lock.json'} --exclude tmp --exclude node_modules --exclude bower_components /src/frameworks/${keyed}/${name} /build/frameworks/${keyed}/`;
console.log(rsync_cmd);
exec(rsync_cmd,
{
stdio: 'inherit'
});
}
let rm_cmd = `rm -rf ${ci ? '' : 'package-lock.json'} yarn.lock dist elm-stuff bower_components node_modules output`;
console.log(rm_cmd);
exec(rm_cmd, {
cwd: path,
stdio: 'inherit'
});
let install_cmd = `npm ${ci ? 'ci' : 'install'} && npm run build-prod`;
console.log(install_cmd);
exec(install_cmd, {
cwd: path,
stdio: 'inherit'
});
if (docker) {
let packageLockPath = path + "/package-lock.json";
fs.copyFileSync(packageLockPath, "/src/" + packageLockPath)
}
}

console.log("rebuild-build-single.js finished: Build finsished sucessfully!");
49 changes: 49 additions & 0 deletions rebuild-check-single.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
var _ = require('lodash');
var exec = require('child_process').execSync;
var fs = require('fs');
var path = require('path');
var yargs = require('yargs');
const rimraf = require('rimraf');

let args = process.argv.length <= 2 ? [] : process.argv.slice(2, process.argv.length);

let frameworks = args.filter(a => !a.startsWith("--"));

console.log("rebuild-check-single.js started: args", args, "frameworks", frameworks);

/*
rebuild-single.js [--ci] [--docker] [keyed/framework1 ... non-keyed/frameworkN]
This script rebuilds a single framework
By default it rebuilds from scratch, deletes all package.json and package-lock.json files
and invokes npm install and npm run build-prod for the benchmark
With argument --ci it rebuilds using the package-lock.json dependencies, i.e.
it calls npm ci and npm run build-prod for the benchmark
Pass list of frameworks
*/

try {
let frameworkNames = frameworks.join(" ");
let bench_cmd = 'npm run bench -- --headless true --smoketest true ' + frameworkNames;
console.log(bench_cmd);
exec(bench_cmd, {
cwd: 'webdriver-ts',
stdio: 'inherit'
});

let keyed_cmd = 'npm run isKeyed -- --headless true ' + frameworkNames;
console.log(keyed_cmd);
exec(keyed_cmd, {
cwd: 'webdriver-ts',
stdio: 'inherit'
});

console.log("rebuild-check-single.js finished");
console.log("All checks are fine!");
console.log("======> Please rerun the benchmark: npm run bench ", frameworkNames);
} catch (e) {
console.log(`rebuild-check-single failed for ${frameworks.join(" ")}`);
process.exit(-1);
}
81 changes: 24 additions & 57 deletions rebuild-single.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,67 +29,34 @@ it calls npm ci and npm run build-prod for the benchmark
Pass list of frameworks
*/


if (frameworks.length == 0) {
console.log("ERROR: Missing arguments. Command: docker-rebuild keyed/framework1 non-keyed/framework2 ...");
process.exit(1);
}

for (f of frameworks) {
let components = f.split("/");
if (components.length != 2) {
console.log(`ERROR: invalid name ${f}. It must contain exactly one /.`)
try {
if (frameworks.length == 0) {
console.log("ERROR: Missing arguments. Command: docker-rebuild keyed/framework1 non-keyed/framework2 ...");
process.exit(1);
}
let [keyed, name] = components;
let path = `frameworks/${keyed}/${name}`
if (fs.existsSync(path)) {
console.log("deleting folder ", path);
exec(`rm -r ${path}`);

if (docker) {
let build_cmd = `podman exec -it js-framework-benchmark cp /src/rebuild-build-single.js /build/ && podman exec -it js-framework-benchmark node rebuild-build-single.js ${args.join(" ")}`;
console.log(build_cmd);
exec(build_cmd,
{
stdio: 'inherit'
});
} else {
let build_cmd = `node rebuild-build-single.js ${args.join(" ")}`;
console.log(build_cmd);
exec(build_cmd,
{
stdio: 'inherit'
});
}
let rsync_cmd = `rsync -avC --exclude elm-stuff --exclude dist --exclude output ${ci ? '' : '--exclude package-lock.json'} --exclude tmp --exclude node_modules --exclude bower_components /src/frameworks/${keyed}/${name} /build/frameworks/${keyed}/`;
console.log(rsync_cmd);
exec(rsync_cmd,

let check_cmd = `node rebuild-check-single.js ${args.join(" ")}`;
console.log(check_cmd);
exec(check_cmd,
{
stdio: 'inherit'
});
let rm_cmd = `rm -rf ${ci ? '' : 'package-lock.json'} yarn.lock dist elm-stuff bower_components node_modules output`;
console.log(rm_cmd);
exec(rm_cmd, {
cwd: path,
stdio: 'inherit'
});
let install_cmd = `npm ${ci ? 'ci' : 'install'} && npm run build-prod`;
console.log(install_cmd);
exec(install_cmd, {
cwd: path,
stdio: 'inherit'
});
if (docker) {
let packageLockPath = path + "/package-lock.json";
fs.copyFileSync(packageLockPath, "/src/" + packageLockPath)
}
} catch (e) {
console.log(`ERROR: Rebuilding ${args.join(" ")} was not successful`);
}

let frameworkNames = frameworks.join(" ");
let bench_cmd = 'npm run bench -- --headless --noResults --exitOnError true --count 1 ' + frameworkNames;
console.log(bench_cmd);
exec(bench_cmd, {
cwd: 'webdriver-ts',
stdio: 'inherit'
});

let keyed_cmd = 'npm run isKeyed -- --headless ' + frameworkNames;
console.log(keyed_cmd);
exec(keyed_cmd, {
cwd: 'webdriver-ts',
stdio: 'inherit'
});

exec('npm run index', {
cwd: 'webdriver-ts',
stdio: 'inherit'
});

console.log("All checks are fine!");
console.log("======> Please rerun the benchmark: npm run bench ", frameworkNames);
26 changes: 0 additions & 26 deletions results-ui/package.json

This file was deleted.

Loading

0 comments on commit e692b61

Please sign in to comment.