Skip to content

Commit 945c9d8

Browse files
author
Nick Fields
committed
patch: migrate coverage from codeclimate to codecov
1 parent 94206c3 commit 945c9d8

File tree

8 files changed

+240
-79
lines changed

8 files changed

+240
-79
lines changed

.codeclimate.yml

-46
This file was deleted.

.github/scripts/ubuntu-init.sh

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
# update immediately because github agents aren't updated very often
22
sudo apt-get update
33
# Quiets the warnings after each apt-get
4-
sudo apt autoremove
5-
# Code climate reporter
6-
sudo curl -L -o /usr/local/bin/cc-test-reporter https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
7-
sudo chmod +x /usr/local/bin/cc-test-reporter
4+
sudo apt autoremove

.github/workflows/ci.yml

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: ci
2-
on:
2+
on:
33
push:
44
branches:
55
- '**'
@@ -20,19 +20,12 @@ jobs:
2020
node-version: '10.x'
2121
- name: install
2222
run: npm install
23-
- name: Configure Code Climate
24-
run: cc-test-reporter before-build
25-
env:
26-
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
2723
- name: lint
2824
run: npm run lint
2925
- name: test
3026
run: npm run test
31-
- name: Upload Results to Code Climate
32-
if: always()
33-
run: cc-test-reporter after-build
34-
env:
35-
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
27+
- name: coverage
28+
run: npm run coverage:report
3629
- name: Release
3730
if: github.ref == 'refs/heads/master'
3831
id: semantic
@@ -44,4 +37,4 @@ jobs:
4437
run: git tag -f v${MAJOR_VERSION} && git push --force origin refs/tags/v${MAJOR_VERSION}:refs/tags/v${MAJOR_VERSION}
4538
env:
4639
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47-
MAJOR_VERSION: ${{ steps.semantic.outputs.new_release_major_version }}
40+
MAJOR_VERSION: ${{ steps.semantic.outputs.new_release_major_version }}

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
66
[![Dependency Status](https://david-dm.org/InVisionApp/private-action-loader.svg)](https://david-dm.org/InVisionApp/private-action-loader)
77
[![devDependency Status](https://david-dm.org/InVisionApp/private-action-loader/dev-status.svg)](https://david-dm.org/InVisionApp/private-action-loader#info=devDependencies)
8-
[![Maintainability](https://api.codeclimate.com/v1/badges/42214051e003ca757d60/maintainability)](https://codeclimate.com/github/InVisionApp/private-action-loader/maintainability)
9-
[![Test Coverage](https://api.codeclimate.com/v1/badges/42214051e003ca757d60/test_coverage)](https://codeclimate.com/github/InVisionApp/private-action-loader/test_coverage)
8+
[![Code Coverage](https://codecov.io/gh/InVisionApp/private-action-loader/branch/master/graph/badge.svg?token=ouop84H9gO)](https://codecov.io/gh/InVisionApp/private-action-loader)
109

1110
This action loads and executes a private Action. This allows private actions to be reused in other private repositories. All inputs are passed down into the private action. All outputs of the private actions are passed back to the loader action.
1211

codecov.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# see https://docs.codecov.io/docs/codecovyml-reference for spec
2+
codecov:
3+
notify:
4+
require_ci_to_pass: true
5+
comment:
6+
layout: 'header, diff, tree'
7+
require_changes: false
8+
branches: null
9+
behavior: default
10+
flags: null
11+
paths: null
12+
coverage:
13+
precision: 2
14+
range:
15+
- 95.0
16+
- 100.0
17+
round: down
18+
status:
19+
changes: false
20+
patch: true
21+
project: true
22+
ignore:
23+
- 'dist/'
24+
- '**/node_modules/'
25+
- '**/__tests/'
26+
- '__mocks__/'

dist/index.js

+113-15
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ module.exports =
1919
/******/ };
2020
/******/
2121
/******/ // Execute the module function
22-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22+
/******/ var threw = true;
23+
/******/ try {
24+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
25+
/******/ threw = false;
26+
/******/ } finally {
27+
/******/ if(threw) delete installedModules[moduleId];
28+
/******/ }
2329
/******/
2430
/******/ // Flag the module as loaded
2531
/******/ module.l = true;
@@ -2789,6 +2795,32 @@ function parse(src) {
27892795
exports.parse = parse;
27902796

27912797

2798+
/***/ }),
2799+
2800+
/***/ 82:
2801+
/***/ (function(__unusedmodule, exports) {
2802+
2803+
"use strict";
2804+
2805+
// We use any as a valid input type
2806+
/* eslint-disable @typescript-eslint/no-explicit-any */
2807+
Object.defineProperty(exports, "__esModule", { value: true });
2808+
/**
2809+
* Sanitizes an input into a string so it can be passed into issueCommand safely
2810+
* @param input input to sanitize into a string
2811+
*/
2812+
function toCommandValue(input) {
2813+
if (input === null || input === undefined) {
2814+
return '';
2815+
}
2816+
else if (typeof input === 'string' || input instanceof String) {
2817+
return input;
2818+
}
2819+
return JSON.stringify(input);
2820+
}
2821+
exports.toCommandValue = toCommandValue;
2822+
//# sourceMappingURL=utils.js.map
2823+
27922824
/***/ }),
27932825

27942826
/***/ 87:
@@ -3726,6 +3758,42 @@ function regExpEscape (s) {
37263758
}
37273759

37283760

3761+
/***/ }),
3762+
3763+
/***/ 102:
3764+
/***/ (function(__unusedmodule, exports, __webpack_require__) {
3765+
3766+
"use strict";
3767+
3768+
// For internal use, subject to change.
3769+
var __importStar = (this && this.__importStar) || function (mod) {
3770+
if (mod && mod.__esModule) return mod;
3771+
var result = {};
3772+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
3773+
result["default"] = mod;
3774+
return result;
3775+
};
3776+
Object.defineProperty(exports, "__esModule", { value: true });
3777+
// We use any as a valid input type
3778+
/* eslint-disable @typescript-eslint/no-explicit-any */
3779+
const fs = __importStar(__webpack_require__(747));
3780+
const os = __importStar(__webpack_require__(87));
3781+
const utils_1 = __webpack_require__(82);
3782+
function issueCommand(command, message) {
3783+
const filePath = process.env[`GITHUB_${command}`];
3784+
if (!filePath) {
3785+
throw new Error(`Unable to find environment variable for file command ${command}`);
3786+
}
3787+
if (!fs.existsSync(filePath)) {
3788+
throw new Error(`Missing file at path: ${filePath}`);
3789+
}
3790+
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
3791+
encoding: 'utf8'
3792+
});
3793+
}
3794+
exports.issueCommand = issueCommand;
3795+
//# sourceMappingURL=file-command.js.map
3796+
37293797
/***/ }),
37303798

37313799
/***/ 117:
@@ -7761,7 +7829,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
77617829
var __importStar = (this && this.__importStar) || function (mod) {
77627830
if (mod && mod.__esModule) return mod;
77637831
var result = {};
7764-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
7832+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
77657833
__setModuleDefault(result, mod);
77667834
return result;
77677835
};
@@ -8606,6 +8674,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
86068674
};
86078675
Object.defineProperty(exports, "__esModule", { value: true });
86088676
const os = __importStar(__webpack_require__(87));
8677+
const utils_1 = __webpack_require__(82);
86098678
/**
86108679
* Commands
86118680
*
@@ -8660,13 +8729,13 @@ class Command {
86608729
}
86618730
}
86628731
function escapeData(s) {
8663-
return (s || '')
8732+
return utils_1.toCommandValue(s)
86648733
.replace(/%/g, '%25')
86658734
.replace(/\r/g, '%0D')
86668735
.replace(/\n/g, '%0A');
86678736
}
86688737
function escapeProperty(s) {
8669-
return (s || '')
8738+
return utils_1.toCommandValue(s)
86708739
.replace(/%/g, '%25')
86718740
.replace(/\r/g, '%0D')
86728741
.replace(/\n/g, '%0A')
@@ -8700,6 +8769,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
87008769
};
87018770
Object.defineProperty(exports, "__esModule", { value: true });
87028771
const command_1 = __webpack_require__(431);
8772+
const file_command_1 = __webpack_require__(102);
8773+
const utils_1 = __webpack_require__(82);
87038774
const os = __importStar(__webpack_require__(87));
87048775
const path = __importStar(__webpack_require__(622));
87058776
/**
@@ -8722,11 +8793,21 @@ var ExitCode;
87228793
/**
87238794
* Sets env variable for this action and future actions in the job
87248795
* @param name the name of the variable to set
8725-
* @param val the value of the variable
8796+
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
87268797
*/
8798+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
87278799
function exportVariable(name, val) {
8728-
process.env[name] = val;
8729-
command_1.issueCommand('set-env', { name }, val);
8800+
const convertedVal = utils_1.toCommandValue(val);
8801+
process.env[name] = convertedVal;
8802+
const filePath = process.env['GITHUB_ENV'] || '';
8803+
if (filePath) {
8804+
const delimiter = '_GitHubActionsFileCommandDelimeter_';
8805+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
8806+
file_command_1.issueCommand('ENV', commandValue);
8807+
}
8808+
else {
8809+
command_1.issueCommand('set-env', { name }, convertedVal);
8810+
}
87308811
}
87318812
exports.exportVariable = exportVariable;
87328813
/**
@@ -8742,7 +8823,13 @@ exports.setSecret = setSecret;
87428823
* @param inputPath
87438824
*/
87448825
function addPath(inputPath) {
8745-
command_1.issueCommand('add-path', {}, inputPath);
8826+
const filePath = process.env['GITHUB_PATH'] || '';
8827+
if (filePath) {
8828+
file_command_1.issueCommand('PATH', inputPath);
8829+
}
8830+
else {
8831+
command_1.issueCommand('add-path', {}, inputPath);
8832+
}
87468833
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
87478834
}
87488835
exports.addPath = addPath;
@@ -8765,12 +8852,22 @@ exports.getInput = getInput;
87658852
* Sets the value of an output.
87668853
*
87678854
* @param name name of the output to set
8768-
* @param value value to store
8855+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
87698856
*/
8857+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
87708858
function setOutput(name, value) {
87718859
command_1.issueCommand('set-output', { name }, value);
87728860
}
87738861
exports.setOutput = setOutput;
8862+
/**
8863+
* Enables or disables the echoing of commands into stdout for the rest of the step.
8864+
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
8865+
*
8866+
*/
8867+
function setCommandEcho(enabled) {
8868+
command_1.issue('echo', enabled ? 'on' : 'off');
8869+
}
8870+
exports.setCommandEcho = setCommandEcho;
87748871
//-----------------------------------------------------------------------
87758872
// Results
87768873
//-----------------------------------------------------------------------
@@ -8804,18 +8901,18 @@ function debug(message) {
88048901
exports.debug = debug;
88058902
/**
88068903
* Adds an error issue
8807-
* @param message error issue message
8904+
* @param message error issue message. Errors will be converted to string via toString()
88088905
*/
88098906
function error(message) {
8810-
command_1.issue('error', message);
8907+
command_1.issue('error', message instanceof Error ? message.toString() : message);
88118908
}
88128909
exports.error = error;
88138910
/**
88148911
* Adds an warning issue
8815-
* @param message warning issue message
8912+
* @param message warning issue message. Errors will be converted to string via toString()
88168913
*/
88178914
function warning(message) {
8818-
command_1.issue('warning', message);
8915+
command_1.issue('warning', message instanceof Error ? message.toString() : message);
88198916
}
88208917
exports.warning = warning;
88218918
/**
@@ -8873,8 +8970,9 @@ exports.group = group;
88738970
* Saves state for current action, the state can only be retrieved by this action's post job execution.
88748971
*
88758972
* @param name name of the state to store
8876-
* @param value value to store
8973+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
88778974
*/
8975+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
88788976
function saveState(name, value) {
88798977
command_1.issueCommand('save-state', { name }, value);
88808978
}
@@ -11882,7 +11980,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
1188211980
var __importStar = (this && this.__importStar) || function (mod) {
1188311981
if (mod && mod.__esModule) return mod;
1188411982
var result = {};
11885-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
11983+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1188611984
__setModuleDefault(result, mod);
1188711985
return result;
1188811986
};

0 commit comments

Comments
 (0)