Cypress: CircleCI - why is cypress not saved in cache

Created on 27 Dec 2018  路  4Comments  路  Source: cypress-io/cypress

during my CircleCI build I am saving npm dependencies to cache

    steps:
      ...
      - save_cache:
          key: deps-npm-{{ .Branch }}-{{ checksum "package-lock.json" }}
          paths:
            - "node_modules"
            - ".cache/Cypress"
      ...

next time I build, I restore from cache with

    steps:
      - checkout
      - restore_cache:
          key: deps-npm-{{ .Branch }}-{{ checksum "package-lock.json" }}
      ...

but cypress "insists" installing

> [email protected] postinstall /home/circleci/project/node_modules/cypress
> node index.js --exec install

Installing Cypress (version: 3.1.3)

[14:10:00]  Downloading Cypress     [started]
[14:10:01]  Downloading Cypress     [completed]
[14:10:01]  Unzipping Cypress       [started]
[14:10:31]  Unzipping Cypress       [completed]
[14:10:31]  Finishing Installation  [started]
[14:10:31]  Finishing Installation  [completed]

You can now open Cypress by running: node_modules/.bin/cypress open

https://on.cypress.io/installing-cypress

any possibility to avoid this?

question

Most helpful comment

@bahmutov, hmmm, not working with ~/.cache/Cypress either

this is what I use

      - save_cache:
          key: deps-npm-{{ .Branch }}-{{ checksum "package-lock.json" }}
          paths:
            - "node_modules"
            - "~/.cache/Cypress"

All 4 comments

because you need to cache folder in your user profile ~/.cache/Cypress and not local folder .cache/Cypress

https://docs.cypress.io/guides/getting-started/installing-cypress.html#Binary-cache

@bahmutov, hmmm, not working with ~/.cache/Cypress either

this is what I use

      - save_cache:
          key: deps-npm-{{ .Branch }}-{{ checksum "package-lock.json" }}
          paths:
            - "node_modules"
            - "~/.cache/Cypress"

if you _just_ changed paths list and have not cleared your cache or invalidated it by changing its name to something like key: v2-deps-npm-{{ .Branch }}-{{ checksum "package-lock.json" }} then the _install_ step did not save new list of folders.

Here is our example todomvc circle file commit when we were switching to using orb. You can see the settings that work https://github.com/cypress-io/cypress-example-todomvc/commit/3526270572a8665a4045872364e6b10013d3e456

thanks! right! cache versioning -> (facepalm) -> sorry about this!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

weskor picture weskor  路  3Comments

igorpavlov picture igorpavlov  路  3Comments

rbung picture rbung  路  3Comments

Francismb picture Francismb  路  3Comments

dkreft picture dkreft  路  3Comments