From 309a8dc77d56832d3b4e157eb8ffe53bb34b4c1c Mon Sep 17 00:00:00 2001 From: Mads Jon Nielsen Date: Sun, 28 Feb 2021 10:26:25 +0100 Subject: [PATCH] Print how long a include file download takes --- README.md | 2 +- coverage/coverage-summary.json | 4 ++-- src/parser.ts | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 238570f88..edc0413b9 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Run gitlab pipelines locally as shell executor or docker executor. Get rid of all those dev specific shell scripts and make files. -[![Lines](https://img.shields.io/badge/Coverage-91.18%25-brightgreen.svg)](https://npmjs.org/package/gitlab-ci-local) +[![Lines](https://img.shields.io/badge/Coverage-90.79%25-brightgreen.svg)](https://npmjs.org/package/gitlab-ci-local) [![build](https://img.shields.io/github/workflow/status/firecow/gitlab-ci-local/build)](https://github.com/firecow/gitlab-ci-local/actions) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=firecow_gitlab-ci-local&metric=alert_status)](https://sonarcloud.io/dashboard?id=firecow_gitlab-ci-local) [![vulnerabilities](https://img.shields.io/snyk/vulnerabilities/github/firecow/gitlab-ci-local)](https://npmjs.org/package/gitlab-ci-local) diff --git a/coverage/coverage-summary.json b/coverage/coverage-summary.json index 04c0bf589..5b96443c4 100644 --- a/coverage/coverage-summary.json +++ b/coverage/coverage-summary.json @@ -1,9 +1,9 @@ -{"total": {"lines":{"total":703,"covered":641,"skipped":0,"pct":91.18},"statements":{"total":727,"covered":659,"skipped":0,"pct":90.65},"functions":{"total":115,"covered":102,"skipped":0,"pct":88.7},"branches":{"total":400,"covered":321,"skipped":0,"pct":80.25}} +{"total": {"lines":{"total":706,"covered":641,"skipped":0,"pct":90.79},"statements":{"total":730,"covered":659,"skipped":0,"pct":90.27},"functions":{"total":115,"covered":102,"skipped":0,"pct":88.7},"branches":{"total":400,"covered":321,"skipped":0,"pct":80.25}} ,"/home/mjn/Workspace/gitlab-ci-local/src/commander.ts": {"lines":{"total":109,"covered":94,"skipped":0,"pct":86.24},"functions":{"total":13,"covered":10,"skipped":0,"pct":76.92},"statements":{"total":117,"covered":99,"skipped":0,"pct":84.62},"branches":{"total":63,"covered":48,"skipped":0,"pct":76.19}} ,"/home/mjn/Workspace/gitlab-ci-local/src/default-cmd.ts": {"lines":{"total":44,"covered":40,"skipped":0,"pct":90.91},"functions":{"total":4,"covered":3,"skipped":0,"pct":75},"statements":{"total":44,"covered":40,"skipped":0,"pct":90.91},"branches":{"total":20,"covered":16,"skipped":0,"pct":80}} ,"/home/mjn/Workspace/gitlab-ci-local/src/job-expanders.ts": {"lines":{"total":56,"covered":55,"skipped":0,"pct":98.21},"functions":{"total":12,"covered":12,"skipped":0,"pct":100},"statements":{"total":56,"covered":55,"skipped":0,"pct":98.21},"branches":{"total":54,"covered":51,"skipped":0,"pct":94.44}} ,"/home/mjn/Workspace/gitlab-ci-local/src/job.ts": {"lines":{"total":207,"covered":192,"skipped":0,"pct":92.75},"functions":{"total":38,"covered":33,"skipped":0,"pct":86.84},"statements":{"total":215,"covered":197,"skipped":0,"pct":91.63},"branches":{"total":105,"covered":90,"skipped":0,"pct":85.71}} -,"/home/mjn/Workspace/gitlab-ci-local/src/parser.ts": {"lines":{"total":191,"covered":168,"skipped":0,"pct":87.96},"functions":{"total":22,"covered":20,"skipped":0,"pct":90.91},"statements":{"total":194,"covered":171,"skipped":0,"pct":88.14},"branches":{"total":109,"covered":75,"skipped":0,"pct":68.81}} +,"/home/mjn/Workspace/gitlab-ci-local/src/parser.ts": {"lines":{"total":194,"covered":168,"skipped":0,"pct":86.6},"functions":{"total":22,"covered":20,"skipped":0,"pct":90.91},"statements":{"total":197,"covered":171,"skipped":0,"pct":86.8},"branches":{"total":109,"covered":75,"skipped":0,"pct":68.81}} ,"/home/mjn/Workspace/gitlab-ci-local/src/stage.ts": {"lines":{"total":7,"covered":7,"skipped":0,"pct":100},"functions":{"total":7,"covered":7,"skipped":0,"pct":100},"statements":{"total":9,"covered":9,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}} ,"/home/mjn/Workspace/gitlab-ci-local/src/state.ts": {"lines":{"total":22,"covered":22,"skipped":0,"pct":100},"functions":{"total":4,"covered":4,"skipped":0,"pct":100},"statements":{"total":25,"covered":25,"skipped":0,"pct":100},"branches":{"total":8,"covered":6,"skipped":0,"pct":75}} ,"/home/mjn/Workspace/gitlab-ci-local/src/utils.ts": {"lines":{"total":66,"covered":62,"skipped":0,"pct":93.94},"functions":{"total":15,"covered":13,"skipped":0,"pct":86.67},"statements":{"total":66,"covered":62,"skipped":0,"pct":93.94},"branches":{"total":41,"covered":35,"skipped":0,"pct":85.37}} diff --git a/src/parser.ts b/src/parser.ts index 999c99683..eef57ee32 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -310,8 +310,11 @@ export class Parser { } static async downloadIncludeFile(cwd: string, project: string, ref: string, file: string, gitRemoteDomain: string): Promise { + const time = process.hrtime(); fs.ensureDirSync(`${cwd}/.gitlab-ci-local/includes/${project}/${ref}/`); await Utils.spawn(`git archive --remote=git@${gitRemoteDomain}:${project}.git ${ref} ${file} | tar -xC .gitlab-ci-local/includes/${project}/${ref}/`, cwd); + const endTime = process.hrtime(time); + process.stdout.write(`${cyan(`downloaded`)} ${magentaBright(`${gitRemoteDomain}/${project}/${file}`)} in ${magenta(prettyHrtime(endTime))}\n`); } static async initGitRemote(cwd: string): Promise {