funkwhale/.gitlab-ci.yml

207 wiersze
4.2 KiB
YAML
Czysty Zwykły widok Historia

variables:
IMAGE_NAME: funkwhale/funkwhale
2017-06-26 20:24:37 +00:00
IMAGE: $IMAGE_NAME:$CI_COMMIT_REF_NAME
IMAGE_LATEST: $IMAGE_NAME:latest
PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"
2018-06-09 15:03:06 +00:00
PYTHONDONTWRITEBYTECODE: "true"
2017-06-25 17:12:23 +00:00
stages:
2018-06-23 14:51:31 +00:00
- review
- lint
2017-06-25 17:12:23 +00:00
- test
2017-06-25 17:13:46 +00:00
- build
- deploy
2017-06-25 17:13:46 +00:00
2018-06-23 14:51:31 +00:00
review:
stage: review
image: node:9
when: manual
allow_failure: true
before_script:
- cd front
script:
- yarn install
# this is to ensure we don't have any errors in the output,
# cf https://code.eliotberriot.com/funkwhale/funkwhale/issues/169
- INSTANCE_URL=$REVIEW_INSTANCE_URL yarn run build | tee /dev/stderr | (! grep -i 'ERROR in')
- mkdir -p /static/$CI_BUILD_REF_SLUG
- cp -r dist/* /static/$CI_BUILD_REF_SLUG
cache:
key: "$CI_PROJECT_ID__front_dependencies"
paths:
- front/node_modules
- front/yarn.lock
environment:
name: review/$CI_BUILD_REF_NAME
url: http://$CI_BUILD_REF_SLUG.$REVIEW_DOMAIN
on_stop: stop_review
only:
- branches@funkwhale/funkwhale
tags:
- funkwhale-review
stop_review:
stage: review
script:
- rm -rf /static/$CI_BUILD_REF_SLUG/
variables:
GIT_STRATEGY: none
when: manual
environment:
name: review/$CI_BUILD_REF_NAME
action: stop
tags:
- funkwhale-review
black:
image: python:3.6
stage: lint
2018-06-09 15:03:06 +00:00
variables:
GIT_STRATEGY: fetch
before_script:
- pip install black
script:
2018-06-19 18:31:01 +00:00
- black --exclude "/(\.git|\.hg|\.mypy_cache|\.tox|\.venv|_build|buck-out|build|dist|migrations)/" --check --diff api/
2018-06-09 15:12:58 +00:00
flake8:
image: python:3.6
stage: lint
variables:
GIT_STRATEGY: fetch
before_script:
- pip install flake8
script:
- flake8 -v api
2018-06-09 15:03:06 +00:00
cache:
2018-06-09 15:12:58 +00:00
key: "$CI_PROJECT_ID__flake8_pip_cache"
2018-06-09 15:03:06 +00:00
paths:
- "$PIP_CACHE_DIR"
2017-06-25 17:13:46 +00:00
test_api:
2017-12-28 21:59:43 +00:00
services:
- postgres:9.4
2018-04-02 17:24:01 +00:00
- redis:3
2017-06-25 17:13:46 +00:00
stage: test
image: funkwhale/funkwhale:latest
cache:
2018-03-20 13:41:36 +00:00
key: "$CI_PROJECT_ID__pip_cache"
paths:
- "$PIP_CACHE_DIR"
variables:
DJANGO_ALLOWED_HOSTS: "localhost"
2017-12-28 21:59:43 +00:00
DATABASE_URL: "postgresql://postgres@postgres/postgres"
FUNKWHALE_URL: "https://funkwhale.ci"
CACHEOPS_ENABLED: "false"
2018-04-02 17:16:34 +00:00
DJANGO_SETTINGS_MODULE: config.settings.local
2017-06-25 17:13:46 +00:00
before_script:
- cd api
2017-12-16 14:19:08 +00:00
- pip install -r requirements/base.txt
- pip install -r requirements/local.txt
- pip install -r requirements/test.txt
2017-06-25 17:13:46 +00:00
script:
2018-03-25 20:45:37 +00:00
- pytest --cov=funkwhale_api tests/
tags:
- docker
test_front:
stage: test
image: node:9
before_script:
- cd front
script:
- yarn install
- yarn run unit
cache:
2018-03-20 13:41:36 +00:00
key: "$CI_PROJECT_ID__front_dependencies"
paths:
- front/node_modules
- front/yarn.lock
artifacts:
name: "front_${CI_COMMIT_REF_NAME}"
paths:
- front/dist/
2017-06-25 17:13:46 +00:00
tags:
- docker
2017-06-25 17:13:46 +00:00
2017-06-25 17:13:46 +00:00
build_front:
stage: build
image: node:9
2017-06-25 17:13:46 +00:00
before_script:
- cd front
script:
- yarn install
2018-04-16 20:54:36 +00:00
- yarn run i18n-extract
- yarn run i18n-compile
2018-04-20 17:25:29 +00:00
# this is to ensure we don't have any errors in the output,
# cf https://code.eliotberriot.com/funkwhale/funkwhale/issues/169
- yarn run build | tee /dev/stderr | (! grep -i 'ERROR in')
2017-06-25 17:13:46 +00:00
cache:
2018-03-20 13:41:36 +00:00
key: "$CI_PROJECT_ID__front_dependencies"
2017-06-25 17:13:46 +00:00
paths:
- front/node_modules
- front/yarn.lock
2017-06-25 17:13:46 +00:00
artifacts:
name: "front_${CI_COMMIT_REF_NAME}"
paths:
- front/dist/
only:
- tags@funkwhale/funkwhale
- master@funkwhale/funkwhale
- develop@funkwhale/funkwhale
2017-06-25 17:13:46 +00:00
tags:
- docker
2017-06-25 17:05:31 +00:00
pages:
2017-06-25 17:12:23 +00:00
stage: test
2018-04-26 16:12:08 +00:00
image: python:3.6
variables:
BUILD_PATH: "../public"
2017-06-25 17:05:31 +00:00
before_script:
- cd docs
script:
- pip install sphinx
2018-04-26 16:12:08 +00:00
- ./build_docs.sh
2017-06-25 17:05:31 +00:00
artifacts:
paths:
- public
only:
- develop@funkwhale/funkwhale
2017-06-25 17:07:49 +00:00
tags:
- docker
docker_release:
2017-06-26 18:07:19 +00:00
stage: deploy
before_script:
2017-06-26 17:51:25 +00:00
- docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
2017-06-28 18:11:06 +00:00
- cp -r front/dist api/frontend
- cd api
script:
- docker build -t $IMAGE .
- docker push $IMAGE
only:
- develop@funkwhale/funkwhale
- tags@funkwhale/funkwhale
tags:
- docker-build
build_api:
# Simply publish a zip containing api/ directory
stage: deploy
image: busybox
artifacts:
name: "api_${CI_COMMIT_REF_NAME}"
paths:
- api
2017-07-17 20:01:57 +00:00
script: echo Done!
only:
- tags@funkwhale/funkwhale
- master@funkwhale/funkwhale
- develop@funkwhale/funkwhale