Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
nickmerwin committed Aug 7, 2019
0 parents commit 0d75187
Show file tree
Hide file tree
Showing 933 changed files with 920,120 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
.DS_Store
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Nick Merwin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
30 changes: 30 additions & 0 deletions action.yml
@@ -0,0 +1,30 @@
# action.yml
name: 'Coveralls'
description: 'Send test coverage data to Coveralls.io for analysis, change tracking, and notifications.'
author: 'Nick Merwin (Coveralls, Inc.)'
inputs:
github-token:
required: true
path-to-lcov:
description: 'Path to lcov file'
required: true
default: './coverage/lcov.info'
parallel:
description: 'Set to true if you are running parallel jobs, then use "parallel_finished: true" for the last action.'
required: false
parallel-finished:
description: 'Set to true for the last action when using "parallel: true".'
required: false
coveralls-endpoint:
description: 'Coveralls Enterprise server (more info: https://enterprise.coveralls.io)'
required: false
default: 'https://coveralls.io'
outputs:
coveralls-api-result:
description: 'Result status of Coveralls API post.'
branding:
color: 'green'
icon: 'coveralls.svg'
runs:
using: 'node12'
main: './lib/main.js'
1 change: 1 addition & 0 deletions coveralls.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 changes: 108 additions & 0 deletions lib/main.js
@@ -0,0 +1,108 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const fs = require('fs');
const request = require('request');
const coveralls = require('coveralls');
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const githubToken = core.getInput('github-token');
if (!githubToken || githubToken == '') {
throw new Error("'github-token' input missing, please include it in your workflow settings 'with' section as 'github-token: ${{ secrets.github_token }}'");
}
process.env.COVERALLS_REPO_TOKEN = githubToken;
process.env.COVERALLS_SERVICE_NAME = 'github';
process.env.COVERALLS_GIT_COMMIT = process.env.GITHUB_SHA.toString();
process.env.COVERALLS_GIT_BRANCH = process.env.GITHUB_REF.toString();
const event = fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8');
if (process.env.COVERALLS_DEBUG) {
console.log("Event Name: " + process.env.GITHUB_EVENT_NAME);
console.log(event);
}
const sha = process.env.GITHUB_SHA.toString();
let jobId;
if (process.env.GITHUB_EVENT_NAME == 'pull_request') {
const pr = JSON.parse(event).number;
process.env.CI_PULL_REQUEST = pr;
jobId = `${sha}-PR-${pr}`;
}
else {
jobId = sha;
}
process.env.COVERALLS_SERVICE_JOB_ID = jobId;
const endpoint = core.getInput('coveralls-endpoint');
if (endpoint != '') {
process.env.COVERALLS_ENDPOINT = endpoint;
}
if (core.getInput('parallel-finished') != '') {
const payload = {
"repo_token": githubToken,
"repo_name": process.env.GITHUB_REPOSITORY,
"payload": { "build_num": jobId, "status": "done" }
};
request.post({
url: `${process.env.COVERALLS_ENDPOINT || 'https://coveralls.io'}/webhook`,
body: payload,
json: true
}, function (error, response, data) {
if (error) {
throw new Error(error);
}
try {
if (data.done) {
core.setOutput('coveralls-api-result', JSON.stringify(data));
}
else {
throw new Error(JSON.stringify(data));
}
}
catch (err) {
throw new Error('Parallel webhook error:' + err + ', ' + JSON.stringify(data));
}
});
return;
}
process.env.COVERALLS_PARALLEL = process.env.COVERALLS_PARALLEL || core.getInput('parallel');
const pathToLcov = core.getInput('path-to-lcov');
if (pathToLcov == '') {
throw new Error("No Lcov path specified.");
}
console.log(`Using lcov file: ${pathToLcov}`);
let file;
try {
file = fs.readFileSync(pathToLcov, 'utf8');
}
catch (err) {
throw new Error("Lcov file not found.");
}
coveralls.handleInput(file, function (err, body) {
if (err) {
core.setFailed(err);
}
else {
core.setOutput('coveralls-api-result', body);
}
});
}
catch (error) {
core.setFailed(error.message);
}
});
}
run();
1 change: 1 addition & 0 deletions node_modules/.bin/coveralls

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/esparse

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/esvalidate

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/js-yaml

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/sshpk-conv

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/sshpk-sign

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/sshpk-verify

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/tsc

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/tsserver

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/uuid

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

7 changes: 7 additions & 0 deletions node_modules/@actions/core/README.md

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

16 changes: 16 additions & 0 deletions node_modules/@actions/core/lib/command.d.ts

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

66 changes: 66 additions & 0 deletions node_modules/@actions/core/lib/command.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/core/lib/command.js.map

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

81 changes: 81 additions & 0 deletions node_modules/@actions/core/lib/core.d.ts

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

0 comments on commit 0d75187

Please sign in to comment.