2018-03-08 20:16:42 +03:00
|
|
|
# Javascript Node CircleCI 2.0 configuration file
|
|
|
|
#
|
|
|
|
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
|
|
|
|
#
|
|
|
|
version: 2
|
|
|
|
jobs:
|
2019-01-24 00:48:56 +03:00
|
|
|
test:
|
|
|
|
|
|
|
|
docker:
|
|
|
|
- image: circleci/node:10
|
|
|
|
|
|
|
|
working_directory: ~/repo
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
# Download and cache node dependencies
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
|
|
|
- v2-dependencies-{{ checksum "yarn.lock" }}
|
|
|
|
# fallback to using the latest cache if no exact match is found
|
|
|
|
- v2-dependencies-
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Install node dependencies
|
|
|
|
command: yarn install
|
|
|
|
|
|
|
|
- save_cache:
|
|
|
|
paths:
|
|
|
|
- "node_modules"
|
|
|
|
key: v2-dependencies-{{ checksum "yarn.lock" }}
|
2018-04-05 03:18:20 +03:00
|
|
|
|
2019-01-24 00:48:56 +03:00
|
|
|
# Run tests!
|
|
|
|
- run:
|
|
|
|
name: Test
|
|
|
|
command: yarn run test:ci
|
|
|
|
|
|
|
|
lint:
|
2018-03-08 20:16:42 +03:00
|
|
|
docker:
|
2018-07-28 14:07:02 +03:00
|
|
|
# Image with python 3.6 and node 8
|
|
|
|
- image: circleci/python:3.6-node-browsers
|
2018-03-08 20:16:42 +03:00
|
|
|
|
|
|
|
working_directory: ~/repo
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
2018-07-28 14:07:02 +03:00
|
|
|
# Download and cache python dependencies
|
|
|
|
- restore_cache:
|
|
|
|
key: v1-python
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Create virtualenv
|
|
|
|
command: |
|
|
|
|
python3 -m venv ~/venv
|
|
|
|
echo "source ~/venv/bin/activate" >> $BASH_ENV
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Install therapist
|
2018-07-29 11:15:18 +03:00
|
|
|
command: pip install -U therapist
|
2018-07-28 14:07:02 +03:00
|
|
|
|
|
|
|
- save_cache:
|
|
|
|
paths:
|
|
|
|
- "~/venv"
|
|
|
|
key: v1-python
|
|
|
|
|
|
|
|
# Download and cache node dependencies
|
2018-03-08 20:16:42 +03:00
|
|
|
- restore_cache:
|
|
|
|
keys:
|
2018-07-30 13:39:43 +03:00
|
|
|
- v2-dependencies-{{ checksum "yarn.lock" }}
|
2018-03-08 20:16:42 +03:00
|
|
|
# fallback to using the latest cache if no exact match is found
|
2018-07-30 08:20:43 +03:00
|
|
|
- v2-dependencies-
|
2018-03-08 20:16:42 +03:00
|
|
|
|
2018-07-28 14:07:02 +03:00
|
|
|
- run:
|
|
|
|
name: Install node dependencies
|
|
|
|
command: yarn install
|
2018-03-08 20:16:42 +03:00
|
|
|
|
|
|
|
- save_cache:
|
|
|
|
paths:
|
2018-07-28 14:07:02 +03:00
|
|
|
- "node_modules"
|
2018-07-30 13:39:43 +03:00
|
|
|
key: v2-dependencies-{{ checksum "yarn.lock" }}
|
2018-03-08 20:16:42 +03:00
|
|
|
|
2018-07-29 11:15:18 +03:00
|
|
|
# Run lint suite using therapist
|
2018-07-28 14:07:02 +03:00
|
|
|
- run:
|
|
|
|
name: Lint
|
|
|
|
command: therapist run --use-tracked-files
|
2018-03-08 20:16:42 +03:00
|
|
|
|
2018-03-08 21:39:26 +03:00
|
|
|
docs:
|
|
|
|
docker:
|
2018-04-27 18:24:18 +03:00
|
|
|
- image: circleci/python:3.6
|
2018-03-08 21:39:26 +03:00
|
|
|
|
|
|
|
working_directory: ~/repo
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
2018-07-29 11:15:18 +03:00
|
|
|
|
|
|
|
# Download and cache python dependencies
|
2018-03-08 21:39:26 +03:00
|
|
|
- restore_cache:
|
|
|
|
key: deps1-{{ .Branch }}-{{ checksum "docs/requirements.txt" }}
|
2018-07-29 11:15:18 +03:00
|
|
|
|
2018-03-08 21:39:26 +03:00
|
|
|
- run:
|
2018-07-28 14:07:02 +03:00
|
|
|
name: Create virtualenv
|
2018-03-08 21:39:26 +03:00
|
|
|
command: |
|
2018-07-28 14:07:02 +03:00
|
|
|
python3 -m venv ~/venv
|
|
|
|
echo "source ~/venv/bin/activate" >> $BASH_ENV
|
2018-07-29 11:15:18 +03:00
|
|
|
|
2018-07-28 14:07:02 +03:00
|
|
|
- run:
|
|
|
|
name: Install requirements
|
|
|
|
command: pip install -r docs/requirements.txt
|
2018-07-29 11:15:18 +03:00
|
|
|
|
2018-03-08 21:39:26 +03:00
|
|
|
- save_cache:
|
|
|
|
key: deps1-{{ .Branch }}-{{ checksum "docs/requirements.txt" }}
|
|
|
|
paths:
|
2018-07-28 14:07:02 +03:00
|
|
|
- "~/venv"
|
2018-07-29 11:15:18 +03:00
|
|
|
|
|
|
|
# Build the docs!
|
2018-03-08 21:39:26 +03:00
|
|
|
- run:
|
2018-07-28 14:07:02 +03:00
|
|
|
name: Build docs
|
2018-03-08 21:39:26 +03:00
|
|
|
command: |
|
|
|
|
cd docs
|
|
|
|
make html
|
2018-03-08 21:41:05 +03:00
|
|
|
|
2019-01-24 00:48:56 +03:00
|
|
|
build:
|
|
|
|
# Test that a production-build of the project works
|
|
|
|
docker:
|
|
|
|
- image: circleci/node:10
|
|
|
|
|
|
|
|
working_directory: ~/repo
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
# Download and cache node dependencies
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
2019-01-24 00:58:26 +03:00
|
|
|
# Include package.json in the keys, since moving between
|
|
|
|
# dependencies and devDependncies doesn't change yarn.lock.
|
|
|
|
- v2-dependencies-prod-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
|
|
|
|
# fallback to using the latest cache if no exact match is found
|
|
|
|
- v2-dependencies-prod-{{ checksum "package.json" }}-
|
2019-01-24 00:48:56 +03:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Install node dependencies in production mode
|
|
|
|
command: yarn install --prod
|
|
|
|
|
|
|
|
- save_cache:
|
|
|
|
paths:
|
|
|
|
- "node_modules"
|
2019-01-24 00:58:26 +03:00
|
|
|
key: v2-dependencies-prod-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
|
2019-01-24 00:48:56 +03:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Build
|
|
|
|
command: yarn run build
|
|
|
|
|
2018-03-08 21:41:05 +03:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build_and_docs:
|
|
|
|
jobs:
|
|
|
|
- docs
|
2019-01-24 00:48:56 +03:00
|
|
|
- lint
|
|
|
|
- build
|
|
|
|
- test
|