2017-06-26 20:04:55 +00:00
|
|
|
variables:
|
|
|
|
IMAGE_NAME: funkwhale/funkwhale
|
2017-06-26 20:24:37 +00:00
|
|
|
IMAGE: $IMAGE_NAME:$CI_COMMIT_REF_NAME
|
2019-01-16 10:56:58 +00:00
|
|
|
ALL_IN_ONE_IMAGE_NAME: funkwhale/all-in-one
|
|
|
|
ALL_IN_ONE_IMAGE: $ALL_IN_ONE_IMAGE_NAME:$CI_COMMIT_REF_NAME
|
2018-01-09 19:47:03 +00:00
|
|
|
PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"
|
2018-06-09 15:03:06 +00:00
|
|
|
PYTHONDONTWRITEBYTECODE: "true"
|
2018-07-04 16:31:29 +00:00
|
|
|
REVIEW_DOMAIN: preview.funkwhale.audio
|
|
|
|
REVIEW_INSTANCE_URL: https://demo.funkwhale.audio
|
2017-06-26 20:04:55 +00:00
|
|
|
|
2017-06-25 17:12:23 +00:00
|
|
|
stages:
|
2018-06-23 14:51:31 +00:00
|
|
|
- review
|
2018-06-09 14:00:00 +00:00
|
|
|
- lint
|
2017-06-25 17:12:23 +00:00
|
|
|
- test
|
2017-06-25 17:13:46 +00:00
|
|
|
- build
|
2017-06-26 17:48:09 +00:00
|
|
|
- deploy
|
2017-06-25 17:13:46 +00:00
|
|
|
|
2018-06-24 10:37:01 +00:00
|
|
|
review_front:
|
2018-06-23 14:51:31 +00:00
|
|
|
stage: review
|
|
|
|
image: node:9
|
|
|
|
when: manual
|
|
|
|
allow_failure: true
|
|
|
|
before_script:
|
2018-07-01 15:07:21 +00:00
|
|
|
- curl -L -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
|
|
|
|
- chmod +x /usr/local/bin/jq
|
2018-06-23 14:51:31 +00:00
|
|
|
- cd front
|
|
|
|
script:
|
|
|
|
- yarn install
|
2018-06-30 10:12:53 +00:00
|
|
|
- yarn run i18n-compile
|
2018-06-23 14:51:31 +00:00
|
|
|
# this is to ensure we don't have any errors in the output,
|
2018-12-10 15:00:33 +00:00
|
|
|
# cf https://dev.funkwhale.audio/funkwhale/funkwhale/issues/169
|
2018-08-21 16:22:57 +00:00
|
|
|
- VUE_APP_INSTANCE_URL=$REVIEW_INSTANCE_URL yarn run build | tee /dev/stderr | (! grep -i 'ERROR in')
|
2018-07-04 16:31:29 +00:00
|
|
|
- mkdir -p /static/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG
|
|
|
|
- cp -r dist/* /static/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG
|
2018-06-23 14:51:31 +00:00
|
|
|
cache:
|
2018-07-04 16:31:29 +00:00
|
|
|
key: "funkwhale__front_dependencies"
|
2018-06-23 14:51:31 +00:00
|
|
|
paths:
|
|
|
|
- front/node_modules
|
|
|
|
- front/yarn.lock
|
|
|
|
environment:
|
2018-07-04 16:31:29 +00:00
|
|
|
name: review/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG
|
|
|
|
url: http://front-$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG.$REVIEW_DOMAIN
|
2018-06-24 10:37:01 +00:00
|
|
|
on_stop: stop_front_review
|
2018-06-23 14:51:31 +00:00
|
|
|
only:
|
2018-07-01 14:21:08 +00:00
|
|
|
- branches
|
2018-06-23 14:51:31 +00:00
|
|
|
tags:
|
|
|
|
- funkwhale-review
|
|
|
|
|
2018-06-24 10:37:01 +00:00
|
|
|
stop_front_review:
|
2018-06-23 14:51:31 +00:00
|
|
|
stage: review
|
|
|
|
script:
|
2018-07-04 16:31:29 +00:00
|
|
|
- rm -rf /static/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG/
|
2018-06-23 14:51:31 +00:00
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: none
|
|
|
|
when: manual
|
2018-07-01 14:21:08 +00:00
|
|
|
only:
|
|
|
|
- branches
|
2018-06-23 14:51:31 +00:00
|
|
|
environment:
|
2018-07-04 16:31:29 +00:00
|
|
|
name: review/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG
|
2018-06-24 10:37:01 +00:00
|
|
|
action: stop
|
|
|
|
tags:
|
|
|
|
- funkwhale-review
|
|
|
|
|
|
|
|
review_docs:
|
|
|
|
stage: review
|
|
|
|
image: python:3.6
|
|
|
|
when: manual
|
|
|
|
allow_failure: true
|
|
|
|
variables:
|
|
|
|
BUILD_PATH: "../public"
|
|
|
|
before_script:
|
|
|
|
- cd docs
|
2018-06-24 21:42:38 +00:00
|
|
|
- apt-get update
|
|
|
|
- apt-get install -y graphviz
|
|
|
|
- pip install sphinx
|
|
|
|
|
2018-06-24 10:37:01 +00:00
|
|
|
cache:
|
|
|
|
key: "$CI_PROJECT_ID__sphinx"
|
|
|
|
paths:
|
|
|
|
- "$PIP_CACHE_DIR"
|
|
|
|
script:
|
|
|
|
- ./build_docs.sh
|
2018-07-04 16:31:29 +00:00
|
|
|
- mkdir -p /static/docs/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG
|
|
|
|
- cp -r $CI_PROJECT_DIR/public/* /static/docs/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG
|
2018-06-24 10:37:01 +00:00
|
|
|
environment:
|
2018-07-04 16:31:29 +00:00
|
|
|
name: review/docs/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG
|
|
|
|
url: http://docs-$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG.$REVIEW_DOMAIN
|
2018-06-24 10:37:01 +00:00
|
|
|
on_stop: stop_docs_review
|
|
|
|
only:
|
2018-07-01 14:21:08 +00:00
|
|
|
- branches
|
2018-06-24 10:37:01 +00:00
|
|
|
tags:
|
|
|
|
- funkwhale-review
|
|
|
|
|
|
|
|
stop_docs_review:
|
|
|
|
stage: review
|
|
|
|
script:
|
2018-07-04 16:31:29 +00:00
|
|
|
- rm -rf /static/docs/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG/
|
2018-06-24 10:37:01 +00:00
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: none
|
|
|
|
when: manual
|
2018-07-01 14:21:08 +00:00
|
|
|
only:
|
|
|
|
- branches
|
2018-06-24 10:37:01 +00:00
|
|
|
environment:
|
2018-07-04 16:31:29 +00:00
|
|
|
name: review/docs/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG
|
2018-06-23 14:51:31 +00:00
|
|
|
action: stop
|
|
|
|
tags:
|
|
|
|
- funkwhale-review
|
|
|
|
|
2018-06-09 14:00:00 +00:00
|
|
|
black:
|
|
|
|
image: python:3.6
|
|
|
|
stage: lint
|
2018-06-09 15:03:06 +00:00
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: fetch
|
2018-06-09 14:00:00 +00:00
|
|
|
before_script:
|
|
|
|
- pip install black
|
|
|
|
script:
|
2019-03-15 11:11:05 +00:00
|
|
|
- black --check --diff api/
|
2019-03-26 09:45:52 +00:00
|
|
|
|
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:
|
2018-06-10 10:10:15 +00:00
|
|
|
- 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"
|
2018-06-09 14:00:00 +00:00
|
|
|
|
2017-06-25 17:13:46 +00:00
|
|
|
test_api:
|
2017-12-28 21:59:43 +00:00
|
|
|
services:
|
2019-01-11 09:45:38 +00:00
|
|
|
- postgres:11
|
2018-04-02 17:24:01 +00:00
|
|
|
- redis:3
|
2017-06-25 17:13:46 +00:00
|
|
|
stage: test
|
2018-10-20 14:24:19 +00:00
|
|
|
image: funkwhale/funkwhale:develop
|
2018-01-09 19:47:03 +00:00
|
|
|
cache:
|
2018-03-20 13:41:36 +00:00
|
|
|
key: "$CI_PROJECT_ID__pip_cache"
|
2018-01-09 19:47:03 +00:00
|
|
|
paths:
|
|
|
|
- "$PIP_CACHE_DIR"
|
2017-12-16 15:10:48 +00:00
|
|
|
variables:
|
2017-12-28 21:59:43 +00:00
|
|
|
DATABASE_URL: "postgresql://postgres@postgres/postgres"
|
2018-02-25 13:43:23 +00:00
|
|
|
FUNKWHALE_URL: "https://funkwhale.ci"
|
2018-04-02 17:16:34 +00:00
|
|
|
DJANGO_SETTINGS_MODULE: config.settings.local
|
2018-07-01 14:21:08 +00:00
|
|
|
only:
|
2019-03-26 09:45:52 +00:00
|
|
|
- branches
|
2017-06-25 17:13:46 +00:00
|
|
|
before_script:
|
2017-06-26 15:20:46 +00:00
|
|
|
- cd api
|
2019-01-21 13:20:14 +00:00
|
|
|
- sed -i '/Pillow/d' requirements/base.txt
|
|
|
|
- pip3 install -r requirements/base.txt
|
|
|
|
- pip3 install -r requirements/local.txt
|
|
|
|
- pip3 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/
|
2018-01-09 19:47:03 +00:00
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
|
|
|
|
test_front:
|
|
|
|
stage: test
|
|
|
|
image: node:9
|
|
|
|
before_script:
|
|
|
|
- cd front
|
2018-07-01 14:21:08 +00:00
|
|
|
only:
|
2019-03-26 09:45:52 +00:00
|
|
|
- branches
|
2018-01-09 19:47:03 +00:00
|
|
|
script:
|
2019-01-15 11:10:40 +00:00
|
|
|
- yarn install --check-files
|
2018-08-11 15:58:51 +00:00
|
|
|
- yarn test:unit
|
2017-12-16 15:10:48 +00:00
|
|
|
cache:
|
2018-07-04 16:31:29 +00:00
|
|
|
key: "funkwhale__front_dependencies"
|
2017-12-16 15:10:48 +00:00
|
|
|
paths:
|
2018-01-09 19:47:03 +00:00
|
|
|
- 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:
|
2017-06-26 15:20:46 +00:00
|
|
|
- docker
|
2017-06-25 17:13:46 +00:00
|
|
|
|
|
|
|
build_front:
|
|
|
|
stage: build
|
2018-01-09 19:47:03 +00:00
|
|
|
image: node:9
|
2017-06-25 17:13:46 +00:00
|
|
|
before_script:
|
2018-07-01 15:07:21 +00:00
|
|
|
- curl -L -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
|
|
|
|
- chmod +x /usr/local/bin/jq
|
2017-06-25 17:13:46 +00:00
|
|
|
- cd front
|
|
|
|
script:
|
2018-01-09 19:47:03 +00:00
|
|
|
- yarn install
|
2018-04-16 20:54:36 +00:00
|
|
|
- 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,
|
2018-12-10 15:00:33 +00:00
|
|
|
# cf https://dev.funkwhale.audio/funkwhale/funkwhale/issues/169
|
2018-08-11 15:58:51 +00:00
|
|
|
- yarn build | tee /dev/stderr | (! grep -i 'ERROR in')
|
2018-08-19 15:30:18 +00:00
|
|
|
- chmod -R 755 dist
|
2017-06-25 17:13:46 +00:00
|
|
|
artifacts:
|
|
|
|
name: "front_${CI_COMMIT_REF_NAME}"
|
|
|
|
paths:
|
|
|
|
- front/dist/
|
|
|
|
only:
|
2018-04-22 12:06:13 +00:00
|
|
|
- tags@funkwhale/funkwhale
|
|
|
|
- master@funkwhale/funkwhale
|
|
|
|
- develop@funkwhale/funkwhale
|
2019-01-16 10:56:58 +00:00
|
|
|
|
2017-06-25 17:13:46 +00:00
|
|
|
tags:
|
|
|
|
- docker
|
2017-06-25 14:45:33 +00:00
|
|
|
|
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
|
2018-06-24 21:42:38 +00:00
|
|
|
- apt-get update
|
|
|
|
- apt-get install -y graphviz
|
2017-06-25 17:05:31 +00:00
|
|
|
- pip install sphinx
|
2018-06-24 21:42:38 +00:00
|
|
|
script:
|
2018-04-26 16:12:08 +00:00
|
|
|
- ./build_docs.sh
|
2018-06-24 10:37:01 +00:00
|
|
|
cache:
|
|
|
|
key: "$CI_PROJECT_ID__sphinx"
|
|
|
|
paths:
|
|
|
|
- "$PIP_CACHE_DIR"
|
2017-06-25 17:05:31 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- public
|
|
|
|
only:
|
2018-12-19 09:21:27 +00:00
|
|
|
- master@funkwhale/funkwhale
|
2017-06-25 17:07:49 +00:00
|
|
|
tags:
|
|
|
|
- docker
|
2017-06-26 17:48:09 +00:00
|
|
|
|
2018-06-09 14:50:34 +00:00
|
|
|
docker_release:
|
2017-06-26 18:07:19 +00:00
|
|
|
stage: deploy
|
2019-01-11 09:01:06 +00:00
|
|
|
image: bash
|
2017-06-26 17:48:09 +00:00
|
|
|
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
|
2019-01-11 09:01:06 +00:00
|
|
|
- (if [ "$CI_COMMIT_REF_NAME" == "develop" ]; then ./scripts/set-api-build-metadata.sh $(echo $CI_COMMIT_SHA | cut -c 1-8); fi);
|
2017-06-26 17:48:09 +00:00
|
|
|
- cd api
|
|
|
|
script:
|
2017-06-26 20:04:55 +00:00
|
|
|
- docker build -t $IMAGE .
|
|
|
|
- docker push $IMAGE
|
2017-06-26 17:48:09 +00:00
|
|
|
only:
|
2018-04-22 12:06:13 +00:00
|
|
|
- develop@funkwhale/funkwhale
|
2018-06-09 14:50:34 +00:00
|
|
|
- tags@funkwhale/funkwhale
|
2017-06-26 20:04:55 +00:00
|
|
|
tags:
|
2018-06-09 14:50:34 +00:00
|
|
|
- docker-build
|
2017-06-26 20:04:55 +00:00
|
|
|
|
2019-01-16 10:56:58 +00:00
|
|
|
docker_all_in_one_release:
|
|
|
|
stage: deploy
|
|
|
|
image: bash
|
|
|
|
variables:
|
|
|
|
ALL_IN_ONE_REF: master
|
|
|
|
ALL_IN_ONE_ARTIFACT_URL: https://github.com/thetarkus/docker-funkwhale/archive/$ALL_IN_ONE_REF.zip
|
|
|
|
BUILD_PATH: all_in_one
|
|
|
|
before_script:
|
|
|
|
- docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
|
|
|
|
- (if [ "$CI_COMMIT_REF_NAME" == "develop" ]; then ./scripts/set-api-build-metadata.sh $(echo $CI_COMMIT_SHA | cut -c 1-8); fi);
|
|
|
|
script:
|
|
|
|
- wget $ALL_IN_ONE_ARTIFACT_URL -O all_in_one.zip
|
|
|
|
- unzip -o all_in_one.zip -d tmpdir
|
|
|
|
- mv tmpdir/docker-funkwhale-$ALL_IN_ONE_REF $BUILD_PATH && rmdir tmpdir
|
|
|
|
- cp -r api $BUILD_PATH/src/api
|
|
|
|
- cp -r front $BUILD_PATH/src/front
|
|
|
|
- cd $BUILD_PATH
|
|
|
|
- ./scripts/download-nginx-template.sh src/ $CI_COMMIT_REF_NAME
|
|
|
|
- docker build -t $ALL_IN_ONE_IMAGE .
|
|
|
|
- docker push $ALL_IN_ONE_IMAGE
|
|
|
|
only:
|
|
|
|
- develop@funkwhale/funkwhale
|
|
|
|
- tags@funkwhale/funkwhale
|
|
|
|
tags:
|
|
|
|
- docker-build
|
|
|
|
|
2017-07-17 20:01:02 +00:00
|
|
|
build_api:
|
|
|
|
# Simply publish a zip containing api/ directory
|
|
|
|
stage: deploy
|
2019-01-11 09:01:06 +00:00
|
|
|
image: bash
|
2017-07-17 20:01:02 +00:00
|
|
|
artifacts:
|
|
|
|
name: "api_${CI_COMMIT_REF_NAME}"
|
|
|
|
paths:
|
|
|
|
- api
|
2018-06-28 14:51:29 +00:00
|
|
|
script:
|
2019-01-11 09:01:06 +00:00
|
|
|
- (if [ "$CI_COMMIT_REF_NAME" == "develop" ]; then ./scripts/set-api-build-metadata.sh $(echo $CI_COMMIT_SHA | cut -c 1-8); fi);
|
2018-06-28 14:51:29 +00:00
|
|
|
- chmod -R 750 api
|
|
|
|
- echo Done!
|
2017-07-17 20:01:02 +00:00
|
|
|
only:
|
2018-04-22 12:06:13 +00:00
|
|
|
- tags@funkwhale/funkwhale
|
|
|
|
- master@funkwhale/funkwhale
|
|
|
|
- develop@funkwhale/funkwhale
|