mirror of
https://github.com/codecov/codecov-action.git
synced 2026-02-20 01:41:44 +00:00
wrap asyncs better
This commit is contained in:
parent
073e65f9d8
commit
8c56af11bc
2 changed files with 93 additions and 70 deletions
96
dist/index.js
vendored
96
dist/index.js
vendored
|
|
@ -14507,49 +14507,61 @@ var exec = __nccwpck_require__(1514);
|
||||||
var superagent = __nccwpck_require__(1524);
|
var superagent = __nccwpck_require__(1524);
|
||||||
// import buildExec from './buildExec';
|
// import buildExec from './buildExec';
|
||||||
// const {failCi} = buildExec();
|
// const {failCi} = buildExec();
|
||||||
console.log('oh hi');
|
try {
|
||||||
var uploader = (function () { return __awaiter(_this, void 0, void 0, function () {
|
var uploader = function () {
|
||||||
var err_1;
|
return function () { return __awaiter(_this, void 0, void 0, function () {
|
||||||
return __generator(this, function (_a) {
|
var uploadBinary, err_1;
|
||||||
switch (_a.label) {
|
return __generator(this, function (_a) {
|
||||||
case 0:
|
switch (_a.label) {
|
||||||
_a.trys.push([0, 2, , 3]);
|
case 0:
|
||||||
return [4 /*yield*/, superagent.get('https://uploader.codecov.io/latest/codecov-linux')];
|
_a.trys.push([0, 2, , 3]);
|
||||||
case 1: return [2 /*return*/, _a.sent()];
|
return [4 /*yield*/, superagent.get('https://uploader.codecov.io/latest/codecov-linux')];
|
||||||
case 2:
|
case 1:
|
||||||
err_1 = _a.sent();
|
uploadBinary = _a.sent();
|
||||||
core.setFailed("Codecov: Could not properly download uploader binary: " + err_1.message);
|
return [2 /*return*/, uploadBinary];
|
||||||
return [3 /*break*/, 3];
|
case 2:
|
||||||
case 3: return [2 /*return*/];
|
err_1 = _a.sent();
|
||||||
}
|
core.setFailed('Codecov: Could not properly download uploader binary: ' +
|
||||||
|
("" + err_1.message));
|
||||||
|
return [3 /*break*/, 3];
|
||||||
|
case 3: return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}); };
|
||||||
|
};
|
||||||
|
console.log(uploader);
|
||||||
|
var filename_1 = __dirname + '/uploader';
|
||||||
|
fs.writeFileSync(filename_1, uploader);
|
||||||
|
console.log('wrote it');
|
||||||
|
fs.chmodSync(filename_1, '700');
|
||||||
|
console.log('Did it');
|
||||||
|
console.log(fs.readdirSync(__dirname));
|
||||||
|
console.log(__dirname);
|
||||||
|
(function () {
|
||||||
|
return function () { return __awaiter(_this, void 0, void 0, function () {
|
||||||
|
var err_2;
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
switch (_a.label) {
|
||||||
|
case 0:
|
||||||
|
_a.trys.push([0, 2, , 3]);
|
||||||
|
return [4 /*yield*/, exec.exec(filename_1)];
|
||||||
|
case 1:
|
||||||
|
_a.sent();
|
||||||
|
return [3 /*break*/, 3];
|
||||||
|
case 2:
|
||||||
|
err_2 = _a.sent();
|
||||||
|
core.setFailed('Codecov: Could not properly run uploader binary: ' +
|
||||||
|
("" + err_2.message));
|
||||||
|
return [3 /*break*/, 3];
|
||||||
|
case 3: return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}); };
|
||||||
});
|
});
|
||||||
}); })();
|
}
|
||||||
console.log(uploader);
|
catch (err) {
|
||||||
var filename = __dirname + '/uploader';
|
core.setFailed("Codecov: Encountered an unexpected error: " + err.message);
|
||||||
fs.writeFileSync(filename, uploader);
|
}
|
||||||
console.log('wrote it');
|
|
||||||
fs.chmodSync(filename, '700');
|
|
||||||
console.log('Did it');
|
|
||||||
console.log(fs.readdirSync(__dirname));
|
|
||||||
console.log(__dirname);
|
|
||||||
(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
||||||
var err_2;
|
|
||||||
return __generator(this, function (_a) {
|
|
||||||
switch (_a.label) {
|
|
||||||
case 0:
|
|
||||||
_a.trys.push([0, 2, , 3]);
|
|
||||||
return [4 /*yield*/, exec.exec(filename)];
|
|
||||||
case 1:
|
|
||||||
_a.sent();
|
|
||||||
return [3 /*break*/, 3];
|
|
||||||
case 2:
|
|
||||||
err_2 = _a.sent();
|
|
||||||
core.setFailed("Codecov: Could not properly execute uploader binary: " + err_2.message);
|
|
||||||
return [3 /*break*/, 3];
|
|
||||||
case 3: return [2 /*return*/];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}); })();
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
|
||||||
67
src/index.ts
67
src/index.ts
|
|
@ -9,34 +9,45 @@ const superagent = require('superagent');
|
||||||
|
|
||||||
// const {failCi} = buildExec();
|
// const {failCi} = buildExec();
|
||||||
|
|
||||||
console.log('oh hi');
|
try {
|
||||||
const uploader = (async () => {
|
const uploader = () => {
|
||||||
try {
|
return async () => {
|
||||||
return await superagent.get('https://uploader.codecov.io/latest/codecov-linux');
|
try {
|
||||||
} catch (err) {
|
const uploadBinary = await superagent.get('https://uploader.codecov.io/latest/codecov-linux');
|
||||||
core.setFailed(
|
return uploadBinary;
|
||||||
`Codecov: Could not properly download uploader binary: ${err.message}`,
|
} catch (err) {
|
||||||
);
|
core.setFailed(
|
||||||
}
|
'Codecov: Could not properly download uploader binary: ' +
|
||||||
})();
|
`${err.message}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
console.log(uploader);
|
||||||
|
const filename = __dirname + '/uploader';
|
||||||
|
fs.writeFileSync(filename, uploader);
|
||||||
|
console.log('wrote it');
|
||||||
|
|
||||||
console.log(uploader);
|
fs.chmodSync(filename, '700');
|
||||||
const filename = __dirname + '/uploader';
|
|
||||||
fs.writeFileSync(filename, uploader);
|
|
||||||
console.log('wrote it');
|
|
||||||
|
|
||||||
fs.chmodSync(filename, '700');
|
console.log('Did it');
|
||||||
|
console.log(fs.readdirSync(__dirname));
|
||||||
|
console.log(__dirname);
|
||||||
|
|
||||||
console.log('Did it');
|
() => {
|
||||||
console.log(fs.readdirSync(__dirname));
|
return async () => {
|
||||||
console.log(__dirname);
|
try {
|
||||||
|
await exec.exec(filename);
|
||||||
(async () => {
|
} catch (err) {
|
||||||
try {
|
core.setFailed(
|
||||||
await exec.exec(filename);
|
'Codecov: Could not properly run uploader binary: ' +
|
||||||
} catch (err) {
|
`${err.message}`,
|
||||||
core.setFailed(
|
);
|
||||||
`Codecov: Could not properly execute uploader binary: ${err.message}`,
|
}
|
||||||
);
|
};
|
||||||
}
|
};
|
||||||
})();
|
} catch (err) {
|
||||||
|
core.setFailed(
|
||||||
|
`Codecov: Encountered an unexpected error: ${err.message}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue