enable GitHub Actions (#3503)
This commit is contained in:
27
.github/workflows/ci.yml
vendored
Normal file
27
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
name: CI
|
||||||
|
on: [ push, pull_request ]
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ ubuntu-latest, windows-latest ]
|
||||||
|
node: [ "0.10", 0.12, 4, 6, 8, 10, latest ]
|
||||||
|
script: [ compress, mocha, release/benchmark, release/jetstream ]
|
||||||
|
name: ${{ matrix.os }} ${{ matrix.node }} ${{ matrix.script }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
env:
|
||||||
|
NODE: ${{ matrix.node }}
|
||||||
|
TYPE: ${{ matrix.script }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- shell: bash
|
||||||
|
run: |
|
||||||
|
git clone --branch v1.5.2 --depth 1 https://github.com/jasongin/nvs.git ~/.nvs
|
||||||
|
. ~/.nvs/nvs.sh
|
||||||
|
nvs --version
|
||||||
|
nvs add node/$NODE
|
||||||
|
nvs use node/$NODE
|
||||||
|
node --version
|
||||||
|
npm --version --no-update-notifier
|
||||||
|
npm install --no-audit --no-optional --no-save --no-update-notifier
|
||||||
|
node test/$TYPE
|
||||||
24
.github/workflows/ufuzz.yml
vendored
Normal file
24
.github/workflows/ufuzz.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
name: Fuzzing
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "*/15 * * * *"
|
||||||
|
jobs:
|
||||||
|
ufuzz:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ ubuntu-latest, windows-latest ]
|
||||||
|
name: ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- shell: bash
|
||||||
|
run: |
|
||||||
|
git clone --branch v1.5.2 --depth 1 https://github.com/jasongin/nvs.git ~/.nvs
|
||||||
|
. ~/.nvs/nvs.sh
|
||||||
|
nvs --version
|
||||||
|
nvs add node/$NODE
|
||||||
|
nvs use node/$NODE
|
||||||
|
node --version
|
||||||
|
npm --version --no-update-notifier
|
||||||
|
npm install --no-audit --no-optional --no-save --no-update-notifier
|
||||||
|
node test/ufuzz/job 3600000
|
||||||
@@ -9,7 +9,7 @@ var U = require("./node");
|
|||||||
var file = process.argv[2];
|
var file = process.argv[2];
|
||||||
var dir = path.resolve(path.dirname(module.filename), "compress");
|
var dir = path.resolve(path.dirname(module.filename), "compress");
|
||||||
if (file) {
|
if (file) {
|
||||||
var minify_options = require("./ufuzz.json").map(JSON.stringify);
|
var minify_options = require("./ufuzz/options.json").map(JSON.stringify);
|
||||||
log("--- {file}", { file: file });
|
log("--- {file}", { file: file });
|
||||||
var tests = parse_test(path.resolve(dir, file));
|
var tests = parse_test(path.resolve(dir, file));
|
||||||
process.exit(Object.keys(tests).filter(function(name) {
|
process.exit(Object.keys(tests).filter(function(name) {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// ufuzz.js
|
|
||||||
// derived from https://github.com/qfox/uglyfuzzer by Peter van der Zee
|
// derived from https://github.com/qfox/uglyfuzzer by Peter van der Zee
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@@ -6,11 +5,11 @@
|
|||||||
// bin/uglifyjs s.js -c && bin/uglifyjs s.js -c passes=3 && bin/uglifyjs s.js -c passes=3 -m
|
// bin/uglifyjs s.js -c && bin/uglifyjs s.js -c passes=3 && bin/uglifyjs s.js -c passes=3 -m
|
||||||
// cat s.js | node && node s.js && bin/uglifyjs s.js -c | node && bin/uglifyjs s.js -c passes=3 | node && bin/uglifyjs s.js -c passes=3 -m | node
|
// cat s.js | node && node s.js && bin/uglifyjs s.js -c | node && bin/uglifyjs s.js -c passes=3 | node && bin/uglifyjs s.js -c passes=3 -m | node
|
||||||
|
|
||||||
require("../tools/exit");
|
require("../../tools/exit");
|
||||||
|
|
||||||
var UglifyJS = require("..");
|
var UglifyJS = require("../..");
|
||||||
var randomBytes = require("crypto").randomBytes;
|
var randomBytes = require("crypto").randomBytes;
|
||||||
var sandbox = require("./sandbox");
|
var sandbox = require("../sandbox");
|
||||||
|
|
||||||
var MAX_GENERATED_TOPLEVELS_PER_RUN = 1;
|
var MAX_GENERATED_TOPLEVELS_PER_RUN = 1;
|
||||||
var MAX_GENERATION_RECURSION_DEPTH = 12;
|
var MAX_GENERATION_RECURSION_DEPTH = 12;
|
||||||
@@ -1088,7 +1087,7 @@ var fallback_options = [ JSON.stringify({
|
|||||||
compress: false,
|
compress: false,
|
||||||
mangle: false
|
mangle: false
|
||||||
}) ];
|
}) ];
|
||||||
var minify_options = require("./ufuzz.json").map(JSON.stringify);
|
var minify_options = require("./options.json").map(JSON.stringify);
|
||||||
var original_code, original_result, errored;
|
var original_code, original_result, errored;
|
||||||
var uglify_code, uglify_result, ok;
|
var uglify_code, uglify_result, ok;
|
||||||
for (var round = 1; round <= num_iterations; round++) {
|
for (var round = 1; round <= num_iterations; round++) {
|
||||||
39
test/ufuzz/job.js
Normal file
39
test/ufuzz/job.js
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
var child_process = require("child_process");
|
||||||
|
|
||||||
|
var ping = 5 * 60 * 1000;
|
||||||
|
var period = +process.argv[2];
|
||||||
|
var endTime = Date.now() + period;
|
||||||
|
for (var i = 0; i < 2; i++) spawn(endTime);
|
||||||
|
|
||||||
|
function spawn(endTime) {
|
||||||
|
var child = child_process.spawn("node", [
|
||||||
|
"--max-old-space-size=2048",
|
||||||
|
"test/ufuzz"
|
||||||
|
], {
|
||||||
|
stdio: [ "ignore", "pipe", "pipe" ]
|
||||||
|
}).on("exit", respawn);
|
||||||
|
var line = "";
|
||||||
|
child.stdout.on("data", function(data) {
|
||||||
|
line += data;
|
||||||
|
});
|
||||||
|
child.stderr.once("data", function() {
|
||||||
|
process.exitCode = 1;
|
||||||
|
}).pipe(process.stdout);
|
||||||
|
var keepAlive = setInterval(function() {
|
||||||
|
var end = line.lastIndexOf("\r");
|
||||||
|
console.log(line.slice(line.lastIndexOf("\r", end - 1) + 1, end));
|
||||||
|
line = line.slice(end + 1);
|
||||||
|
}, ping);
|
||||||
|
var timer = setTimeout(function() {
|
||||||
|
clearInterval(keepAlive);
|
||||||
|
child.removeListener("exit", respawn);
|
||||||
|
child.kill();
|
||||||
|
}, endTime - Date.now());
|
||||||
|
|
||||||
|
function respawn() {
|
||||||
|
console.log(line);
|
||||||
|
clearInterval(keepAlive);
|
||||||
|
clearTimeout(timer);
|
||||||
|
spawn(endTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,13 +6,9 @@ var url = require("url");
|
|||||||
|
|
||||||
var period = 45 * 60 * 1000;
|
var period = 45 * 60 * 1000;
|
||||||
var wait = 2 * 60 * 1000;
|
var wait = 2 * 60 * 1000;
|
||||||
var ping = 5 * 60 * 1000;
|
if (process.argv.length > 2) {
|
||||||
if (process.argv[2] == "run") {
|
|
||||||
var endTime = Date.now() + period;
|
|
||||||
for (var i = 0; i < 2; i++) spawn(endTime);
|
|
||||||
} else if (process.argv.length > 2) {
|
|
||||||
var token = process.argv[2];
|
var token = process.argv[2];
|
||||||
var branch = process.argv[3] || "v" + require("../package.json").version;
|
var branch = process.argv[3] || "v" + require("../../package.json").version;
|
||||||
var repository = encodeURIComponent(process.argv[4] || "mishoo/UglifyJS2");
|
var repository = encodeURIComponent(process.argv[4] || "mishoo/UglifyJS2");
|
||||||
var concurrency = process.argv[5] || 1;
|
var concurrency = process.argv[5] || 1;
|
||||||
var platform = process.argv[6] || "latest";
|
var platform = process.argv[6] || "latest";
|
||||||
@@ -38,44 +34,11 @@ if (process.argv[2] == "run") {
|
|||||||
config: {
|
config: {
|
||||||
cache: false,
|
cache: false,
|
||||||
env: "NODE=" + platform,
|
env: "NODE=" + platform,
|
||||||
script: "node test/travis-ufuzz run"
|
script: "node test/ufuzz/job " + period
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
})();
|
})();
|
||||||
} else {
|
} else {
|
||||||
console.log("Usage: test/travis-ufuzz.js <token> [branch] [repository] [concurrency] [platform]");
|
console.log("Usage: test/ufuzz/travis.js <token> [branch] [repository] [concurrency] [platform]");
|
||||||
}
|
|
||||||
|
|
||||||
function spawn(endTime) {
|
|
||||||
var child = child_process.spawn("node", [
|
|
||||||
"--max-old-space-size=2048",
|
|
||||||
"test/ufuzz"
|
|
||||||
], {
|
|
||||||
stdio: [ "ignore", "pipe", "pipe" ]
|
|
||||||
}).on("exit", respawn);
|
|
||||||
var line = "";
|
|
||||||
child.stdout.on("data", function(data) {
|
|
||||||
line += data;
|
|
||||||
});
|
|
||||||
child.stderr.on("data", function() {
|
|
||||||
process.exitCode = 1;
|
|
||||||
}).pipe(process.stdout);
|
|
||||||
var keepAlive = setInterval(function() {
|
|
||||||
var end = line.lastIndexOf("\r");
|
|
||||||
console.log(line.slice(line.lastIndexOf("\r", end - 1) + 1, end));
|
|
||||||
line = line.slice(end + 1);
|
|
||||||
}, ping);
|
|
||||||
var timer = setTimeout(function() {
|
|
||||||
clearInterval(keepAlive);
|
|
||||||
child.removeListener("exit", respawn);
|
|
||||||
child.kill();
|
|
||||||
}, endTime - Date.now());
|
|
||||||
|
|
||||||
function respawn() {
|
|
||||||
console.log(line);
|
|
||||||
clearInterval(keepAlive);
|
|
||||||
clearTimeout(timer);
|
|
||||||
spawn(endTime);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user