Yield generated for aefb9fc2-2ae0-44db-bd58-7fb041b08d16
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

121 lines
3.6 KiB

version: 2.1
jobs:
build: &shared-config
docker:
- image: cimg/node:14.10.1
steps:
- checkout
- restore_cache:
name: restore yarn package cache
key: yarn-packages-v2{{ checksum "yarn.lock" }}
- run: yarn global add node-gyp && yarn install
- save_cache:
name: save yarn package cache
key: yarn-packages-v2{{ checksum "yarn.lock" }}
paths:
- ./node_modules
lint:
docker:
- image: cimg/node:14.10.1
steps:
- checkout
- restore_cache:
name: restore yarn package cache
key: yarn-packages-v2{{ checksum "yarn.lock" }}
- run: yarn lint && yarn format:check
- save_cache:
name: save yarn package cache
key: yarn-packages-v2{{ checksum "yarn.lock" }}
paths:
- ./node_modules
test:
docker:
- image: cimg/node:14.10.1
steps:
- checkout
- restore_cache:
name: restore yarn package cache
key: yarn-packages-v2{{ checksum "yarn.lock" }}
- run: yarn test:ci
- save_cache:
name: save yarn package cache
key: yarn-packages-v2{{ checksum "yarn.lock" }}
paths:
- ./node_modules
database:
docker:
- image: cimg/node:12.18
environment:
DATABASE_URL: "postgres://psuser:pspwd@localhost:5432/psdb"
API_PORT: 3000
API_HOST: localhost
API_PROTOCOL: http
JWT_SECRET: something
- image: circleci/postgres:9.6.2-alpine
environment:
POSTGRES_USER: psuser
POSTGRES_DB: psdb
POSTGRES_PASSWORD: pspwd
steps:
- checkout
- restore_cache:
name: restore yarn package cache
key: yarn-packages-v2{{ checksum "yarn.lock" }}
- run: yarn test:e2e
build_image:
docker:
- image: circleci/buildpack-deps:stretch
steps:
- checkout
- setup_remote_docker
- run:
name: Build Docker image
command: docker build -t sukiadoramu/my-awesome-ci-expr:app .
- run:
name: Archive Docker image
command: docker save -o image.tar sukiadoramu/my-awesome-ci-expr
- persist_to_workspace:
root: .
paths:
- ./image.tar
publish_latest:
docker:
- image: circleci/buildpack-deps:stretch
steps:
- attach_workspace:
at: /tmp/workspace
- setup_remote_docker
- run:
name: Load archived Docker image
command: docker load -i /tmp/workspace/image.tar
- run:
name: Publish Docker Image to Docker Hub
command: |
echo "$DOCKERHUB_PASS" | docker login -u sukiadoramu --password-stdin
docker tag sukiadoramu/my-awesome-ci-expr:app sukiadoramu/my-awesome-ci-expr:$CIRCLE_BUILD_NUM
docker tag sukiadoramu/my-awesome-ci-expr:app sukiadoramu/my-awesome-ci-expr:latest
docker push sukiadoramu/my-awesome-ci-expr:latest
docker push sukiadoramu/my-awesome-ci-expr:$CIRCLE_BUILD_NUM
workflows:
build_and_test:
jobs:
- build
- test:
requires:
- build
- lint:
requires:
- build
- database:
requires:
- build
- build_image:
requires:
- test
- database
- lint
- publish_latest:
requires:
- build_image