Sharkey/.circleci/config.yml

160 lines
4.2 KiB
YAML
Raw Normal View History

version: 2.1
2018-10-29 14:48:35 +02:00
executors:
default:
working_directory: /tmp/workspace
docker:
2019-05-12 11:27:27 +03:00
- image: misskey/ci:v11-node11
- image: circleci/redis:latest
2019-05-12 11:27:27 +03:00
- image: circleci/postgres:latest
docker:
working_directory: /tmp/workspace
2018-10-26 21:46:48 +03:00
docker:
- image: docker:latest
jobs:
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
- 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:
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:
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:
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
- 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" }}
paths:
- node_modules
- persist_to_workspace:
root: .
paths:
- .
test:
parameters:
executor:
type: string
default: "default"
executor: <<parameters.executor>>
steps:
- attach_workspace:
at: /tmp/workspace
2018-10-26 21:46:48 +03:00
- run:
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
- 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" }}
paths:
- node_modules
docker:
parameters:
with_deploy:
type: boolean
default: false
executor: docker
2018-10-26 21:46:48 +03:00
steps:
- checkout
- setup_remote_docker
- run:
name: Build
2018-10-26 21:46:48 +03:00
command: |
2018-11-06 19:06:32 +02:00
docker build -t misskey/misskey .
- 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
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
nodejs:
2018-10-26 21:46:48 +03:00
jobs:
2019-02-16 04:10:06 +02:00
- hold:
name: manual-build-trigger
2019-02-16 04:10:06 +02:00
type: approval
filters:
branches:
ignore: master
- build:
name: manual-build
2019-02-16 04:10:06 +02:00
requires:
- manual-build-trigger
filters:
branches:
ignore: master
- build:
name: auto-build
filters:
branches:
only: master
- test:
2019-04-17 08:39:45 +03:00
name: manual-test
requires:
- manual-build
2019-02-16 10:05:56 +02:00
filters:
branches:
ignore: master
- test:
2019-04-17 08:39:45 +03:00
name: auto-test
requires:
- auto-build
filters:
branches:
only: master
docker:
jobs:
- hold:
name: manual-build-trigger
type: approval
filters:
branches:
ignore: master
- docker:
name: manual-build
requires:
- manual-build-trigger
filters:
branches:
ignore: master
- docker:
name: auto-build
with_deploy: true
filters:
branches:
only: master