workaround sporadic I/O lags in GitHub Actions (#5612)
This commit is contained in:
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@@ -15,6 +15,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
NODE: ${{ matrix.node }}
|
NODE: ${{ matrix.node }}
|
||||||
TYPE: ${{ matrix.script }}
|
TYPE: ${{ matrix.script }}
|
||||||
|
UGLIFY_GITHUB_LAG: 10000
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
limit: 10000,
|
|
||||||
timeout: function(limit) {
|
timeout: function(limit) {
|
||||||
this.limit = limit;
|
this.limit = limit + lag;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
var lag = +process.env["UGLIFY_GITHUB_LAG"] || 0;
|
||||||
var tasks = [];
|
var tasks = [];
|
||||||
var titles = [];
|
var titles = [];
|
||||||
|
config.timeout(10000);
|
||||||
describe = function(title, fn) {
|
describe = function(title, fn) {
|
||||||
config = Object.create(config);
|
config = Object.create(config);
|
||||||
titles.push(title);
|
titles.push(title);
|
||||||
@@ -21,10 +22,11 @@ it = function(title, fn) {
|
|||||||
fn.titles.push(title);
|
fn.titles.push(title);
|
||||||
tasks.push(fn);
|
tasks.push(fn);
|
||||||
};
|
};
|
||||||
|
(function(arg) {
|
||||||
fs.readdirSync("test/mocha").filter(function(file) {
|
return arg ? [ arg ] : fs.readdirSync("test/mocha").filter(function(file) {
|
||||||
return /\.js$/.test(file);
|
return /\.js$/.test(file);
|
||||||
}).forEach(function(file) {
|
});
|
||||||
|
})(process.argv[2]).forEach(function(file) {
|
||||||
require("./mocha/" + file);
|
require("./mocha/" + file);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -66,12 +68,12 @@ process.nextTick(function run() {
|
|||||||
if (task.length) {
|
if (task.length) {
|
||||||
task.timeout = function(limit) {
|
task.timeout = function(limit) {
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
task.limit = limit;
|
task.limit = limit + lag;
|
||||||
timer = setTimeout(function() {
|
timer = setTimeout(function() {
|
||||||
raise(new Error("Timed out: exceeds " + limit + "ms"));
|
raise(new Error("Timed out: exceeds " + limit + "ms"));
|
||||||
}, limit);
|
}, limit);
|
||||||
};
|
};
|
||||||
task.timeout(task.limit);
|
task.timeout(task.limit - lag);
|
||||||
process.on("uncaughtException", raise);
|
process.on("uncaughtException", raise);
|
||||||
task.call(task, done);
|
task.call(task, done);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user