diff --git a/.circleci/config.yml b/.circleci/config.yml index 3d3830b..0784929 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,11 +1,95 @@ version: 2.1 jobs: - build: - docker: + build: + docker: &shared_docker - image: cimg/node:14.10.1 # the primary container, where your job's commands are run auth: username: mydockerhub-user password: $DOCKERHUB_PASSWORD # context / project UI env-var reference steps: - checkout # check out the code in the project directory - - run: echo "hello world" # run the `echo` command \ No newline at end of file + - run: yarn global add node-gyp && yarn install + - restore_cache : + keys : + - npm-v1-dependencies-{{ checksum "yarn.lock" }} + - save_cache: + paths: + - ./node_modules + key: npm-v1-dependencies-{{ checksum "yarn.lock" }} + + lint: + docker: *shared_docker + steps: + - checkout # check out the code in the project director + - restore_cache : + keys : + - npm-v1-dependencies-{{ checksum "yarn.lock" }} + + - run: yarn lint && yarn format:check + + test: + docker: *shared_docker + steps: + - checkout # check out the code in the project director + - restore_cache : + keys : + - npm-v1-dependencies-{{ checksum "yarn.lock" }} + + - run: yarn test:ci + + e2etest: + docker: + - image: cimg/node:12.18.4 + environment: + DATABASE_URL: postgres://psqluser:password@localhost:5432/psdb + JWT_SECRET: some string + API_HOST: localhost + API_PROTOCOL: http + API_PORT: 3000 + - image: circleci/postgres:9.6.2-alpine + environment: + POSTGRES_USER: psqluser + POSTGRES_DB: psdb + POSTGRES_PASSWORD: password + steps: + - checkout + - restore_cache: + keys: + - npm-v1-dependencies-{{ checksum "yarn.lock" }} + + - run: yarn test:e2e + + documentation: + docker: *shared_docker + steps: + - checkout # check out the code in the project director + - restore_cache : + keys : + - npm-v1-dependencies-{{ checksum "yarn.lock" }} + + - run: yarn doc:build + + - store_artifacts: + path: doc-server + destination: doc-server + +workflows: + version: 2 + build_test: + jobs : + - build + - lint: + requires: + - build + - test: + requires: + - build + - e2etest: + requires: + - build + - documentation: + requires: + - build + - test + - lint + - e2etest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..46c5385 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM node:12.18.4 + +COPY /src . + +COPY package.json . + +COPY yarn.lock . + +RUN yarn global add node-gyp && yarn install + +RUN yarn start \ No newline at end of file diff --git a/package.json b/package.json index a4f54c1..96ef36c 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,8 @@ "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./test/jest-e2e.json", - "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"./**/*.{yaml,yml}\"", - "format:check": "prettier --list-different \"src/**/*.ts\" \"test/**/*.ts\" \"./**/*.{yaml,yml}\"", + "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", + "format:check": "prettier --list-different \"src/**/*.ts\" \"test/**/*.ts\"", "generate": "hygen" }, "dependencies": {