2018-10-30 05:36:14 +02:00
|
|
|
version: 2.1
|
2018-10-29 14:48:35 +02:00
|
|
|
|
2018-10-30 05:36:14 +02:00
|
|
|
executors:
|
|
|
|
default:
|
2019-02-09 19:17:43 +02:00
|
|
|
working_directory: /tmp/workspace
|
|
|
|
docker:
|
|
|
|
- image: misskey/ci:latest
|
|
|
|
- image: circleci/mongo:latest
|
|
|
|
with-redis:
|
2018-10-30 05:36:14 +02:00
|
|
|
working_directory: /tmp/workspace
|
|
|
|
docker:
|
|
|
|
- image: misskey/ci:latest
|
|
|
|
- image: circleci/mongo:latest
|
|
|
|
- image: circleci/redis:latest
|
|
|
|
docker:
|
|
|
|
working_directory: /tmp/workspace
|
2018-10-26 21:46:48 +03:00
|
|
|
docker:
|
2018-10-30 05:36:14 +02:00
|
|
|
- image: docker:latest
|
2018-11-08 11:49:45 +02:00
|
|
|
alpine:
|
|
|
|
working_directory: /tmp/workspace
|
|
|
|
docker:
|
|
|
|
- image: alpine:latest
|
2018-10-30 05:36:14 +02:00
|
|
|
|
|
|
|
jobs:
|
2018-11-08 11:49:45 +02:00
|
|
|
ok:
|
|
|
|
executor: alpine
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: OK
|
|
|
|
command: |
|
|
|
|
echo -e '\033[0;32mOK\033[0;39m'
|
2018-10-30 05:36:14 +02:00
|
|
|
build:
|
|
|
|
executor: default
|
2018-10-26 21:46:48 +03:00
|
|
|
steps:
|
|
|
|
- checkout
|
2019-01-27 13:19:24 +02:00
|
|
|
- run:
|
|
|
|
name: Ensure yarn.lock
|
|
|
|
command: |
|
|
|
|
touch yarn.lock
|
2018-10-30 05:36:14 +02:00
|
|
|
- restore_cache:
|
|
|
|
name: Restore npm package caches
|
|
|
|
keys:
|
2019-01-27 13:13:06 +02:00
|
|
|
- yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
|
|
|
|
- yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-
|
|
|
|
- yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-
|
|
|
|
- yarn-v1-arch-{{ arch }}-
|
|
|
|
- yarn-v1-
|
2018-10-26 21:46:48 +03:00
|
|
|
- run:
|
2018-10-30 05:36:14 +02:00
|
|
|
name: Install Dependencies
|
2018-10-26 21:46:48 +03:00
|
|
|
command: |
|
2019-02-03 09:57:36 +02:00
|
|
|
yarn install
|
2018-10-26 21:46:48 +03:00
|
|
|
- run:
|
2018-10-30 05:36:14 +02:00
|
|
|
name: Configure
|
2018-10-26 21:46:48 +03:00
|
|
|
command: |
|
2018-11-05 23:12:51 +02:00
|
|
|
cp .circleci/misskey/default.yml .config
|
|
|
|
cp .circleci/misskey/test.yml .config
|
2018-10-26 21:46:48 +03:00
|
|
|
- run:
|
2018-10-30 05:36:14 +02:00
|
|
|
name: Build
|
2018-10-26 21:46:48 +03:00
|
|
|
command: |
|
2019-01-27 13:13:06 +02:00
|
|
|
yarn build
|
2019-01-27 13:19:24 +02:00
|
|
|
touch yarn.lock
|
2018-10-30 05:36:14 +02:00
|
|
|
- save_cache:
|
|
|
|
name: Cache npm packages
|
2019-01-27 13:13:06 +02:00
|
|
|
key: yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
|
2018-10-30 05:36:14 +02:00
|
|
|
paths:
|
|
|
|
- node_modules
|
2018-11-05 10:38:57 +02:00
|
|
|
# - store_artifacts:
|
|
|
|
# path: built
|
2018-10-30 05:36:14 +02:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: .
|
|
|
|
paths:
|
|
|
|
- .
|
|
|
|
test:
|
|
|
|
parameters:
|
2019-02-09 19:17:43 +02:00
|
|
|
executor:
|
2018-10-30 05:36:14 +02:00
|
|
|
type: string
|
2019-02-09 19:17:43 +02:00
|
|
|
default: "default"
|
|
|
|
without_redis:
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
executor: <<parameters.executor>>
|
2018-10-30 05:36:14 +02:00
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: /tmp/workspace
|
|
|
|
- when:
|
|
|
|
condition: <<parameters.without_redis>>
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: Configure
|
|
|
|
command: |
|
|
|
|
mv .config/test.yml .config/test_redis.yml
|
|
|
|
touch .config/test.yml
|
|
|
|
cat .config/test_redis.yml | while IFS= read line; do if [[ "$line" = '# __REDIS__' ]]; then break; else echo "$line" >> .config/test.yml; fi; done
|
2018-10-26 21:46:48 +03:00
|
|
|
- run:
|
2018-10-30 05:36:14 +02:00
|
|
|
name: Test
|
2018-10-26 21:46:48 +03:00
|
|
|
command: |
|
2019-01-27 13:13:06 +02:00
|
|
|
yarn test
|
2019-01-27 13:19:24 +02:00
|
|
|
touch yarn.lock
|
2018-10-30 05:36:14 +02:00
|
|
|
- save_cache:
|
|
|
|
name: Cache npm packages
|
2019-01-27 13:13:06 +02:00
|
|
|
key: yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
|
2018-10-30 05:36:14 +02:00
|
|
|
paths:
|
|
|
|
- node_modules
|
|
|
|
docker:
|
|
|
|
parameters:
|
|
|
|
with_deploy:
|
2019-02-09 19:17:43 +02:00
|
|
|
type: boolean
|
|
|
|
default: false
|
2018-10-30 05:36:14 +02:00
|
|
|
executor: docker
|
2018-10-26 21:46:48 +03:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- setup_remote_docker
|
|
|
|
- run:
|
2018-10-30 05:36:14 +02:00
|
|
|
name: Build
|
2018-10-26 21:46:48 +03:00
|
|
|
command: |
|
2018-11-06 19:06:32 +02:00
|
|
|
docker build -t misskey/misskey .
|
2018-10-30 05:36:14 +02:00
|
|
|
- when:
|
|
|
|
condition: <<parameters.with_deploy>>
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: Deploy
|
|
|
|
command: |
|
2018-10-31 15:00:21 +02:00
|
|
|
if [ "$DOCKERHUB_USERNAME$DOCKERHUB_PASSWORD" ]
|
|
|
|
then
|
2018-11-11 14:34:50 +02:00
|
|
|
apk update && apk add jq
|
2018-11-08 11:49:45 +02:00
|
|
|
docker tag misskey/misskey misskey/misskey:$(cat package.json | jq -r .version)
|
2018-10-31 15:00:21 +02:00
|
|
|
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
|
|
|
|
docker push misskey/misskey
|
|
|
|
else
|
|
|
|
echo -e '\033[0;33mAborted deploying to Docker Hub\033[0;39m'
|
|
|
|
fi
|
2018-10-26 21:46:48 +03:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
2019-02-09 19:17:43 +02:00
|
|
|
nodejs:
|
2018-10-26 21:46:48 +03:00
|
|
|
jobs:
|
2018-11-08 11:49:45 +02:00
|
|
|
- ok:
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- l10n_develop
|
|
|
|
- imgbot
|
2019-02-04 09:41:57 +02:00
|
|
|
- patch-autogen
|
2018-11-08 11:49:45 +02:00
|
|
|
- build:
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore:
|
|
|
|
- l10n_develop
|
|
|
|
- imgbot
|
2019-02-04 09:41:57 +02:00
|
|
|
- patch-autogen
|
2018-10-30 05:36:14 +02:00
|
|
|
- test:
|
2019-02-09 19:17:43 +02:00
|
|
|
executor: with-redis
|
2018-10-30 05:36:14 +02:00
|
|
|
requires:
|
|
|
|
- build
|
2018-11-08 11:49:45 +02:00
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore:
|
|
|
|
# - master
|
|
|
|
- l10n_develop
|
|
|
|
- imgbot
|
2019-02-04 09:41:57 +02:00
|
|
|
- patch-autogen
|
2018-10-30 05:36:14 +02:00
|
|
|
- test:
|
2019-02-09 19:17:43 +02:00
|
|
|
without_redis: true
|
2018-10-30 05:36:14 +02:00
|
|
|
requires:
|
|
|
|
- build
|
|
|
|
filters:
|
2019-02-04 09:41:57 +02:00
|
|
|
# branches:
|
|
|
|
# only: master
|
2018-10-30 05:36:14 +02:00
|
|
|
branches:
|
2019-02-04 09:41:57 +02:00
|
|
|
ignore:
|
|
|
|
# - master
|
|
|
|
- l10n_develop
|
|
|
|
- imgbot
|
|
|
|
- patch-autogen
|
2019-02-09 19:17:43 +02:00
|
|
|
docker:
|
|
|
|
jobs:
|
|
|
|
- hold:
|
|
|
|
type: approval
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: master
|
|
|
|
- docker:
|
|
|
|
requires:
|
|
|
|
- hold
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: master
|
2018-10-30 05:36:14 +02:00
|
|
|
- docker:
|
2019-02-09 19:17:43 +02:00
|
|
|
with_deploy: true
|
2018-10-30 05:36:14 +02:00
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: master
|