Skip to content

Speed up AppVeyor builds by using build matrix to split into separate, parallel tasks such as unit tests, system tests and full build of artifacts #6944

Closed

Description

In the early days when PowerShell was still in Alpha state, the AppVeyor build took only 10 minutes, now it is nearly half an hour. This was very convenient for me as an early contributor where I could make minor changes without having to setup a dev environment locally and just download the MSI.
image

The free version of AppVeyor can run only 1 job at a time, but using the paid account that is used for PR builds, we can run multiple jobs in parallel when using a build matrix. They were originally designed for easy building and testing against different configurations and platforms (PSScriptAnalyzer uses them as well here) but we could still leverage that by splitting the whole build into independent chunks that will then run in parallel on separate AppVeyor VMs:

  • Quick build and running the Pester unit test suite
  • Running the XUnit tests
  • Running the Pester system tests (e.g. JEA, Admin tests, etc.) that take quite a while
  • Running the expensive feature tests
  • Full Build (CrossGen, MSI , etc) that produces artifacts.

Using this approach, I guess we should be able to go back to times of 10-15 minutes and also receive more test/artifact results faster due to the parallel nature.

Activity

  1. iSazonov commented on May 27, 2018

    @iSazonov
    Collaborator

    A problem is that we should first build a crossgened release and then run tests with the build.
    I remember that we had to do specially some xUnit tests sequential.

  2. added
    WG-Maintainers-Build
    Issue-Discussion
    on May 27, 2018
  3. markekraus commented on May 27, 2018

    @markekraus
    Contributor

    Christoph Bergmeister (@bergmeister) I'm Ok with this if it means that feature tests are run on every single PR. I think it presents a decent compromise between the need to ensure things aren't broken and making quick changes in markdown. Though, we'd need to ensure it doesn't make becoming a first time contributor to the project an overly burdensome experience too.

  4. bergmeister commented on May 27, 2018

    @bergmeister
    ContributorAuthor

    Ilya (@iSazonov)

    A problem is that we should first build a crossgened release and then run tests with the build.

    As far as I know AppVeyor does not support a similar concept to VSTS with Build and Release tasks where the Release (test) tasks use the artifact from the build. Parallel testing does not seem to have something in there that we could use for PowerShell tests.
    All elements in the build matrix (XUnit, Unit and feature Pester tests) will need some sort of time spent on building as each matrix element is on a different VM, the advantage of parallelism would then only kick in when running the tests. If the XUnit tests need a special initialisation (different build parameters or initialisation, then we need to handle that as a test suite preparation step). Running the feature tests as a special category therefore comes 'for free' because the overall time will then be given by the longest running task. But the point is also to get different test result (and artifacts earlier). I don't know too much about the whole test suites but naively speaking I propose:

    • Building in Debug (without CrossGen) and running quick Pester unit tests to cover up Debug.Assert and race conditions and get accurate stack traces
    • Building in Release with CrossGen and running expensive Pester tests (Admin, JEA and possibly feature tests), depending on the duration, this can be split further
    • XUnit tests (with whatever build/initialisation option is required/recommended by the team)
    • Full Build (Release, CrossGen, etc.) that produces artifacts but also runs MSI smoke tests, etc.

    To get an idea how it looks like and start small, we could try to first split only into 2 parts: Testing and ArtifactBuild
    In general, depending on how it goes we could then run tests also in various configurations (Debug/Release, with/without CrossGen)

    Mark Kraus (@markekraus) This should make it easier for first time contributors, because they know then more specifically what failed (e.g. was it a Pester tests, an XUnit test or did they break the MSI). Have a look at this PSSA run here for example, where one can see that the tests passed on Windows PowerShell (5.1) but not PowerShell Core (Windows and Linux) and also not on WMF4.

  5. bergmeister commented on May 27, 2018

    @bergmeister
    ContributorAuthor

    I have tried a test build with the packaging happening in a different job. The results below show the potential of how simple changes can yield a big speedup. However, one needs a paid account to run multiple build jobs in parallel, therefore this benefit will only apply to PR builds. As long as we don't increase the total build time on a fork too much, then I see this still as an improvement.

  6. added 2 commits that reference this issue on Jun 11, 2018
    fbbca53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-DiscussionResolution-FixedWG-Maintainers-Build

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions