.circleci/config.yml
version: 2
jobs:
build:
working_directory: ~/one-time-secret
docker:
- image: circleci/node:14.0
steps:
- checkout
- restore_cache:
key: v0-install-and-build-cache-{{ .Branch }}-{{ .Revision }}
- run:
name: Install dependencies
command: npm install --pure-lockfile
- run:
name: Build project
command: npm run build:test
- save_cache:
key: v0-install-and-build-cache-{{ .Branch }}-{{ .Revision }}
paths:
- dist
- node_modules
test:
working_directory: ~/one-time-secret
docker:
- image: circleci/node:14.0
steps:
- checkout
- restore_cache:
key: v0-install-and-build-cache-{{ .Branch }}-{{ .Revision }}
- run:
name: Install dependencies
command: npm install --pure-lockfile
- run:
name: Build project
command: npm run build:test
- run:
name: test:spec
command: npm run test:spec
environment:
JEST_JUNIT_OUTPUT_DIR: ./reports/junit/
- save_cache:
key: v0-install-and-build-cache-{{ .Branch }}-{{ .Revision }}
paths:
- dist
- node_modules
- store_test_results:
path: ./reports/junit/
teste2e:
machine: true
working_directory: ~/one-time-secret
steps:
- checkout
- restore_cache:
key: v0-install-and-build-cache-{{ .Branch }}-{{ .Revision }}
- run:
name: Install docker-compose
command: |
curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
- run:
name: Start docker-compose
command: |
set -x
docker-compose -f docker-compose.test.yml up -d
until curl --write-out %{http_code} --silent --output /dev/null http://localhost:8080/new | grep '^200$'
do
sleep 5
done
- run:
name: Run e2e tests
command: |
npm run test:e2e
workflows:
version: 2
build_test:
jobs:
- build
- test:
requires:
- build
- teste2e:
requires:
- build