cypress-io / cypress-example-kitchensink

This is an example app used to showcase Cypress.io testing.
https://example.cypress.io/
MIT License
1.22k stars 2.2k forks source link

Figure out caching on Azure CI #132

Closed bahmutov closed 4 years ago

bahmutov commented 6 years ago

When running on Azure CI public pipelines, I do not see any way to cache NPM dependencies or Cypress binary between the runs. This lead to 3-5 minutes of install time per run.

bahmutov commented 6 years ago
bahmutov commented 6 years ago

Sample project: https://github.com/MicrosoftDocs/pipelines-javascript but does not show any caching for node_modules or ~/.npm folders

bahmutov commented 6 years ago

More details suggested by other MVPs

Seems Azure CI team is working on general caching solution, might make sense to wait for them

brandonb927 commented 4 years ago

Azure DevOps Pipeline caching came out of preview the other day. It would be great to have an example of how to cache the Cypress binary in YAML Pipelines, as I am currently struggling to make it work.

bahmutov commented 4 years ago

:tada: This issue has been resolved in version 1.9.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

ekulabuhov commented 4 years ago

Hi! It might be useful to add that on a windows based image the path is different and looks like this:

- task: CacheBeta@1
  inputs:
    key: 'cypress | $(Agent.OS) | package-lock.json'
    path: 'C:\Users\VssAdministrator\AppData\Local\Cypress'
    restoreKeys: 'cypress | $(Agent.OS) | package-lock.json'
  displayName: Cache cypress binary

Unfortunately, caching in Azure Pipelines is a bit crippled due to security restrictions described here: https://docs.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops#cache-isolation-and-security

Basically, caches are isolated between different branches which makes them less useful when used with short lived feature branches.

the-serious-programmer commented 3 years ago

I know I am late to the party, but a small improvement on @ekulabuhov post: Instead of hard coding the path you can also use path: $(LOCALAPPDATA)/Cypress, also see this