From 6c6c0928bbbe9c365da7c1e5695215644643f2c1 Mon Sep 17 00:00:00 2001 From: Manuel Jasso Date: Mon, 16 Nov 2020 16:08:36 -0800 Subject: [PATCH] Integrate CircleCI (#131) * Integrate CircleCI --- .circleci/config.yml | 82 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..8b8eefd5 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,82 @@ +# Environment configuration +# ========================= + +env_default: &env_default + working_directory: ~/near-membrane + docker: + - image: circleci/node:14-browsers + + +# Commands definitions +# ==================== + +# Yarn cache +restore_yarn_cache: &restore_yarn_cache + restore_cache: + keys: + - yarn-v4-{{ checksum "yarn.lock" }} + +save_yarn_cache: &save_yarn_cache + save_cache: + key: yarn-v4-{{ checksum "yarn.lock" }} + paths: + - ~/.cache/yarn + +# Workspace +save_workspace: &save_workspace + persist_to_workspace: + root: . + paths: . + +load_workspace: &load_workspace + attach_workspace: + at: ~/tmp/workspace + +# Build +install: &install + run: + name: Install and build + command: | + yarn install --frozen-lockfile + yarn build + +# Jest tests +run_unit_tests: &run_unit_tests + run: + name: Run Jest tests + command: yarn test + +# Karma tests +run_karma_tests: &run_karma_tests + run: + name: Run Karma tests + command: npx karma start karma.config.js --single-run --browsers FirefoxHeadless + + +# Jobs definition +# =============== + +version: 2 +jobs: + build: + <<: *env_default + steps: + - checkout + + - *restore_yarn_cache + - *install + - *save_yarn_cache + - *save_workspace + + - *run_unit_tests + - *run_karma_tests + + +# Workflows definition +# ==================== + +workflows: + version: 2 + build_and_test: + jobs: + - build diff --git a/package.json b/package.json index 19b8268d..275c4f7b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@locker/near-membrane", - "version": "0.3.4", + "version": "0.4.0", "description": "JavaScript Near Membrane Library to create a sandboxed environment", "module": "lib/index.js", "types": "types/index.js",