feat: Use new Codecov uploader

This commit is contained in:
Tom Hu
2021-06-24 10:50:37 -04:00
parent b215992d02
commit 635d4e88ad
21 changed files with 45214 additions and 3633 deletions

41
src/helpers.ts Normal file
View File

@@ -0,0 +1,41 @@
import * as core from '@actions/core';
const PLATFORMS = ['alpine', 'linux', 'macos', 'windows'];
const setFailure = (message: string, failCi: boolean): void => {
failCi ? core.setFailed(message) : core.warning(message);
if (failCi) {
process.exit();
}
};
const getUploaderName = (): string => {
if (isWindows()) {
return 'codecov.exe';
} else {
return 'codecov';
}
};
const isValidPlatform = (): boolean => {
return PLATFORMS.includes(getPlatform());
};
const isWindows = (): boolean => {
return getPlatform() === 'windows';
};
const getPlatform = (): string => {
return process.env.RUNNER_OS.toLowerCase();
};
const BASEURL = `https://uploader.codecov.io/latest/${getPlatform()}/${getUploaderName()}`;
export {
BASEURL,
getPlatform,
getUploaderName,
isValidPlatform,
isWindows,
setFailure,
};