codecov / codecov-action

Compare 3e9a281 ... +4 ... 5a8bb47

Flags

Flags have been temporarily removed from this view while the flagging feature is refactored for better performance and user experience.

You can still use flags when viewing individual files. Flag-level thresholds will also remain on pull and merge requests in your repository provider.

More information can be found in our documentation.

Showing 2 of 11 files from the diff.
Newly tracked file
src/helpers.ts changed.
Other files ignored by Codecov
action.yml has changed.
dist/index.js.map has changed.
src/index.ts has changed.
dist/index.js has changed.
CHANGELOG.md has changed.
package-lock.json has changed.
src/validate.ts has changed.
package.json has changed.

@@ -9,30 +9,47 @@
Loading
9 9
    }
10 10
};
11 11
12 -
const getUploaderName = (): string => {
13 -
  if (isWindows()) {
12 +
const getUploaderName = (platform: string): string => {
13 +
  if (isWindows(platform)) {
14 14
    return 'codecov.exe';
15 15
  } else {
16 16
    return 'codecov';
17 17
  }
18 18
};
19 19
20 -
const isValidPlatform = (): boolean => {
21 -
  return PLATFORMS.includes(getPlatform());
20 +
const isValidPlatform = (platform: string): boolean => {
21 +
  return PLATFORMS.includes(platform);
22 22
};
23 23
24 -
const isWindows = (): boolean => {
25 -
  return getPlatform() === 'windows';
24 +
const isWindows = (platform: string): boolean => {
25 +
  return platform === 'windows';
26 26
};
27 27
28 -
const getPlatform = (): string => {
29 -
  return process.env.RUNNER_OS.toLowerCase();
28 +
const getPlatform = (os?: string): string => {
29 +
  if (isValidPlatform(os)) {
30 +
    core.info(`==> ${os} OS provided`);
31 +
    return os;
32 +
  }
33 +
34 +
  const platform = process.env.RUNNER_OS?.toLowerCase();
35 +
  if (isValidPlatform(platform)) {
36 +
    core.info(`==> ${platform} OS detected`);
37 +
    return platform;
38 +
  }
39 +
40 +
  core.info(
41 +
      '==> Could not detect OS or provided OS is invalid. Defaulting to linux',
42 +
  );
43 +
  return 'linux';
30 44
};
31 45
32 -
const BASEURL = `https://uploader.codecov.io/latest/${getPlatform()}/${getUploaderName()}`;
46 +
const getBaseUrl = (platform: string): string => {
47 +
  return `https://uploader.codecov.io/latest/${platform}/${getUploaderName(platform)}`;
48 +
};
33 49
34 50
export {
35 -
  BASEURL,
51 +
  PLATFORMS,
52 +
  getBaseUrl,
36 53
  getPlatform,
37 54
  getUploaderName,
38 55
  isValidPlatform,

@@ -27,6 +27,7 @@
Loading
27 27
  const flags = core.getInput('flags');
28 28
  const functionalities = core.getInput('functionalities');
29 29
  const name = core.getInput('name');
30 +
  const os = core.getInput('os');
30 31
  const overrideBranch = core.getInput('override_branch');
31 32
  const overrideBuild = core.getInput('override_build');
32 33
  const overrideCommit = core.getInput('override_commit');
@@ -146,7 +147,7 @@
Loading
146 147
    options.cwd = workingDir;
147 148
  }
148 149
149 -
  return {execArgs, options, failCi};
150 +
  return {execArgs, options, failCi, os};
150 151
};
151 152
152 153
export default buildExec;

Learn more Showing 1 files with coverage changes found.

New file src/helpers.ts
New
Loading file...
Files Coverage
demo 85.71%
src -1.74% 96.24%
Project Totals (4 files) 95.24%
Loading