mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-05 14:23:08 +02:00
166 lines
4.5 KiB
YAML
166 lines
4.5 KiB
YAML
version: 2.1
|
|
|
|
executors:
|
|
default:
|
|
working_directory: /tmp/workspace
|
|
docker:
|
|
- image: misskey/ci:latest
|
|
- image: circleci/mongo:latest
|
|
- image: circleci/redis:latest
|
|
docker:
|
|
working_directory: /tmp/workspace
|
|
docker:
|
|
- image: docker:latest
|
|
alpine:
|
|
working_directory: /tmp/workspace
|
|
docker:
|
|
- image: alpine:latest
|
|
|
|
jobs:
|
|
ok:
|
|
executor: alpine
|
|
steps:
|
|
- run:
|
|
name: OK
|
|
command: |
|
|
echo -e '\033[0;32mOK\033[0;39m'
|
|
|
|
build:
|
|
executor: default
|
|
steps:
|
|
- checkout
|
|
- restore_cache:
|
|
name: Restore npm package caches
|
|
keys:
|
|
- 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-
|
|
- run:
|
|
name: Install Dependencies
|
|
command: |
|
|
npm install
|
|
npm prune
|
|
- run:
|
|
name: Configure
|
|
command: |
|
|
cp .circleci/misskey/default.yml .config
|
|
cp .circleci/misskey/test.yml .config
|
|
- run:
|
|
name: Build
|
|
command: |
|
|
yarn install
|
|
yarn autoclean
|
|
yarn build
|
|
[ ! -e yarn.lock ] && 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
|
|
# - store_artifacts:
|
|
# path: built
|
|
- persist_to_workspace:
|
|
root: .
|
|
paths:
|
|
- .
|
|
test:
|
|
parameters:
|
|
without_redis:
|
|
type: string
|
|
default: ""
|
|
executor: default
|
|
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
|
|
- run:
|
|
name: Test
|
|
command: |
|
|
yarn test
|
|
[ ! -e yarn.lock ] && 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:
|
|
parameters:
|
|
with_deploy:
|
|
type: string
|
|
default: ""
|
|
executor: docker
|
|
steps:
|
|
- checkout
|
|
- setup_remote_docker
|
|
- run:
|
|
name: Build
|
|
command: |
|
|
docker build -t misskey/misskey .
|
|
- when:
|
|
condition: <<parameters.with_deploy>>
|
|
steps:
|
|
- run:
|
|
name: Deploy
|
|
command: |
|
|
if [ "$DOCKERHUB_USERNAME$DOCKERHUB_PASSWORD" ]
|
|
then
|
|
apk update && apk add jq
|
|
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
|
|
|
|
workflows:
|
|
version: 2
|
|
build-and-test:
|
|
jobs:
|
|
- ok:
|
|
filters:
|
|
branches:
|
|
only:
|
|
- l10n_develop
|
|
- imgbot
|
|
- build:
|
|
filters:
|
|
branches:
|
|
ignore:
|
|
- l10n_develop
|
|
- imgbot
|
|
- test:
|
|
requires:
|
|
- build
|
|
filters:
|
|
branches:
|
|
ignore:
|
|
# - master
|
|
- l10n_develop
|
|
- imgbot
|
|
- test:
|
|
without_redis: "true"
|
|
requires:
|
|
- build
|
|
filters:
|
|
branches:
|
|
only: master
|
|
# - docker:
|
|
# filters:
|
|
# branches:
|
|
# ignore: master
|
|
- docker:
|
|
with_deploy: "true"
|
|
filters:
|
|
branches:
|
|
only: master
|