Search code examples
npmangular-cliappveyor

Timing of AppVeyor build steps


I'm driving an AppVeyor build with an appveyor.yml file, in this instance an Angular CLI build. This is a part of my file:

test_script:
  - npm run lint
  - npm test
  - npm run e2e
  - npm run build

Those are all npm scripts that delegate actual work to the ng cli.

How can I properly get timings for each step? My real build is even a bit bigger, and for starters I'd like to see (preferably as a summary) how long each step took.

I tried adding - ps: Get-Date -Format "o" in between each step, which is a workaround, but not really a nice one.

Can this be done in a more convenient manner?


Solution

  • Since the information is available in the tooltip, why not use CSS? That also works while the build is being updated. This is within my GreaseMonkey script (but I suppose you can also use the Style Editor in dev tools, Stylus or similar):

    ((css) => {
      let style = document.createElement("style");
      style.textContent = css;
      document.body.appendChild(style);
    })(`
    /* Stretch the log, do not limit its width */
    body > div > div.row {
      max-width: initial;
    }
    /* Prepend mm:ss before every line */
    div#job-console > div:before {
      visibility: visible;
      content: attr(title);
      color: gold;
      margin-top: 0;
      margin-left: -5rem;
      margin-right: 4em;
      height: auto;
      display: inline;
    }
    `);
    

    I use -5rem such that the hour part is exactly hidden (many tests do not take an hour to run, so provides you three more characters for the actual log message).