From 4f358032eb559ac596e64a9dab9057e4e0f51c8a Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 6 Apr 2022 20:59:40 -0700 Subject: [PATCH] chore: CircleCI Images (#3341) * chore: Upgrade from deprecated images * img * fix: No default postgres user/pass anymore * parallel * config * migrate * split frontend/backend tests * fix * resource_class * node * node --- .circleci/config.yml | 109 ++++++++++++++++++++++++++++++++----------- 1 file changed, 82 insertions(+), 27 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e847cf3b1..87cc7df40 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,28 +1,36 @@ version: 2.1 +defaults: &defaults + working_directory: ~/outline + docker: + - image: cimg/node:14.19 + - image: cimg/redis:5.0 + - image: cimg/postgres:14.2 + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + POSTGRES_DB: circle_test + resource_class: large + environment: + NODE_ENV: test + SECRET_KEY: F0E5AD933D7F6FD8F4DBB3E038C501C052DC0593C686D21ACB30AE205D2F634B + DATABASE_URL_TEST: postgres://postgres:password@localhost:5432/circle_test + DATABASE_URL: postgres://postgres:password@localhost:5432/circle_test + URL: http://localhost:3000 + SMTP_FROM_EMAIL: hello@example.com + AWS_S3_UPLOAD_BUCKET_URL: https://s3.amazonaws.com + AWS_S3_UPLOAD_BUCKET_NAME: outline-circle + executors: docker-publisher: environment: IMAGE_NAME: outlinewiki/outline docker: - - image: circleci/buildpack-deps:stretch + - image: cimg/base jobs: build: - working_directory: ~/outline - docker: - - image: circleci/node:14 - - image: circleci/redis:latest - - image: circleci/postgres:9.6.5-alpine-ram - environment: - NODE_ENV: test - SECRET_KEY: F0E5AD933D7F6FD8F4DBB3E038C501C052DC0593C686D21ACB30AE205D2F634B - DATABASE_URL_TEST: postgres://root@localhost:5432/circle_test - DATABASE_URL: postgres://root@localhost:5432/circle_test - URL: http://localhost:3000 - SMTP_FROM_EMAIL: hello@example.com - AWS_S3_UPLOAD_BUCKET_URL: https://s3.amazonaws.com - AWS_S3_UPLOAD_BUCKET_NAME: outline-circle + <<: *defaults steps: - checkout - restore_cache: @@ -34,18 +42,51 @@ jobs: key: dependency-cache-{{ checksum "package.json" }} paths: - ./node_modules + lint: + <<: *defaults + steps: + - checkout + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} + - run: + name: lint + command: yarn lint + types: + <<: *defaults + steps: + - checkout + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} + - run: + name: typescript + command: yarn tsc + test-app: + <<: *defaults + steps: + - checkout + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} + - run: + name: test + command: yarn test:app + test-server: + <<: *defaults + steps: + - checkout + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} - run: name: migrate command: ./node_modules/.bin/sequelize db:migrate --url $DATABASE_URL_TEST - - run: - name: lint - command: yarn lint - - run: - name: typescript - command: yarn tsc - run: name: test - command: yarn test + command: yarn test:server + bundle-size: + <<: *defaults + steps: + - checkout + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} - run: name: build-webpack command: yarn build:webpack @@ -103,12 +144,26 @@ jobs: workflows: version: 2 - build-and-test: + all: jobs: - - build: - filters: - tags: - ignore: /^v.*/ + - build + - lint: + requires: + - build + - test-server: + requires: + - build + - test-app: + requires: + - build + - types: + requires: + - build + - bundle-size: + requires: + - test-app + - test-server + build-docker: jobs: - build-image: