Skip to content

Commit

Permalink
Merge pull request #72 from cortex-lab/separateLogs
Browse files Browse the repository at this point in the history
Separate logs
  • Loading branch information
k1o0 authored Apr 11, 2022
2 parents 04469c2 + d189fcc commit 7f4f57a
Show file tree
Hide file tree
Showing 8 changed files with 3,671 additions and 1,088 deletions.
16 changes: 13 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
# Changelog

## [Latest](https://github.com/cortex-lab/matlab-ci/commits/master) [3.0.1]
## [Latest](https://github.com/cortex-lab/matlab-ci/commits/master) [3.1.0]

## Modified

- dependency vulnerability fixes

## Added

- separate logs and context log URL parameter

## [3.0.1]

## Modified

- dependency vulnerability hotfix
- npm name changed to 'lab-ci' to conform with package rules
- fix build shield in readme

## [3.0.0]
## [3.0.0]

## Added

Expand All @@ -20,7 +30,7 @@
- param to skip checks when only ignored files changed
- param to skip draft PR event checks

## Modified
## Modified

- renamed MATLAB-CI to labCI
- records endpoint can return pending jobs
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# LabCI
[![Build Status](https://travis-ci.com/cortex-lab/LabCI.svg?branch=master)](https://travis-ci.com/cortex-lab/matlab-ci)
[![Coverage](https://img.shields.io/badge/coverage-92.13-brightgreen)](https://img.shields.io/badge/coverage-72.35-yellowgreen)
[![Coverage](https://img.shields.io/badge/coverage-91.91-brightgreen)](https://img.shields.io/badge/coverage-72.35-yellowgreen)

A small set of modules written in Node.js for running automated tests of MATLAB and Python code in response to GitHub events. Also submits code coverage to the Coveralls API.

Expand Down
13 changes: 10 additions & 3 deletions lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function addParam(url, ...args) {
if (url.indexOf('&') === -1 && !url.endsWith('/')) {
url += '/';
}
for (param of args) {
for (let param of args) {
url += (/\?/g.test(url) ? '&' : '?') + param;
}
return url;
Expand Down Expand Up @@ -356,7 +356,13 @@ async function buildRoutine(job) {
const logName = path.join(logDir, `std_output-${shortID(sha)}.log`);
await fs.promises.mkdir(logDir, { recursive: true });
const logDump = fs.createWriteStream(logName, {flags: 'w'});
logDump.on('close', () => debug('Closing log file'));
logDump.on('close', () => {
debug('Renaming log file');
let checkName = '_' + (data.context || '').split('/')[0];
let newName = path.join(logDir, `std_output-${shortID(sha)}${checkName}.log`);
// fs.rename(logName, newName, () => debug(`Log renamed to ${newName}`));
fs.copyFile(logName, newName, () => debug(`Log copied to ${newName}`));
});
const ops = config.shell ? {'shell': config.shell} : {};

const init = () => debug('Executing pipeline for job #%g', job.id);
Expand Down Expand Up @@ -573,7 +579,8 @@ function compareCoverage(job) {
if (records.filter(o => o.status === 'error').length > 0) {
log('One or more have error status; cannot compare coverage');
job.data.status = 'failure';
job.data.description = 'Failed to determine coverage as tests incomplete due to errors';
let which = records[0].status === 'error' ? 'HEAD' : 'BASE'; // Which branch is failing?
job.data.description = `Failed to determine coverage as tests incomplete on ${which} due to errors`;

// Both records present and they have coverage
} else if (records.length === 2 && hasCoverage) {
Expand Down
Loading

0 comments on commit 7f4f57a

Please sign in to comment.