I am running into an issue whereby the following build script results in a successful build, followed by a failed build, for the same trigger (same push to GitHub repo). Both are using workflow ‘build_and_test’:
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:7.10
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4
working_directory: ~/repo
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Install dependencies via npm
command: npm install
- run:
name: Run tests
command: npm run test
- run: scripts/build.sh
- save_cache:
key: v1-dependencies-{{ checksum "package.json" }}
paths:
- node_modules
test:
docker:
- image: circleci/node:7.10
working_directory: ~/repo
steps:
- checkout
- run:
name: Test
command: npm test
# deploy:
# machine:
# enabled: true
# working_directory: ~/repo
# environment:
# - HEROKU_APP: still-shelf-38337
# steps:
# - run:
# name: deploy changes
# command: scripts/deploy.sh
workflows:
version: 2
build_and_test:
jobs:
- build
- test:
requires:
- build
The failure I get is:
$ #!/bin/bash -eo pipefail
npm test
npm info it worked if it ends with ok
npm info using npm@4.2.0
npm info using node@v7.10.1
npm info lifecycle myproject@1.0.3~pretest: myproject@1.0.3
npm info lifecycle myproject@1.0.3~test: myproject@1.0.3
> myproject@1.0.3 test /home/circleci/repo
> npm run lint
npm info it worked if it ends with ok
npm info using npm@4.2.0
npm info using node@v7.10.1
npm info lifecycle myproject@1.0.3~prelint: myproject@1.0.3
npm info lifecycle myproject@1.0.3~lint: myproject@1.0.3
> myproject@1.0.3 lint /home/circleci/repo
> eslint src
sh: 1: eslint: not found
Note, that this is based in the recipe here: https://circleci.com/docs/2.0/sample-config/
Any ideas?