Example using Node

Example Yaml configuration for a project written in JavaScript using Node:

pipeline:
  build:
    image: node:latest
    commands:
      - npm install
      - npm run test

Using the official Node images:

pipeline:
  build:
+   image: node:latest
    commands:
      - npm install
      - npm run lint
      - npm run test

Using the official NPM plugin to publish packages:

pipeline:
  build:
    image: node:latest
    commands:
      - npm install
      - npm run lint
      - npm run test
  publish:
+   image: plugins/npm
+   when:
+     branch: master

Using the build matrix to test multiple node versions:

pipeline:
  build:
-   image: node:latest
+   image: node:${NODE_VERSION}
    commands:
      - npm install
      - npm run lint
      - npm run test

+matrix:
+ NODE_VERSION:
+   - latest
+   - "7"
+   - "6"
+   - "4"

Questions?

We are always happy to help with questions you might have. Search our documentation or check out answers to common questions. You can also post questions or comments to our community forum.