2018-10-29 20:36:14 -07:00
|
|
|
version: 2.1
|
2018-10-29 05:48:35 -07:00
|
|
|
|
2018-10-29 20:36:14 -07:00
|
|
|
executors:
|
|
|
|
default:
|
2019-02-09 09:17:43 -08:00
|
|
|
working_directory: /tmp/workspace
|
|
|
|
docker:
|
2019-05-12 01:27:27 -07:00
|
|
|
- image: misskey/ci:v11-node11
|
2018-10-29 20:36:14 -07:00
|
|
|
- image: circleci/redis:latest
|
2019-05-12 01:27:27 -07:00
|
|
|
- image: circleci/postgres:latest
|
2018-10-29 20:36:14 -07:00
|
|
|
docker:
|
|
|
|
working_directory: /tmp/workspace
|
2018-10-26 11:46:48 -07:00
|
|
|
docker:
|
2018-10-29 20:36:14 -07:00
|
|
|
- image: docker:latest
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
executor: default
|
2018-10-26 11:46:48 -07:00
|
|
|
steps:
|
|
|
|
- checkout
|
2019-01-27 03:19:24 -08:00
|
|
|
- run:
|
|
|
|
name: Ensure yarn.lock
|
|
|
|
command: |
|
|
|
|
touch yarn.lock
|
2018-10-29 20:36:14 -07:00
|
|
|
- restore_cache:
|
|
|
|
name: Restore npm package caches
|
|
|
|
keys:
|
2019-01-27 03:13:06 -08: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 11:46:48 -07:00
|
|
|
- run:
|
2018-10-29 20:36:14 -07:00
|
|
|
name: Install Dependencies
|
2018-10-26 11:46:48 -07:00
|
|
|
command: |
|
2019-02-02 23:57:36 -08:00
|
|
|
yarn install
|
2018-10-26 11:46:48 -07:00
|
|
|
- run:
|
2018-10-29 20:36:14 -07:00
|
|
|
name: Configure
|
2018-10-26 11:46:48 -07:00
|
|
|
command: |
|
2018-11-05 13:12:51 -08:00
|
|
|
cp .circleci/misskey/default.yml .config
|
|
|
|
cp .circleci/misskey/test.yml .config
|
2018-10-26 11:46:48 -07:00
|
|
|
- run:
|
2018-10-29 20:36:14 -07:00
|
|
|
name: Build
|
2018-10-26 11:46:48 -07:00
|
|
|
command: |
|
2019-01-27 03:13:06 -08:00
|
|
|
yarn build
|
2019-01-27 03:19:24 -08:00
|
|
|
touch yarn.lock
|
2018-10-29 20:36:14 -07:00
|
|
|
- save_cache:
|
|
|
|
name: Cache npm packages
|
2019-01-27 03:13:06 -08:00
|
|
|
key: yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
|
2018-10-29 20:36:14 -07:00
|
|
|
paths:
|
|
|
|
- node_modules
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: .
|
|
|
|
paths:
|
|
|
|
- .
|
|
|
|
test:
|
|
|
|
parameters:
|
2019-02-09 09:17:43 -08:00
|
|
|
executor:
|
2018-10-29 20:36:14 -07:00
|
|
|
type: string
|
2019-02-09 09:17:43 -08:00
|
|
|
default: "default"
|
|
|
|
executor: <<parameters.executor>>
|
2018-10-29 20:36:14 -07:00
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: /tmp/workspace
|
2018-10-26 11:46:48 -07:00
|
|
|
- run:
|
2018-10-29 20:36:14 -07:00
|
|
|
name: Test
|
2018-10-26 11:46:48 -07:00
|
|
|
command: |
|
2019-01-27 03:13:06 -08:00
|
|
|
yarn test
|
2019-01-27 03:19:24 -08:00
|
|
|
touch yarn.lock
|
2018-10-29 20:36:14 -07:00
|
|
|
- save_cache:
|
|
|
|
name: Cache npm packages
|
2019-01-27 03:13:06 -08:00
|
|
|
key: yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
|
2018-10-29 20:36:14 -07:00
|
|
|
paths:
|
|
|
|
- node_modules
|
|
|
|
docker:
|
|
|
|
parameters:
|
|
|
|
with_deploy:
|
2019-02-09 09:17:43 -08:00
|
|
|
type: boolean
|
|
|
|
default: false
|
2018-10-29 20:36:14 -07:00
|
|
|
executor: docker
|
2018-10-26 11:46:48 -07:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- setup_remote_docker
|
|
|
|
- run:
|
2018-10-29 20:36:14 -07:00
|
|
|
name: Build
|
2018-10-26 11:46:48 -07:00
|
|
|
command: |
|
2018-11-06 09:06:32 -08:00
|
|
|
docker build -t misskey/misskey .
|
2018-10-29 20:36:14 -07:00
|
|
|
- when:
|
|
|
|
condition: <<parameters.with_deploy>>
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: Deploy
|
|
|
|
command: |
|
2018-10-31 06:00:21 -07:00
|
|
|
if [ "$DOCKERHUB_USERNAME$DOCKERHUB_PASSWORD" ]
|
|
|
|
then
|
2018-11-11 04:34:50 -08:00
|
|
|
apk update && apk add jq
|
2018-11-08 01:49:45 -08:00
|
|
|
docker tag misskey/misskey misskey/misskey:$(cat package.json | jq -r .version)
|
2018-10-31 06:00:21 -07: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 11:46:48 -07:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
2019-02-09 09:17:43 -08:00
|
|
|
nodejs:
|
2018-10-26 11:46:48 -07:00
|
|
|
jobs:
|
2019-02-15 18:10:06 -08:00
|
|
|
- hold:
|
2019-02-17 09:44:46 -08:00
|
|
|
name: manual-build-trigger
|
2019-02-15 18:10:06 -08:00
|
|
|
type: approval
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: master
|
2018-11-08 01:49:45 -08:00
|
|
|
- build:
|
2019-02-17 09:44:46 -08:00
|
|
|
name: manual-build
|
2019-02-15 18:10:06 -08:00
|
|
|
requires:
|
2019-02-17 09:44:46 -08:00
|
|
|
- manual-build-trigger
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: master
|
|
|
|
- build:
|
|
|
|
name: auto-build
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: master
|
2018-10-29 20:36:14 -07:00
|
|
|
- test:
|
2019-04-16 22:39:45 -07:00
|
|
|
name: manual-test
|
2018-10-29 20:36:14 -07:00
|
|
|
requires:
|
2019-02-17 09:44:46 -08:00
|
|
|
- manual-build
|
2019-02-16 00:05:56 -08:00
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: master
|
2019-02-17 09:44:46 -08:00
|
|
|
- test:
|
2019-04-16 22:39:45 -07:00
|
|
|
name: auto-test
|
2019-02-17 09:44:46 -08:00
|
|
|
requires:
|
|
|
|
- auto-build
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: master
|
|
|
|
docker:
|
|
|
|
jobs:
|
2019-02-09 09:17:43 -08:00
|
|
|
- hold:
|
2019-02-17 09:44:46 -08:00
|
|
|
name: manual-build-trigger
|
2019-02-09 09:17:43 -08:00
|
|
|
type: approval
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: master
|
|
|
|
- docker:
|
2019-02-17 09:44:46 -08:00
|
|
|
name: manual-build
|
2019-02-09 09:17:43 -08:00
|
|
|
requires:
|
2019-02-17 09:44:46 -08:00
|
|
|
- manual-build-trigger
|
2019-02-09 09:17:43 -08:00
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: master
|
2018-10-29 20:36:14 -07:00
|
|
|
- docker:
|
2019-02-17 09:44:46 -08:00
|
|
|
name: auto-build
|
2019-02-09 09:17:43 -08:00
|
|
|
with_deploy: true
|
2018-10-29 20:36:14 -07:00
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: master
|