Auto abort incorrect target

This commit is contained in:
Acid Chicken (硫酸鶏) 2019-05-12 21:58:46 +09:00
parent b2c60fb513
commit 48862ef783
No known key found for this signature in database
GPG key ID: 5388F56C75B677A1

View file

@ -2,41 +2,41 @@ version: 2.1
executors:
v11-node11:
working_directory: /tmp/workspace
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
- image: misskey/ci:v11-node11
- image: circleci/postgres:latest
- image: circleci/redis:latest
v11-node8:
working_directory: /tmp/workspace
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
- image: misskey/ci:v11-node8
- image: circleci/postgres:latest
- image: circleci/redis:latest
v10-node11:
working_directory: /tmp/workspace
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
- image: misskey/ci:v10-node11
- image: circleci/mongo:latest
v10-node11-redis:
working_directory: /tmp/workspace
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
- image: misskey/ci:v10-node11
- image: circleci/mongo:latest
v10-node8:
working_directory: /tmp/workspace
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
- image: misskey/ci:v10-node8
- image: circleci/mongo:latest
- image: circleci/redis:latest
v10-node8-redis:
working_directory: /tmp/workspace
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
- image: misskey/ci:v10-node8
- image: circleci/mongo:latest
- image: circleci/redis:latest
docker:
working_directory: /tmp/workspace
working_directory: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
docker:
- image: misskey/ci:docker
@ -46,6 +46,9 @@ jobs:
executor:
type: string
default: "v11-node11"
target:
type: string
default: "v11"
executor: <<parameters.executor>>
steps:
- checkout
@ -73,8 +76,15 @@ jobs:
- run:
name: Build
command: |
yarn build
touch yarn.lock
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
key: yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
@ -92,46 +102,52 @@ jobs:
executor: <<parameters.executor>>
steps:
- attach_workspace:
at: /tmp/workspace
at: /tmp/605d145e08d777510640c4509145d45489e9b83b3ae630dda16370ce0cb38947
- run:
name: Test
command: |
yarn test
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
touch yarn.lock
- save_cache:
name: Cache npm packages
key: yarn-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "yarn.lock" }}
paths:
- node_modules
docker-build:
docker:
parameters:
deploy:
type: boolean
default: false
executor: docker
steps:
- checkout
- setup_remote_docker
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Build
command: |
docker build -t misskey/misskey .
- persist_to_workspace:
root: .
paths:
- .
docker-deploy:
executor: docker
steps:
- attach_workspace:
at: /tmp/workspace
- 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;33mAborted deploying to Docker Hub\033[0;39m'
fi
- 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
workflows:
version: 2
@ -140,115 +156,120 @@ workflows:
- nodejs-build:
name: auto-build-v11-node11
executor: v11-node11
target: v11
filters:
branches:
ignore:
- l10n_develop
- imgbot
- l10n_develop
- patch/autogen/v10
- patch/autogen/v11
- v10
- nodejs-test:
name: auto-test-v11-node11
executor: v11-node11
target: v11
requires:
- auto-build-v11-node11
filters:
branches:
ignore:
- l10n_develop
- imgbot
- patch/autogen/v10
- patch/autogen/v11
- v10
- nodejs-build:
name: auto-build-v11-node8
executor: v11-node8
target: v11
filters:
branches:
ignore:
- l10n_develop
- imgbot
- l10n_develop
- patch/autogen/v10
- patch/autogen/v11
- v10
- nodejs-test:
name: auto-test-v11-node8
executor: v11-node8
target: v11
requires:
- auto-build-v11-node8
filters:
branches:
ignore:
- l10n_develop
- imgbot
- patch/autogen/v10
- patch/autogen/v11
- v10
- nodejs-build:
name: auto-build-v10-node11
executor: v10-node11
target: v10
filters:
branches:
only: v10
ignore:
- imgbot
- l10n_develop
- patch/autogen/v10
- patch/autogen/v11
- nodejs-test:
name: auto-test-v10-node11
executor: v10-node11
target: v10
requires:
- auto-build-v10-node11
filters:
branches:
only: v10
- nodejs-build:
name: auto-build-v10-node11-redis
executor: v10-node11-redis
target: v10
filters:
branches:
only: v10
ignore:
- imgbot
- l10n_develop
- patch/autogen/v10
- patch/autogen/v11
- nodejs-test:
name: auto-test-v10-node11-redis
executor: v10-node11-redis
target: v10
requires:
- auto-build-v10-node11-redis
filters:
branches:
only: v10
- nodejs-build:
name: auto-build-v10-node8
executor: v10-node8
target: v10
filters:
branches:
only: v10
ignore:
- imgbot
- l10n_develop
- patch/autogen/v10
- patch/autogen/v11
- nodejs-test:
name: auto-test-v10-node8
executor: v10-node8
target: v10
requires:
- auto-build-v10-node8
filters:
branches:
only: v10
- nodejs-build:
name: auto-build-v10-node8-redis
executor: v10-node8-redis
target: v10
filters:
branches:
only: v10
ignore:
- imgbot
- l10n_develop
- patch/autogen/v10
- patch/autogen/v11
- nodejs-test:
name: auto-test-v10-node8-redis
executor: v10-node8-redis
target: v10
requires:
- auto-build-v10-node8-redis
filters:
branches:
only: v10
docker:
jobs:
- docker-build:
- docker:
name: auto-build
- docker-deploy:
filters:
branches:
ignore:
- imgbot
- l10n_develop
- master
- patch/autogen/v10
- patch/autogen/v11
- docker:
name: auto-deploy
requires:
- auto-build
deploy: true
filters:
branches:
only: master