misskey/.circleci/config.yml

279 lines
8.2 KiB
YAML
Raw Normal View History

version: 2.1
2018-10-29 12:48:35 +00:00
executors:
2019-05-12 09:04:39 +00:00
v11-node11:
2019-05-12 12:58:46 +00:00
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
2019-05-12 08:27:27 +00:00
- image: misskey/ci:v11-node11
2019-05-12 09:04:39 +00:00
- image: circleci/postgres:latest
- image: circleci/redis:latest
v11-node8:
2019-05-12 12:58:46 +00:00
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
2019-05-12 09:04:39 +00:00
docker:
- image: misskey/ci:v11-node8
- image: circleci/postgres:latest
- image: circleci/redis:latest
v10-node11:
2019-05-12 12:58:46 +00:00
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
2019-05-12 09:04:39 +00:00
docker:
- image: misskey/ci:v10-node11
- image: circleci/mongo:latest
v10-node11-redis:
2019-05-12 12:58:46 +00:00
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
2019-05-12 09:04:39 +00:00
docker:
- image: misskey/ci:v10-node11
- image: circleci/mongo:latest
2019-05-12 09:04:39 +00:00
v10-node8:
2019-05-12 12:58:46 +00:00
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
2019-05-12 09:04:39 +00:00
- image: misskey/ci:v10-node8
- image: circleci/mongo:latest
- image: circleci/redis:latest
v10-node8-redis:
2019-05-12 12:58:46 +00:00
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
2019-05-12 09:04:39 +00:00
docker:
- image: misskey/ci:v10-node8
- image: circleci/mongo:latest
- image: circleci/redis:latest
docker:
2019-05-12 12:58:46 +00:00
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
2018-10-26 18:46:48 +00:00
docker:
2019-05-12 09:04:39 +00:00
- image: misskey/ci:docker
jobs:
2019-05-12 09:04:39 +00:00
nodejs-build:
parameters:
executor:
type: string
default: "v11-node11"
2019-05-12 12:58:46 +00:00
target:
type: string
default: "v11"
2019-05-12 09:04:39 +00:00
executor: <<parameters.executor>>
2018-10-26 18:46:48 +00:00
steps:
- checkout
2019-01-27 11:19:24 +00:00
- run:
name: Ensure yarn.lock
command: |
touch yarn.lock
- restore_cache:
name: Restore npm package caches
keys:
2019-01-27 11:13:06 +00: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 18:46:48 +00:00
- run:
name: Install Dependencies
2018-10-26 18:46:48 +00:00
command: |
2019-02-03 07:57:36 +00:00
yarn install
2018-10-26 18:46:48 +00:00
- run:
name: Configure
2018-10-26 18:46:48 +00:00
command: |
2019-05-12 09:04:39 +00:00
cp .circleci/<<parameters.executor>>/default.yml .config
cp .circleci/<<parameters.executor>>/test.yml .config
2018-10-26 18:46:48 +00:00
- run:
name: Build
2018-10-26 18:46:48 +00:00
command: |
2019-05-12 12:58:46 +00:00
excepted="<<parameters.target>>"
actual="v$(cat package.json | jq -r '.version' | awk -F. '{print $1}')"
if [ $excepted = $actual ]
then
yarn build
touch yarn.lock
else
echo -e '\033[0;33mBuild Aborted\033[0;39m'
fi
- save_cache:
name: Cache npm packages
2019-01-27 11:13:06 +00:00
key: yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
paths:
- node_modules
- persist_to_workspace:
root: .
paths:
- .
2019-05-12 09:04:39 +00:00
nodejs-test:
parameters:
executor:
type: string
2019-05-12 13:00:52 +00:00
default: "v11-node11"
target:
type: string
default: "v11"
executor: <<parameters.executor>>
steps:
- attach_workspace:
2019-05-12 12:58:46 +00:00
at: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
2018-10-26 18:46:48 +00:00
- run:
name: Test
2018-10-26 18:46:48 +00:00
command: |
2019-05-12 12:58:46 +00:00
excepted="<<parameters.target>>"
actual="v$(cat package.json | jq -r '.version' | awk -F. '{print $1}')"
if [ $excepted = $actual ]
then
yarn test
else
echo -e '\033[0;33mTest Aborted\033[0;39m'
fi
2019-01-27 11:19:24 +00:00
touch yarn.lock
- save_cache:
name: Cache npm packages
2019-01-27 11:13:06 +00:00
key: yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
paths:
- node_modules
2019-05-12 12:58:46 +00:00
docker:
parameters:
deploy:
type: boolean
default: false
executor: docker
2018-10-26 18:46:48 +00:00
steps:
- checkout
2019-05-12 12:58:46 +00:00
- setup_remote_docker:
docker_layer_caching: true
2018-10-26 18:46:48 +00:00
- run:
name: Build
2018-10-26 18:46:48 +00:00
command: |
2018-11-06 17:06:32 +00:00
docker build -t misskey/misskey .
2019-05-12 12:58:46 +00:00
- when:
condition: <<parameters.deploy>>
steps:
- run:
name: Deploy
command: |
if [ "$DOCKERHUB_USERNAME$DOCKERHUB_PASSWORD" ]
then
docker tag misskey/misskey misskey/misskey:$(cat package.json | jq -r .version)
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
docker push misskey/misskey
else
echo -e '\033[0;33mDeploy Aborted\033[0;39m'
fi
2018-10-26 18:46:48 +00:00
workflows:
version: 2
nodejs:
2018-10-26 18:46:48 +00:00
jobs:
2019-05-12 09:04:39 +00:00
- nodejs-build:
2019-05-12 13:09:42 +00:00
name: build-v11-node11
2019-05-12 09:04:39 +00:00
executor: v11-node11
2019-05-12 12:58:46 +00:00
target: v11
2019-02-16 02:10:06 +00:00
filters:
branches:
2019-05-12 09:04:39 +00:00
ignore:
- imgbot
2019-05-12 12:58:46 +00:00
- l10n_develop
2019-05-12 09:04:39 +00:00
- patch/autogen/v10
- patch/autogen/v11
2019-05-12 09:06:06 +00:00
- nodejs-test:
2019-05-12 13:09:42 +00:00
name: test-v11-node11
2019-05-12 09:04:39 +00:00
executor: v11-node11
2019-05-12 12:58:46 +00:00
target: v11
2019-02-16 02:10:06 +00:00
requires:
2019-05-12 13:09:42 +00:00
- build-v11-node11
2019-05-12 09:04:39 +00:00
- nodejs-build:
2019-05-12 13:09:42 +00:00
name: build-v11-node8
2019-05-12 09:04:39 +00:00
executor: v11-node8
2019-05-12 12:58:46 +00:00
target: v11
filters:
branches:
2019-05-12 09:04:39 +00:00
ignore:
- imgbot
2019-05-12 12:58:46 +00:00
- l10n_develop
2019-05-12 09:04:39 +00:00
- patch/autogen/v10
- patch/autogen/v11
- nodejs-test:
2019-05-12 13:09:42 +00:00
name: test-v11-node8
2019-05-12 09:04:39 +00:00
executor: v11-node8
2019-05-12 12:58:46 +00:00
target: v11
requires:
2019-05-12 13:09:42 +00:00
- build-v11-node8
2019-05-12 12:58:46 +00:00
- nodejs-build:
2019-05-12 13:09:42 +00:00
name: build-v10-node11
2019-05-12 12:58:46 +00:00
executor: v10-node11
target: v10
2019-05-12 09:04:39 +00:00
filters:
branches:
ignore:
- imgbot
2019-05-12 12:58:46 +00:00
- l10n_develop
2019-05-12 09:04:39 +00:00
- patch/autogen/v10
- patch/autogen/v11
- nodejs-test:
2019-05-12 13:09:42 +00:00
name: test-v10-node11
2019-05-12 09:04:39 +00:00
executor: v10-node11
2019-05-12 12:58:46 +00:00
target: v10
requires:
2019-05-12 13:09:42 +00:00
- build-v10-node11
2019-05-12 09:04:39 +00:00
- nodejs-build:
2019-05-12 13:09:42 +00:00
name: build-v10-node11-redis
2019-05-12 09:04:39 +00:00
executor: v10-node11-redis
2019-05-12 12:58:46 +00:00
target: v10
2019-05-12 09:04:39 +00:00
filters:
branches:
2019-05-12 12:58:46 +00:00
ignore:
- imgbot
- l10n_develop
- patch/autogen/v10
- patch/autogen/v11
2019-05-12 09:04:39 +00:00
- nodejs-test:
2019-05-12 13:09:42 +00:00
name: test-v10-node11-redis
2019-05-12 09:04:39 +00:00
executor: v10-node11-redis
2019-05-12 12:58:46 +00:00
target: v10
requires:
2019-05-12 13:09:42 +00:00
- build-v10-node11-redis
2019-05-12 09:04:39 +00:00
- nodejs-build:
2019-05-12 13:09:42 +00:00
name: build-v10-node8
2019-05-12 09:04:39 +00:00
executor: v10-node8
2019-05-12 12:58:46 +00:00
target: v10
2019-02-16 08:05:56 +00:00
filters:
branches:
2019-05-12 12:58:46 +00:00
ignore:
- imgbot
- l10n_develop
- patch/autogen/v10
- patch/autogen/v11
2019-05-12 09:04:39 +00:00
- nodejs-test:
2019-05-12 13:09:42 +00:00
name: test-v10-node8
2019-05-12 09:04:39 +00:00
executor: v10-node8
2019-05-12 12:58:46 +00:00
target: v10
requires:
2019-05-12 13:09:42 +00:00
- build-v10-node8
2019-05-12 09:04:39 +00:00
- nodejs-build:
2019-05-12 13:09:42 +00:00
name: build-v10-node8-redis
2019-05-12 09:04:39 +00:00
executor: v10-node8-redis
2019-05-12 12:58:46 +00:00
target: v10
filters:
branches:
2019-05-12 12:58:46 +00:00
ignore:
- imgbot
- l10n_develop
- patch/autogen/v10
- patch/autogen/v11
2019-05-12 09:04:39 +00:00
- nodejs-test:
2019-05-12 13:09:42 +00:00
name: test-v10-node8-redis
2019-05-12 09:04:39 +00:00
executor: v10-node8-redis
2019-05-12 12:58:46 +00:00
target: v10
requires:
2019-05-12 13:09:42 +00:00
- build-v10-node8-redis
2019-05-12 09:04:39 +00:00
docker:
jobs:
2019-05-12 12:58:46 +00:00
- docker:
2019-05-12 13:09:42 +00:00
name: build-docker
2019-05-12 12:58:46 +00:00
filters:
branches:
ignore:
- imgbot
- l10n_develop
- master
- patch/autogen/v10
- patch/autogen/v11
- docker:
2019-05-12 13:09:42 +00:00
name: deploy-docker
2019-05-12 12:58:46 +00:00
deploy: true
filters:
branches:
only: master