Skip to content

Commit

Permalink
feat: Build for release
Browse files Browse the repository at this point in the history
  • Loading branch information
paambaati committed Mar 28, 2020
1 parent e583a0f commit 1efeb01
Show file tree
Hide file tree
Showing 521 changed files with 180,414 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [2.5.6] - 2020-03-28
### Fixed
- Correctly report `HEAD` SHA for PRs (and some nice refactors) - via [`#141`](https://github.com/paambaati/codeclimate-action/pull/141). Thanks @vladjerca!

# [2.5.5] - 2020-03-18
### Fixed
- `--prefix` fixes - via [`#131`](https://github.com/paambaati/codeclimate-action/pull/131). Thanks @rwjblue!
Expand Down
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@ branding:
color: 'gray-dark'
inputs:
coverageCommand:
required: false
description: 'Coverage command to execute'
default: 'yarn coverage'
debug:
required: false
description: 'Enable debugging logs for the Code Climate test reporter'
default: 'false'
coverageLocations:
required: false
description: 'Locations to find code coverage (Used for builds from multiple locations)'
default: '[]'
prefix:
required: false
description: 'See https://docs.codeclimate.com/docs/configuring-test-coverage'
default: ''
runs:
using: 'node12'
main: 'lib/main.js'
31 changes: 15 additions & 16 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ const fs_1 = require("fs");
const node_fetch_1 = __importDefault(require("node-fetch"));
const core_1 = require("@actions/core");
const exec_1 = require("@actions/exec");
const github_1 = require("@actions/github");
const DOWNLOAD_URL = `https://codeclimate.com/downloads/test-reporter/test-reporter-latest-${os_1.platform()}-amd64`;
const EXECUTABLE = './cc-reporter';
const DEFAULT_COVERAGE_COMMAND = 'yarn coverage';
const DEFAULT_CODECLIMATE_DEBUG = 'false';
const DEFAULT_COVERAGE_LOCATIONS = [];
const getOptionalString = (name, def = '') => core_1.getInput(name, { required: false }) || def;
const getOptionalArray = (name, def = []) => {
const input = core_1.getInput(name, { required: false });
return !input.length ? def : input.split(' ');
};
function downloadToFile(url, file, mode = 0o755) {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
try {
Expand All @@ -39,6 +45,7 @@ function downloadToFile(url, file, mode = 0o755) {
}
exports.downloadToFile = downloadToFile;
function prepareEnv() {
var _a, _b;
const env = process.env;
if (process.env.GITHUB_SHA !== undefined)
env.GIT_COMMIT_SHA = process.env.GITHUB_SHA;
Expand All @@ -48,6 +55,7 @@ function prepareEnv() {
env.GIT_BRANCH = env.GIT_BRANCH.replace(/^refs\/heads\//, ''); // Remove 'refs/heads/' prefix (See https://github.com/paambaati/codeclimate-action/issues/42)
if (process.env.GITHUB_EVENT_NAME === 'pull_request') {
env.GIT_BRANCH = process.env.GITHUB_HEAD_REF || env.GIT_BRANCH; // Report correct branch for PRs (See https://github.com/paambaati/codeclimate-action/issues/86)
env.GIT_COMMIT_SHA = (_b = (_a = github_1.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a['head']) === null || _b === void 0 ? void 0 : _b['sha']; // Report correct sha for the head branch (See https://github.com/paambaati/codeclimate-action/issues/140)
}
return env;
}
Expand All @@ -67,7 +75,7 @@ function run(downloadUrl = DOWNLOAD_URL, executable = EXECUTABLE, coverageComman
return reject(err);
}
const execOpts = {
env: prepareEnv()
env: prepareEnv(),
};
try {
lastExitCode = yield exec_1.exec(executable, ['before-build'], execOpts);
Expand Down Expand Up @@ -101,7 +109,7 @@ function run(downloadUrl = DOWNLOAD_URL, executable = EXECUTABLE, coverageComman
'-t',
type,
'-o',
`codeclimate.${i}.json`
`codeclimate.${i}.json`,
];
if (codeClimateDebug === 'true')
commands.push('--debug');
Expand All @@ -125,7 +133,7 @@ function run(downloadUrl = DOWNLOAD_URL, executable = EXECUTABLE, coverageComman
'-p',
`${coverageLocations.length}`,
'-o',
`coverage.total.json`
`coverage.total.json`,
];
if (codeClimateDebug === 'true')
sumCommands.push('--debug');
Expand Down Expand Up @@ -169,18 +177,9 @@ function run(downloadUrl = DOWNLOAD_URL, executable = EXECUTABLE, coverageComman
}
exports.run = run;
if (!module.parent) {
let coverageCommand = core_1.getInput('coverageCommand', { required: false });
if (!coverageCommand.length)
coverageCommand = DEFAULT_COVERAGE_COMMAND;
let codeClimateDebug = core_1.getInput('debug', { required: false });
if (!coverageCommand.length)
codeClimateDebug = DEFAULT_CODECLIMATE_DEBUG;
const coverageLocationsText = core_1.getInput('coverageLocations', {
required: false
});
const coverageLocations = coverageLocationsText.length
? coverageLocationsText.split(' ')
: DEFAULT_COVERAGE_LOCATIONS;
const coveragePrefix = core_1.getInput('prefix', { required: false });
const coverageCommand = getOptionalString('coverageCommand', DEFAULT_COVERAGE_COMMAND);
const codeClimateDebug = getOptionalString('debug', DEFAULT_CODECLIMATE_DEBUG);
const coverageLocations = getOptionalArray('coverageLocations', DEFAULT_COVERAGE_LOCATIONS);
const coveragePrefix = getOptionalString('prefix');
run(DOWNLOAD_URL, EXECUTABLE, coverageCommand, codeClimateDebug, coverageLocations, coveragePrefix);
}
1 change: 1 addition & 0 deletions node_modules/.bin/semver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/which

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions node_modules/@actions/github/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions node_modules/@actions/github/lib/context.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions node_modules/@actions/github/lib/context.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/@actions/github/lib/context.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions node_modules/@actions/github/lib/github.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 91 additions & 0 deletions node_modules/@actions/github/lib/github.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/@actions/github/lib/github.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1efeb01

Please sign in to comment.