diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..aa5ba2e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,51 @@ +name: CI + +on: + schedule: + - cron: '0 0 * * 0' # every Sunday at midnight + workflow_dispatch: # For manual triggering + push: + branches: [ master ] + pull_request: + branches: [ master, dev ] + +env: + DOTENV_CONFIG_PATH: ./test/fixtures/.env.test + +jobs: + build: + name: build ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false # Whether to stop execution of other instances + max-parallel: 4 + matrix: + os: ["ubuntu-latest", "windows-latest"] # , "macos-latest" + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Set up node + uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Install dependencies + run: npm install + - name: Run tests + run: | + npm run coverage + npx nyc report --reporter=lcovonly --reporter text + - name: Coveralls Parallel + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + flag-name: ${{ matrix.os }} + parallel: true + finish: + needs: build + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + parallel-finished: true diff --git a/.gitignore b/.gitignore index 8b94452..4f4a91f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ node_modules/* .env .pem +coverage/* +.nyc_output/* diff --git a/CHANGELOG.md b/CHANGELOG.md index b29205a..f1d09d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ # Changelog -## [Latest](https://github.com/cortex-lab/matlab-ci/commits/master) [3.1.0] +## [Latest](https://github.com/cortex-lab/matlab-ci/commits/master) [3.2.0] + +## Modified + + - if SIGTERM fails to end process(es) in under a minute, SIGKILL is sent + +## Added + + - git workflow + - set coveralls env vars + +## [3.1.0] ## Modified diff --git a/README.md b/README.md index 54ddfec..5aeec6c 100644 --- a/README.md +++ b/README.md @@ -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-91.91-brightgreen)](https://img.shields.io/badge/coverage-72.35-yellowgreen) +![CI workflow](https://github.com/cortex-lab/LabCI/actions/workflows/tests.yml/badge.svg?branch=main) +[![Coverage](https://img.shields.io/badge/coverage-91.69-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. @@ -111,6 +111,10 @@ Your test script must do the following: 2. Save the results into the JSON cache file without duplication 3. For code coverage the script must either save the coverage directly, or export a Cobertura formatted XML file. +## Coveralls +Coverage information can be sent to coveralls.io using the [node-coveralls](https://github.com/nickmerwin/node-coveralls) package. +Adding `COVERALLS_REPO_TOKEN` to the .env file will cause the CI to set other dynamic env variables before running a pipeline. + ## Built With * [LocalTunnel](https://localtunnel.me) - A secure tunneling service diff --git a/lib.js b/lib.js index 5eba459..0da117c 100644 --- a/lib.js +++ b/lib.js @@ -324,20 +324,48 @@ function getRepoPath(name) { function startJobTimer(job, kill_children = false) { const timeout = config.timeout || 8 * 60000; // How long to wait for the tests to run return setTimeout(() => { + let log = _log.extend('job_timer'); console.log('Max test time exceeded'); log(kill_children ? 'Killing all processes' : 'Ending test process'); let pid = job._child.pid; + log('Killing process(es) for job #%g, pid = %d', job.id, pid); job._child.kill(); - if (kill_children) { - kill(pid); - } + if (kill_children) kill(pid); + // Give the processes 1 minute before sending a more aggressive signal + return setTimeout(() => { + if (job._child && job._child.exitCode == null) { + log('Failed to kill job process(es); sending SIGKILL (job #%g, pid = %d)', job.id, pid); + job._child.kill('SIGKILL'); + if (kill_children) kill(pid, 'SIGKILL'); + } + }, 60000) }, timeout); } +/** + * Set dynamic env variables for node-coveralls. + * NB: This does not support submodules. + * @param {Object} job - The Job with an associated process in the data field. + */ +function initCoveralls(job) { + const debug = log.extend('pipeline'); + debug('Setting COVERALLS env variables'); + process.env.COVERALLS_SERVICE_JOB_ID = job.id; + const envMap = { + 'COVERALLS_SERVICE_NAME': job.data.context, + 'COVERALLS_GIT_COMMIT': job.data.sha, + 'COVERALLS_GIT_BRANCH': job.data.branch, + 'CI_PULL_REQUEST': job.data.pull_number + }; + for (let key in envMap) { // assign value or delete key + if (envMap[key]) { process.env[key] = envMap[key]; } else { delete process.env[key]; } + } +} + /** * Build task pipeline. Takes a list of scripts/functions and builds a promise chain. - * @param {Object} job - The path of the repository + * @param {Object} job - The Job with an associated process in the data field. * @returns {Promise} - The job routine */ async function buildRoutine(job) { @@ -365,6 +393,9 @@ async function buildRoutine(job) { }); const ops = config.shell ? {'shell': config.shell} : {}; + // If environment variable COVERALLS_REPO_TOKEN is not null, set dynamic variables + if (process.env.COVERALLS_REPO_TOKEN) initCoveralls(job); + const init = () => debug('Executing pipeline for job #%g', job.id); const routine = tasks.reduce(applyTask, Promise.resolve().then(init)); return routine @@ -411,6 +442,8 @@ async function buildRoutine(job) { clearTimeout(timer); }) .on('close', (code, signal) => { + // FIXME Sometime close is not called after a timeout, maybe because + // the IO streams are kept open by some process? const callback = (code === 0) ? resolve : reject; const proc = { code: code, @@ -419,6 +452,8 @@ async function buildRoutine(job) { stderr: stderr, process: child }; + // Ensure there's an exitCode as the second kill timer checks for this + if (child.exitCode === null) child.exitCode = -1; callback(proc); }); job.child = child; // Assign the child process to the job @@ -447,7 +482,7 @@ async function buildRoutine(job) { message = `${errored.code} - Failed to spawn ${file}`; } // Check if the process was killed (we'll assume by the test timeout callback) - } else if (errored.process.killed || errored.signal === 'SIGTERM') { + } else if (errored.process.killed || ['SIGTERM', 'SIGKILL'].includes(errored.signal)) { message = `Tests stalled after ~${(config.timeout / 60000).toFixed(0)} min`; } else { // Error raised by process; dig through stdout for reason debug('error from test function %s', file); @@ -511,10 +546,10 @@ async function buildRoutine(job) { */ function computeCoverage(job) { if (typeof job.data.coverage !== 'undefined' && job.data.coverage) { - console.log('Coverage already computed for job #' + job.id); + console.log('Coverage already computed for job #%g', job.id); return; } - console.log('Updating coverage for job #' + job.id); + console.log('Updating coverage for job #%g', job.id); const xmlPath = path.join(config.dataPath, 'reports', job.data.sha, 'CoverageResults.xml'); const modules = listSubmodules(process.env.REPO_PATH); return Coverage(xmlPath, job.data.repo, job.data.sha, modules).then(obj => { @@ -719,5 +754,5 @@ module.exports = { ensureArray, loadTestRecords, compareCoverage, computeCoverage, getBadgeData, log, shortID, openTunnel, APIError, queue, partial, startJobTimer, updateJobFromRecord, shortCircuit, isSHA, fullpath, strToBool, saveTestRecords, listSubmodules, getRepoPath, addParam, context2routine, - buildRoutine + buildRoutine, initCoveralls }; diff --git a/package-lock.json b/package-lock.json index 799e78e..ec4d8a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "@octokit/auth-app": "^2.10.2", "@octokit/request": "^5.4.9", + "coveralls": "^3.1.1", "debug": "^4.3.1", "dotenv": "^8.2.0", "express": "^4.17.1", @@ -435,6 +436,21 @@ "node": ">=8" } }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/ansi-colors": { "version": "4.1.1", "dev": true, @@ -492,7 +508,6 @@ }, "node_modules/argparse": { "version": "1.0.10", - "dev": true, "license": "MIT", "dependencies": { "sprintf-js": "~1.0.2" @@ -502,6 +517,22 @@ "version": "1.1.1", "license": "MIT" }, + "node_modules/asn1": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "dependencies": { + "safer-buffer": "~2.1.0" + } + }, + "node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", + "engines": { + "node": ">=0.8" + } + }, "node_modules/assertion-error": { "version": "1.1.0", "dev": true, @@ -512,9 +543,21 @@ }, "node_modules/asynckit": { "version": "0.4.0", - "dev": true, "license": "MIT" }, + "node_modules/aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", + "engines": { + "node": "*" + } + }, + "node_modules/aws4": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" + }, "node_modules/axios": { "version": "0.21.4", "license": "MIT", @@ -544,6 +587,14 @@ ], "license": "MIT" }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -672,6 +723,11 @@ "node": ">=6" } }, + "node_modules/caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" + }, "node_modules/chai": { "version": "4.2.0", "dev": true, @@ -800,7 +856,6 @@ }, "node_modules/combined-stream": { "version": "1.0.8", - "dev": true, "license": "MIT", "dependencies": { "delayed-stream": "~1.0.0" @@ -864,6 +919,29 @@ "dev": true, "license": "MIT" }, + "node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" + }, + "node_modules/coveralls": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.1.1.tgz", + "integrity": "sha512-+dxnG2NHncSD1NrqbSM3dn/lE57O6Qf/koe9+I7c+wzkqRmEvcp0kgJdxKInzYzkICKkFMZsX3Vct3++tsF9ww==", + "dependencies": { + "js-yaml": "^3.13.1", + "lcov-parse": "^1.0.0", + "log-driver": "^1.2.7", + "minimist": "^1.2.5", + "request": "^2.88.2" + }, + "bin": { + "coveralls": "bin/coveralls.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "dev": true, @@ -877,6 +955,17 @@ "node": ">= 8" } }, + "node_modules/dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", + "dependencies": { + "assert-plus": "^1.0.0" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/debug": { "version": "4.3.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", @@ -929,7 +1018,6 @@ }, "node_modules/delayed-stream": { "version": "1.0.0", - "dev": true, "license": "MIT", "engines": { "node": ">=0.4.0" @@ -965,6 +1053,15 @@ "node": ">=8" } }, + "node_modules/ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", + "dependencies": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "license": "Apache-2.0", @@ -1016,7 +1113,6 @@ }, "node_modules/esprima": { "version": "4.0.1", - "dev": true, "license": "BSD-2-Clause", "bin": { "esparse": "bin/esparse.js", @@ -1079,6 +1175,29 @@ "ms": "2.0.0" } }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "node_modules/extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", + "engines": [ + "node >=0.6.0" + ] + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, "node_modules/fast-safe-stringify": { "version": "2.0.7", "dev": true, @@ -1186,6 +1305,14 @@ "node": ">=8.0.0" } }, + "node_modules/forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", + "engines": { + "node": "*" + } + }, "node_modules/form-data": { "version": "3.0.0", "dev": true, @@ -1293,6 +1420,14 @@ "node": ">=8.0.0" } }, + "node_modules/getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", + "dependencies": { + "assert-plus": "^1.0.0" + } + }, "node_modules/github-webhook-handler": { "version": "1.0.0", "license": "MIT", @@ -1352,6 +1487,27 @@ "node": ">=4.x" } }, + "node_modules/har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", + "engines": { + "node": ">=4" + } + }, + "node_modules/har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "deprecated": "this library is no longer supported", + "dependencies": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/has": { "version": "1.0.3", "license": "MIT", @@ -1412,6 +1568,20 @@ "node": ">= 0.6" } }, + "node_modules/http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", + "dependencies": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "engines": { + "node": ">=0.8", + "npm": ">=1.3.7" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "license": "MIT", @@ -1566,7 +1736,6 @@ }, "node_modules/is-typedarray": { "version": "1.0.0", - "dev": true, "license": "MIT" }, "node_modules/is-unicode-supported": { @@ -1598,6 +1767,11 @@ "dev": true, "license": "ISC" }, + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, "node_modules/istanbul-lib-coverage": { "version": "3.0.0", "dev": true, @@ -1709,7 +1883,6 @@ }, "node_modules/js-yaml": { "version": "3.14.0", - "dev": true, "license": "MIT", "dependencies": { "argparse": "^1.0.7", @@ -1719,6 +1892,11 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" + }, "node_modules/jsesc": { "version": "2.5.2", "dev": true, @@ -1730,9 +1908,18 @@ "node": ">=4" } }, + "node_modules/json-schema": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, "node_modules/json-stringify-safe": { "version": "5.0.1", - "dev": true, "license": "ISC" }, "node_modules/json5": { @@ -1773,6 +1960,20 @@ "version": "2.1.2", "license": "MIT" }, + "node_modules/jsprim": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", + "dependencies": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + }, + "engines": { + "node": ">=0.6.0" + } + }, "node_modules/just-extend": { "version": "4.1.1", "dev": true, @@ -1795,6 +1996,14 @@ "safe-buffer": "^5.0.1" } }, + "node_modules/lcov-parse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-1.0.0.tgz", + "integrity": "sha512-aprLII/vPzuQvYZnDRU78Fns9I2Ag3gi4Ipga/hxnVMCZC8DnR2nI7XBqrPoywGfxqIx/DgarGvDJZAD3YBTgQ==", + "bin": { + "lcov-parse": "bin/cli.js" + } + }, "node_modules/localtunnel": { "version": "2.0.2", "license": "MIT", @@ -1905,6 +2114,14 @@ "dev": true, "license": "MIT" }, + "node_modules/log-driver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", + "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==", + "engines": { + "node": ">=0.8.6" + } + }, "node_modules/log-symbols": { "version": "4.1.0", "dev": true, @@ -2010,8 +2227,7 @@ "node_modules/minimist": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "node_modules/mocha": { "version": "9.2.2", @@ -2395,6 +2611,14 @@ "node": ">=6" } }, + "node_modules/oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "engines": { + "node": "*" + } + }, "node_modules/on-finished": { "version": "2.3.0", "license": "MIT", @@ -2521,6 +2745,11 @@ "node": "*" } }, + "node_modules/performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" + }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", @@ -2574,6 +2803,19 @@ "node": ">= 0.10" } }, + "node_modules/psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "engines": { + "node": ">=6" + } + }, "node_modules/qs": { "version": "6.7.0", "license": "BSD-3-Clause", @@ -2653,6 +2895,58 @@ "node": ">=4" } }, + "node_modules/request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", + "dependencies": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/request/node_modules/form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/request/node_modules/qs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "engines": { + "node": ">=0.6" + } + }, "node_modules/require-directory": { "version": "2.1.1", "license": "MIT", @@ -2868,9 +3162,32 @@ }, "node_modules/sprintf-js": { "version": "1.0.3", - "dev": true, "license": "BSD-3-Clause" }, + "node_modules/sshpk": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", + "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", + "dependencies": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "bin": { + "sshpk-conv": "bin/sshpk-conv", + "sshpk-sign": "bin/sshpk-sign", + "sshpk-verify": "bin/sshpk-verify" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/statuses": { "version": "1.5.0", "license": "MIT", @@ -3061,6 +3378,18 @@ "node": ">=0.6" } }, + "node_modules/tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dependencies": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -3073,6 +3402,22 @@ "tree-kill": "cli.js" } }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" + }, "node_modules/type-detect": { "version": "4.0.8", "dev": true, @@ -3127,6 +3472,14 @@ "node": ">= 0.8" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "license": "MIT" @@ -3140,7 +3493,6 @@ }, "node_modules/uuid": { "version": "3.4.0", - "dev": true, "license": "MIT", "bin": { "uuid": "bin/uuid" @@ -3153,6 +3505,19 @@ "node": ">= 0.8" } }, + "node_modules/verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", + "engines": [ + "node >=0.6.0" + ], + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -3678,6 +4043,17 @@ "indent-string": "^4.0.0" } }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, "ansi-colors": { "version": "4.1.1", "dev": true @@ -3715,7 +4091,6 @@ }, "argparse": { "version": "1.0.10", - "dev": true, "requires": { "sprintf-js": "~1.0.2" } @@ -3723,13 +4098,35 @@ "array-flatten": { "version": "1.1.1" }, + "asn1": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==" + }, "assertion-error": { "version": "1.1.0", "dev": true }, "asynckit": { - "version": "0.4.0", - "dev": true + "version": "0.4.0" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==" + }, + "aws4": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" }, "axios": { "version": "0.21.4", @@ -3743,6 +4140,14 @@ "base64-js": { "version": "1.5.1" }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", + "requires": { + "tweetnacl": "^0.14.3" + } + }, "binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -3832,6 +4237,11 @@ "version": "5.3.1", "dev": true }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" + }, "chai": { "version": "4.2.0", "dev": true, @@ -3917,7 +4327,6 @@ }, "combined-stream": { "version": "1.0.8", - "dev": true, "requires": { "delayed-stream": "~1.0.0" } @@ -3959,6 +4368,23 @@ "version": "2.1.2", "dev": true }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" + }, + "coveralls": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.1.1.tgz", + "integrity": "sha512-+dxnG2NHncSD1NrqbSM3dn/lE57O6Qf/koe9+I7c+wzkqRmEvcp0kgJdxKInzYzkICKkFMZsX3Vct3++tsF9ww==", + "requires": { + "js-yaml": "^3.13.1", + "lcov-parse": "^1.0.0", + "log-driver": "^1.2.7", + "minimist": "^1.2.5", + "request": "^2.88.2" + } + }, "cross-spawn": { "version": "7.0.3", "dev": true, @@ -3968,6 +4394,14 @@ "which": "^2.0.1" } }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", + "requires": { + "assert-plus": "^1.0.0" + } + }, "debug": { "version": "4.3.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", @@ -4000,8 +4434,7 @@ } }, "delayed-stream": { - "version": "1.0.0", - "dev": true + "version": "1.0.0" }, "depd": { "version": "1.1.2" @@ -4019,6 +4452,15 @@ "dotenv": { "version": "8.2.0" }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, "ecdsa-sig-formatter": { "version": "1.0.11", "requires": { @@ -4049,8 +4491,7 @@ "dev": true }, "esprima": { - "version": "4.0.1", - "dev": true + "version": "4.0.1" }, "etag": { "version": "1.8.1" @@ -4098,6 +4539,26 @@ } } }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==" + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, "fast-safe-stringify": { "version": "2.0.7", "dev": true @@ -4165,6 +4626,11 @@ "signal-exit": "^3.0.2" } }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==" + }, "form-data": { "version": "3.0.0", "dev": true, @@ -4216,6 +4682,14 @@ "version": "0.1.0", "dev": true }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", + "requires": { + "assert-plus": "^1.0.0" + } + }, "github-webhook-handler": { "version": "1.0.0", "requires": { @@ -4256,6 +4730,20 @@ "version": "1.10.5", "dev": true }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==" + }, + "har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "requires": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + } + }, "has": { "version": "1.0.3", "requires": { @@ -4292,6 +4780,16 @@ "toidentifier": "1.0.0" } }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, "iconv-lite": { "version": "0.4.24", "requires": { @@ -4376,8 +4874,7 @@ "dev": true }, "is-typedarray": { - "version": "1.0.0", - "dev": true + "version": "1.0.0" }, "is-unicode-supported": { "version": "0.1.0", @@ -4395,6 +4892,11 @@ "version": "2.0.0", "dev": true }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, "istanbul-lib-coverage": { "version": "3.0.0", "dev": true @@ -4473,19 +4975,32 @@ }, "js-yaml": { "version": "3.14.0", - "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" } }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" + }, "jsesc": { "version": "2.5.2", "dev": true }, + "json-schema": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, "json-stringify-safe": { - "version": "5.0.1", - "dev": true + "version": "5.0.1" }, "json5": { "version": "2.1.3", @@ -4514,6 +5029,17 @@ } } }, + "jsprim": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + } + }, "just-extend": { "version": "4.1.1", "dev": true @@ -4533,6 +5059,11 @@ "safe-buffer": "^5.0.1" } }, + "lcov-parse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-1.0.0.tgz", + "integrity": "sha512-aprLII/vPzuQvYZnDRU78Fns9I2Ag3gi4Ipga/hxnVMCZC8DnR2nI7XBqrPoywGfxqIx/DgarGvDJZAD3YBTgQ==" + }, "localtunnel": { "version": "2.0.2", "requires": { @@ -4609,6 +5140,11 @@ "version": "4.3.2", "dev": true }, + "log-driver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", + "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==" + }, "log-symbols": { "version": "4.1.0", "dev": true, @@ -4666,8 +5202,7 @@ "minimist": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "mocha": { "version": "9.2.2", @@ -4930,6 +5465,11 @@ } } }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, "on-finished": { "version": "2.3.0", "requires": { @@ -5006,6 +5546,11 @@ "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", "dev": true }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" + }, "picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", @@ -5037,6 +5582,16 @@ "ipaddr.js": "1.9.1" } }, + "psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, "qs": { "version": "6.7.0" }, @@ -5089,6 +5644,50 @@ "es6-error": "^4.0.1" } }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "qs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==" + } + } + }, "require-directory": { "version": "2.1.1" }, @@ -5238,8 +5837,23 @@ } }, "sprintf-js": { - "version": "1.0.3", - "dev": true + "version": "1.0.3" + }, + "sshpk": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", + "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } }, "statuses": { "version": "1.5.0" @@ -5348,6 +5962,15 @@ "toidentifier": { "version": "1.0.0" }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, "tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -5356,6 +5979,19 @@ "tree-kill": { "version": "1.2.2" }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" + }, "type-detect": { "version": "4.0.8", "dev": true @@ -5391,6 +6027,14 @@ "unpipe": { "version": "1.0.0" }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "requires": { + "punycode": "^2.1.0" + } + }, "util-deprecate": { "version": "1.0.2" }, @@ -5398,12 +6042,21 @@ "version": "1.0.1" }, "uuid": { - "version": "3.4.0", - "dev": true + "version": "3.4.0" }, "vary": { "version": "1.1.2" }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", diff --git a/package.json b/package.json index e0abcd8..aa8d1f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lab-ci", - "version": "3.1.0", + "version": "3.2.0", "description": "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.", "main": "main.js", "scripts": { @@ -22,6 +22,7 @@ "dependencies": { "@octokit/auth-app": "^2.10.2", "@octokit/request": "^5.4.9", + "coveralls": "^3.1.1", "debug": "^4.3.1", "dotenv": "^8.2.0", "express": "^4.17.1", @@ -35,9 +36,9 @@ "chai": "^4.2.0", "mocha": "^9.1.3", "nock": "^13.0.4", + "nyc": "^15.1.0", "sinon": "^9.2.1", - "supertest": "^6.0.1", - "nyc": "^15.1.0" + "supertest": "^6.0.1" }, "engines": { "node": ">=12.19.0" diff --git a/serve.js b/serve.js index ca9f3dc..a5671f9 100644 --- a/serve.js +++ b/serve.js @@ -349,13 +349,14 @@ srv.get('/:badge/:repo/:id', async (req, res) => { console.error(`No routine for "${context}" context`); return res.sendStatus(404); } - let isSHA = lib.isSHA(req.params.id); + const isSHA = lib.isSHA(req.params.id); // Find head commit of branch return fetchCommit(req.params.id, !isSHA, req.params.repo) .then(id => { data['context'] = context; data['sha'] = id; data['force'] = req.query.force === '' || lib.strToBool(req.query.force); + if (!isSHA) data['branch'] = req.params.id; // add branch name for coveralls console.log(`Request for ${req.params.id} ${data.context}`); const report = lib.getBadgeData(data); // Send report @@ -431,7 +432,7 @@ async function eventCallback(event) { status: 'pending', // The check state to update our context with description: null, // A brief description of what transpired context: null, // The precise check name, keeps track of what check we're doing - routine: null // A list of scripts call call + routine: null // A list of scripts to call }; // Double-check the event was intended for our app. This is also done using the headers before @@ -453,9 +454,10 @@ async function eventCallback(event) { switch (eventType) { case 'pull_request': let pr = event.payload.pull_request; - ref = pr.head.ref; job_template['sha'] = pr.head.sha; job_template['base'] = pr.base.sha; + job_template['pull_number'] = pr.number; // For coveralls.io + job_template['branch'] = pr.head.ref; // For coveralls.io // Check for repo fork; throw error if forked // TODO Add full stack test for this behaviour let isFork = (pr.base.repo.owner.login !== pr.head.repo.owner.login) || (pr.base.repo.owner.login !== process.env['REPO_OWNER']) @@ -469,15 +471,16 @@ async function eventCallback(event) { } break; case 'push': - ref = event.payload.ref; job_template['sha'] = event.payload.head_commit.id || event.payload.after; // Run tests for head commit only job_template['base'] = event.payload.before; + job_template['branch'] = event.payload.ref; // For coveralls.io filesGET['base'] = event.payload.before; filesGET['head'] = event.payload.head_commit.id || event.payload.after; break; default: // Shouldn't get this far throw new TypeError(`event "${event.event}" not supported`); } + ref = job_template['branch']; // Log the event console.log('Received a %s event for %s to %s', diff --git a/test/fixtures/.env.test b/test/fixtures/.env.test index 9a6f452..68332c8 100644 --- a/test/fixtures/.env.test +++ b/test/fixtures/.env.test @@ -7,4 +7,4 @@ REPO_NAME=Hello-World REPO_OWNER=Codertocat TUNNEL_HOST=https://domain.ext TUNNEL_SUBDOMAIN=sub -NODE_ENV=test \ No newline at end of file +NODE_ENV=test diff --git a/test/lib.test.js b/test/lib.test.js index dcac085..196d316 100644 --- a/test/lib.test.js +++ b/test/lib.test.js @@ -316,8 +316,12 @@ describe('Test startJobTimer:', function () { }); it('expect process killed', function (done) { + let nCalls = 0; // Make sure we only call done once, after first timeout const childProcess = { - kill: () => { done(); }, + kill: () => { + nCalls++; + if (nCalls === 1) done(); + }, pid: 10108 }; const job = queue.add({}); @@ -340,6 +344,26 @@ describe('Test startJobTimer:', function () { clock.tick(config.timeout + 1); }); + it('expect SIGKILL', function (done) { + // Test second timeout for tests where SIGTERM fails to end process + let nCalls = 0; + const childProcess = { + kill: (sig) => { + nCalls++; + if (nCalls === 2) { + expect(sig).eq('SIGKILL'); + done(); + } + }, + pid: 10108 + }; + const job = queue.add({}); + job.child = childProcess; + lib.startJobTimer(job); + // Skip to the end... + clock.tick(config.timeout + 60001); // timeout + ~1 minute + }); + after(() => { clock.restore(); }); @@ -350,6 +374,42 @@ describe('Test startJobTimer:', function () { }); +/** + * A test for the function initCoveralls. Should modify the env variables with coveralls data. + */ +describe('Test initCoveralls:', function () { + var env_bk; + + before(() => { + env_bk = process.env; + }); + + it('expect env modified', function () { + const job = { + id: Number(Math.floor(Math.random() * 1e6)), + data: { + sha: ids[0], + branch: 'FooBar' + } + }; + lib.initCoveralls(job); + expect(process.env.COVERALLS_GIT_COMMIT).eq(ids[0]); + expect(process.env.COVERALLS_GIT_BRANCH).eq('FooBar'); + expect(process.env.COVERALLS_SERVICE_JOB_ID).eq(job.id.toString()); + expect(process.env).to.not.have.property('CI_PULL_REQUEST'); + expect(process.env).to.not.have.property('COVERALLS_SERVICE_NAME'); + // Remove branch from job data + delete job.data.branch; + lib.initCoveralls(job); + expect(process.env).to.not.have.property('COVERALLS_GIT_BRANCH'); + }); + + afterEach(() => { + process.env = env_bk; + }); +}); + + /** * This tests the buildRoutine function. */ diff --git a/test/serve.test.js b/test/serve.test.js index 09ff427..f13c4ee 100644 --- a/test/serve.test.js +++ b/test/serve.test.js @@ -1102,18 +1102,18 @@ describe('srv github/', () => { /** * This is already covered by the setAccessToken test... */ - it('expect token set', done => { + xit('expect token set', done => { // Although the blob signature won't match, we can at least test that setAccessToken was called request(srv) .post(`/github`) // trailing slash essential .set({ 'X-GitHub-Event': 'push', 'x-github-hook-installation-target-id': process.env.GITHUB_APP_IDENTIFIER, - 'X-Hub-Signature': {'sha': SHA}, + 'X-Hub-Signature': `sha1=${SHA}`, 'X-GitHub-Delivery': '72d3162e-cc78-11e3-81ab-4c9367dc0958' }) .end(function (err) { - expect(scope.pendingMocks().length).lt(2); // setAccessToken was called + expect(scope.pendingMocks().length).eq(1); // setAccessToken was called err ? done(err) : done(); }); });