Skip to content

Commit

Permalink
feat: add carryforward flags
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexox committed Feb 24, 2023
1 parent 3284643 commit f9de0bc
Show file tree
Hide file tree
Showing 872 changed files with 35,614 additions and 78,595 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The action's step needs to run after your test suite has outputted an LCOV file.
| `flag-name` | _optional (unique required if parallel)_ | Job flag name, e.g. "Unit", "Functional", or "Integration". Will be shown in the Coveralls UI. |
| `parallel` | _optional_ | Set to true for parallel (or matrix) based steps, where multiple posts to Coveralls will be performed in the check. `flag-name` needs to be set and unique, e.g. `flag-name: run-${{ matrix.test_number }}` |
| `parallel-finished` | _optional_ | Set to true in the last job, after the other parallel jobs steps have completed, this will send a webhook to Coveralls to set the build complete. |
| `carryforward` | _optional_ | Comma separated flags used to carryforward results from previous builds if some of the parallel jobs are missing. Used only with `parallel-finished`. |
| `coveralls-endpoint` | _optional_ | Hostname and protocol: `https://<host>`; Specifies a [Coveralls Enterprise](https://enterprise.coveralls.io/) hostname. |
| `base-path` | _optional_ | Path to the root folder of the project the coverage was collected in. Should be used in monorepos so that coveralls can process the LCOV correctly (e.g. packages/my-project) |
| `git-branch` | _optional_ | Default: GITHUB_REF environment variable. Override the branch name. |
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ inputs:
parallel-finished:
description: 'Set to true for the last action when using "parallel: true".'
required: false
carryforward:
description: 'Comma separated flags used to carryforward results from previous builds if some of the parallel jobs are missing.'
required: false
coveralls-endpoint:
description: 'Coveralls Enterprise server (more info: https://enterprise.coveralls.io)'
required: false
Expand Down
4 changes: 1 addition & 3 deletions lib/lcov-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.adjustLcovBasePath = void 0;
const path_1 = __importDefault(require("path"));
/**
* Adjusts the base path of all the paths in an LCOV file
* The paths in the LCOV file will be joined with the provided base path
* @param lcovFile a string containing an entire LCOV file
* @param basePath the base path to join with the LCOV file paths
*/
const adjustLcovBasePath = (lcovFile, basePath) => lcovFile.replace(/^SF:(.+)$/gm, (_, match) => `SF:${path_1.default.join(basePath, match)}`);
exports.adjustLcovBasePath = adjustLcovBasePath;
exports.adjustLcovBasePath = (lcovFile, basePath) => lcovFile.replace(/^SF:(.+)$/gm, (_, match) => `SF:${path_1.default.join(basePath, match)}`);
35 changes: 13 additions & 22 deletions lib/run.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,23 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
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) : adopt(result.value).then(fulfilled, rejected); }
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;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.run = void 0;
const core = __importStar(require("@actions/core"));
const fs_1 = __importDefault(require("fs"));
const request_1 = __importDefault(require("request"));
Expand Down Expand Up @@ -71,9 +57,14 @@ function run() {
}
const runId = process.env.GITHUB_RUN_ID;
process.env.COVERALLS_SERVICE_JOB_ID = runId;
const carryforward = core.getInput('carryforward');
if (carryforward != '') {
process.env.COVERALLS_CARRYFORWARD_FLAGS = carryforward;
}
if (core.getInput('parallel-finished') != '') {
const payload = {
"repo_token": githubToken,
"carryforward": process.env.COVERALLS_CARRYFORWARD_FLAGS,
"repo_name": process.env.GITHUB_REPOSITORY,
"payload": { "build_num": runId, "status": "done" }
};
Expand Down
17 changes: 3 additions & 14 deletions lib/run.spec.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
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 });
Expand Down Expand Up @@ -64,6 +52,7 @@ describe('Run', () => {
it('should run parallel finished', () => {
setup();
getInput.withArgs('parallel-finished').returns(1);
getInput.withArgs('carryforward').returns('job1,job2');
getInput.withArgs('coveralls-endpoint').returns('https://coveralls.io');
sandbox.stub(request, 'post');
run_1.run().then((result) => {
Expand Down
2 changes: 1 addition & 1 deletion node_modules/.bin/mocha

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

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

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

8 changes: 1 addition & 7 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.

Loading

0 comments on commit f9de0bc

Please sign in to comment.