version: 2.1 workflows: build_and_test: jobs: - build - lint: requires: - build - tests: requires: - build - e2e: requires: - build - doc: requires: - build - docker_build: context: Perso requires: - build - doc - tests - e2e - lint jobs: build: docker: - image: "circleci/node:12" steps: - checkout - restore_cache: key: yarn-cache{{ checksum "yarn.lock" }} - run: yarn global add node-gyp && yarn install - save_cache: key: yarn-cache{{ checksum "yarn.lock" }} paths: - ./node_modules tests: docker: - image: "circleci/node:12" steps: - checkout - restore_cache: key: yarn-cache{{ checksum "yarn.lock" }} - run: yarn test:ci - save_cache: key: yarn-cache{{ checksum "yarn.lock" }} paths: - ./node_modules lint: docker: - image: "circleci/node:12" steps: - checkout - restore_cache: key: yarn-cache{{ checksum "yarn.lock" }} - run: yarn lint && yarn format:check - save_cache: key: yarn-cache{{ checksum "yarn.lock" }} paths: - ./node_modules e2e: docker: - image: "circleci/node:12" - image: "circleci/postgres:9.6.2-alpine" environment: POSTGRES_USER: julien_dudek POSTGRES_DB: testdb POSTGRES_PASSWORD: unpass steps: - checkout - restore_cache: key: yarn-cache{{ checksum "yarn.lock" }} - run: command: yarn test:e2e environment: DATABASE_URL: postgres://julien_dudek:unpass@localhost:5432/testdb JWT_SECRET: m1iii API_PORT: 3000 API_HOST: localhost API_PROTOCOL: http - save_cache: key: yarn-cache{{ checksum "yarn.lock" }} paths: - ./node_modules doc: docker: - image: "circleci/node:12" steps: - checkout - restore_cache: key: yarn-cache{{ checksum "yarn.lock" }} - run: command: yarn doc:build - store_artifacts: path: ./doc-server docker_build: docker: - image: circleci/buildpack-deps:stretch steps: - checkout - restore_cache: key: yarn-cache{{ checksum "yarn.lock" }} - setup_remote_docker - run: docker image build --tag julienm1/my-awesome-ci-expr:$CIRCLE_BUILD_NUM . - run: docker save -o image.tar julienm1/my-awesome-ci-expr - run: docker login -u "julienm1" -p $DOCKERHUB_PASSWORD - run: docker push julienm1/my-awesome-ci-expr:$CIRCLE_BUILD_NUM - save_cache: key: yarn-cache{{ checksum "yarn.lock" }} paths: - ./node_modules