kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
147 wiersze
2.5 KiB
YAML
147 wiersze
2.5 KiB
YAML
variables:
|
|
IMAGE_NAME: funkwhale/funkwhale
|
|
IMAGE: $IMAGE_NAME:$CI_COMMIT_REF_NAME
|
|
IMAGE_LATEST: $IMAGE_NAME:latest
|
|
PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"
|
|
|
|
|
|
stages:
|
|
- test
|
|
- build
|
|
- deploy
|
|
|
|
test_api:
|
|
services:
|
|
- postgres:9.4
|
|
stage: test
|
|
image: funkwhale/funkwhale:latest
|
|
cache:
|
|
key: "$CI_PROJECT_ID/pip_cache"
|
|
paths:
|
|
- "$PIP_CACHE_DIR"
|
|
variables:
|
|
DJANGO_ALLOWED_HOSTS: "localhost"
|
|
DATABASE_URL: "postgresql://postgres@postgres/postgres"
|
|
|
|
before_script:
|
|
- cd api
|
|
- pip install -r requirements/base.txt
|
|
- pip install -r requirements/local.txt
|
|
- pip install -r requirements/test.txt
|
|
script:
|
|
- pytest
|
|
tags:
|
|
- docker
|
|
|
|
|
|
test_front:
|
|
stage: test
|
|
image: node:9
|
|
before_script:
|
|
- cd front
|
|
|
|
script:
|
|
- yarn install
|
|
- yarn run unit
|
|
cache:
|
|
key: "$CI_PROJECT_ID/front_dependencies"
|
|
paths:
|
|
- front/node_modules
|
|
- front/yarn.lock
|
|
artifacts:
|
|
name: "front_${CI_COMMIT_REF_NAME}"
|
|
paths:
|
|
- front/dist/
|
|
tags:
|
|
- docker
|
|
|
|
|
|
build_front:
|
|
stage: build
|
|
image: node:9
|
|
before_script:
|
|
- cd front
|
|
|
|
script:
|
|
- yarn install
|
|
- yarn run build
|
|
cache:
|
|
key: "$CI_PROJECT_ID/front_dependencies"
|
|
paths:
|
|
- front/node_modules
|
|
- front/yarn.lock
|
|
artifacts:
|
|
name: "front_${CI_COMMIT_REF_NAME}"
|
|
paths:
|
|
- front/dist/
|
|
only:
|
|
- tags
|
|
- master
|
|
- develop
|
|
tags:
|
|
- docker
|
|
|
|
|
|
pages:
|
|
stage: test
|
|
image: alpine
|
|
before_script:
|
|
- cd docs
|
|
script:
|
|
- apk --no-cache add py2-pip python-dev
|
|
- pip install sphinx
|
|
- apk --no-cache add make
|
|
- make html
|
|
- mv _build/html/ ../public
|
|
artifacts:
|
|
paths:
|
|
- public
|
|
only:
|
|
- develop
|
|
tags:
|
|
- docker
|
|
|
|
docker_develop:
|
|
stage: deploy
|
|
before_script:
|
|
- docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
|
|
- cp -r front/dist api/frontend
|
|
- cd api
|
|
script:
|
|
- docker build -t $IMAGE .
|
|
- docker push $IMAGE
|
|
only:
|
|
- develop
|
|
tags:
|
|
- dind
|
|
|
|
build_api:
|
|
# Simply publish a zip containing api/ directory
|
|
stage: deploy
|
|
image: busybox
|
|
artifacts:
|
|
name: "api_${CI_COMMIT_REF_NAME}"
|
|
paths:
|
|
- api
|
|
script: echo Done!
|
|
only:
|
|
- tags
|
|
- master
|
|
- develop
|
|
|
|
|
|
docker_release:
|
|
stage: deploy
|
|
before_script:
|
|
- docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
|
|
- cp -r front/dist api/frontend
|
|
- cd api
|
|
script:
|
|
- docker build -t $IMAGE -t $IMAGE_LATEST .
|
|
- docker push $IMAGE
|
|
- docker push $IMAGE_LATEST
|
|
only:
|
|
- tags
|
|
tags:
|
|
- dind
|