Prevent building frontend code and stop npm install

In my application I have a golang backend and just a little bit of frontend code written in javascript / node. Circle CI recognizes the golang app correctly and runs of all the tests.

However it also sees my package.json and runs npm install which takes about 2 minutes. I’d like to stop this to speed up my continuous integration. How can I tell Circle CI to only use my backend code?

The following does not work in circle.yml.

machine:
  golang:
    version: 1.5
1 Like

I think the best way to handle this for now would be to override the test phase and only run the go tests, sometimes inference is too smart for its own good. :slight_smile:

Overriding dependencies in golang wasn’t as easy as I thought. Here is some help - Overriding Go Inference in the Dependencies Phase

I now use the following settings for dependencies and it works fine.

dependencies:
  override:
    - mkdir -p $HOME/.go_project/src/github.com/$CIRCLE_PROJECT_USERNAME
    - ln -fs $HOME/$CIRCLE_PROJECT_REPONAME $HOME/.go_project/src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME
    - |
      echo 'export GOPATH=$GOPATH:$HOME/.go_project' >> ~/.circlerc
    - cd $HOME/.go_project/src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME && go get -t -d -v ./...
    - cd $HOME/.go_project/src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME && go build -v
4 Likes