2020-11-23 21:45:01 +01:00
|
|
|
version: 2.1
|
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build:
|
|
|
|
jobs:
|
|
|
|
- build_and_test
|
|
|
|
jobs:
|
|
|
|
build_and_test:
|
|
|
|
working_directory: ~/pinafore
|
|
|
|
docker:
|
|
|
|
# see https://discuss.circleci.com/t/build-failed-the-engine-node-is-incompatible-with-this-module-expected-version-12-x-got-14-15-0/37921/7
|
2021-01-25 03:26:40 +01:00
|
|
|
# we want Node v12, not v14
|
2020-11-23 21:45:01 +01:00
|
|
|
- image: circleci/ruby@sha256:b018ec2a8f0bbf06880735d2801402bad316c465edb60663be83ac8f1086b805
|
|
|
|
- image: circleci/postgres:12.2
|
|
|
|
environment:
|
|
|
|
POSTGRES_USER: pinafore
|
|
|
|
POSTGRES_PASSWORD: pinafore
|
|
|
|
POSTGRES_DB: pinafore_development
|
|
|
|
BROWSER: chrome:headless
|
|
|
|
- image: circleci/redis:5-alpine
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
name: Install system dependencies
|
|
|
|
command: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y ffmpeg fonts-noto-color-emoji libicu-dev libidn11-dev libprotobuf-dev postgresql-contrib protobuf-compiler
|
|
|
|
- run:
|
|
|
|
name: Check node version
|
|
|
|
command: node -v
|
|
|
|
- restore_cache:
|
|
|
|
name: Restore yarn cache
|
2020-11-24 03:07:38 +01:00
|
|
|
key: yarn-v1-{{ checksum "yarn.lock" }}
|
2020-11-23 21:45:01 +01:00
|
|
|
- run:
|
|
|
|
name: Yarn install
|
|
|
|
command: yarn install --immutable
|
|
|
|
- run:
|
|
|
|
name: Clone mastodon
|
|
|
|
command: yarn clone-mastodon
|
|
|
|
- restore_cache:
|
|
|
|
name: Restore bundler cache
|
2020-11-24 03:07:38 +01:00
|
|
|
key: bundler-v2-{{ checksum "mastodon/Gemfile.lock" }}
|
2020-11-23 21:45:01 +01:00
|
|
|
- run:
|
|
|
|
name: Lint
|
|
|
|
command: yarn lint
|
|
|
|
- run:
|
|
|
|
name: Unit tests
|
|
|
|
command: yarn test-unit
|
2021-03-06 18:06:42 +01:00
|
|
|
- run:
|
|
|
|
name: Install mastodon
|
|
|
|
command: yarn install-mastodon
|
2020-11-23 21:45:01 +01:00
|
|
|
- run:
|
|
|
|
name: Wait for postgres to be ready
|
|
|
|
command: |
|
|
|
|
for i in `seq 1 10`;
|
|
|
|
do
|
|
|
|
nc -z localhost 5432 && echo Success && exit 0
|
|
|
|
echo -n .
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
echo Failed waiting for postgres && exit 1
|
|
|
|
- run:
|
|
|
|
name: Wait for redis to be ready
|
|
|
|
command: |
|
|
|
|
for i in `seq 1 10`;
|
|
|
|
do
|
|
|
|
nc -z localhost 6379 && echo Success && exit 0
|
|
|
|
echo -n .
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
echo Failed waiting for redis && exit 1
|
2021-03-06 18:06:42 +01:00
|
|
|
- run:
|
|
|
|
name: Build
|
|
|
|
command: yarn build
|
2020-11-23 21:45:01 +01:00
|
|
|
- run:
|
|
|
|
name: Integration tests
|
2021-03-06 18:06:42 +01:00
|
|
|
command: yarn test-in-ci
|
2020-11-23 21:45:01 +01:00
|
|
|
- save_cache:
|
|
|
|
name: Save yarn cache
|
2020-11-24 03:07:38 +01:00
|
|
|
key: yarn-v1-{{ checksum "yarn.lock" }}
|
2020-11-23 21:45:01 +01:00
|
|
|
paths:
|
|
|
|
- ~/.cache/yarn
|
|
|
|
- save_cache:
|
|
|
|
name: Save bundler cache
|
2020-11-24 03:07:38 +01:00
|
|
|
key: bundler-v2-{{ checksum "mastodon/Gemfile.lock" }}
|
2020-11-23 21:45:01 +01:00
|
|
|
paths:
|
|
|
|
- mastodon/vendor/bundle
|