Files
nest/.circleci/config.yml
2019-10-23 21:41:40 +02:00

184 lines
4.2 KiB
YAML

version: 2
aliases:
- &restore-cache
restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- &install-deps
run:
name: Install dependencies
command: npm ci
- &build-packages
run:
name: Build
command: npm run build
- &run-unit-tests
run:
name: Test
command: npm run test
unit-tests-template: &unit-tests-template
working_directory: ~/nest
steps:
- checkout
- *restore-cache
- *install-deps
- *build-packages
- *run-unit-tests
jobs:
build:
working_directory: ~/nest
docker:
- image: circleci/node:12
steps:
- checkout
- run:
name: Update NPM version
command: 'sudo npm install -g npm@latest'
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Install dependencies
command: npm ci
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: Build
command: npm run build
test_node_12:
working_directory: ~/nest
docker:
- image: circleci/node:12
steps:
- checkout
- *restore-cache
- *install-deps
- *build-packages
- *run-unit-tests
- run:
name: Collect coverage
command: npm run coverage
- store_artifacts:
path: coverage
test_node_10:
<<: *unit-tests-template
docker:
- image: circleci/node:10
test_node_8:
<<: *unit-tests-template
docker:
- image: circleci/node:8
lint:
working_directory: ~/nest
docker:
- image: circleci/node:12
steps:
- checkout
- *restore-cache
- *install-deps
- run:
name: Lint
command: npm run lint
- run:
name: Lint commit
command: ./node_modules/.bin/commitlint-circle -c .commitlintrc.json
integration_tests:
working_directory: ~/nest
machine: true
steps:
- checkout
- run:
name: Prepare nvm
command: |
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
echo ' [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
- run:
name: Upgrade Node.js
command: |
nvm install v12
node -v
nvm alias default v12
- run:
name: Install Docker Compose
command: |
curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
- *install-deps
- run:
name: Prepare tests
command: |
bash ./scripts/prepare.sh
sleep 10
- run:
name: List containers
command: docker ps
- run:
name: Integration tests
command: npm run integration-test
codechecks_benchmarks:
working_directory: ~/nest
docker:
- image: circleci/node:12
steps:
- checkout
- *restore-cache
- *install-deps
- *build-packages
- run:
name: Install native wrk
command: .circleci/install-wrk.sh
- run:
name: Run codechecks with benchmarks
command: yarn codechecks:benchmarks
samples:
working_directory: ~/nest
docker:
- image: circleci/node:12
environment:
- DISABLE_OPENCOLLECTIVE: true
steps:
- checkout
- *restore-cache
- *install-deps
- run:
name: Build all samples
command: npm run build:samples
workflows:
version: 2
build-and-test:
jobs:
- build
- test_node_12:
requires:
- build
- test_node_10:
requires:
- build
- test_node_8:
requires:
- build
- lint:
requires:
- build
- integration_tests:
requires:
- build
- samples:
requires:
- build
- codechecks_benchmarks:
requires:
- build