134 lines
3.3 KiB
YAML
134 lines
3.3 KiB
YAML
stages:
|
|
- static
|
|
- build
|
|
- test
|
|
- deploy
|
|
- trigger
|
|
static_js_css:
|
|
stage: static
|
|
image: node:11.13
|
|
script:
|
|
- npm ci
|
|
- node_modules/.bin/gulp
|
|
artifacts:
|
|
expire_in: 1 week
|
|
when: always
|
|
paths:
|
|
- db/static/lib
|
|
static:
|
|
stage: static
|
|
image: python:3
|
|
before_script:
|
|
- pip install tox~=3.8.0
|
|
script:
|
|
- tox -e "py3-flake8,isort,yapf,py3-pylint"
|
|
docs:
|
|
stage: build
|
|
image: python:3
|
|
before_script:
|
|
- pip install sphinx_rtd_theme
|
|
script:
|
|
- cd docs
|
|
- make html SPHINXOPTS="-W"
|
|
artifacts:
|
|
expire_in: 1 week
|
|
when: always
|
|
paths:
|
|
- docs/_build/html
|
|
build:
|
|
stage: build
|
|
image: python:3
|
|
before_script:
|
|
- pip install tox~=3.8.0
|
|
script:
|
|
- rm -rf dist
|
|
- tox -e py3-build
|
|
artifacts:
|
|
expire_in: 1 week
|
|
when: always
|
|
paths:
|
|
- dist
|
|
test:
|
|
stage: test
|
|
image: python:3
|
|
before_script:
|
|
- pip install tox~=3.8.0
|
|
script:
|
|
- tox -e deps,py3-pytest
|
|
docker:
|
|
stage: deploy
|
|
image: docker:18.09
|
|
services:
|
|
- docker:18.09-dind
|
|
before_script:
|
|
- apk --update add py-pip
|
|
- pip install docker-compose~=1.23.0
|
|
script:
|
|
- |
|
|
[ -z "$SATNOGS_DECODERS_VERSION" ] || sed -i 's/^\(satnogsdecoders\).*/\1=='"$SATNOGS_DECODERS_VERSION"'/' requirements.txt
|
|
- |
|
|
[ -z "$CI_REGISTRY_IMAGE" ] || {
|
|
CACHE_IMAGE="$CI_REGISTRY_IMAGE/satnogs-db:$CI_COMMIT_REF_NAME"
|
|
[ -z "$CI_COMMIT_TAG" ] || CACHE_IMAGE="$CI_REGISTRY_IMAGE/satnogs-db:latest"
|
|
export CACHE_IMAGE
|
|
}
|
|
- docker-compose -f docker-compose.yml -f docker-compose.cache.yml pull cache_image || true
|
|
- docker-compose -f docker-compose.yml -f docker-compose.cache.yml build --pull
|
|
- |
|
|
[ -z "$CI_REGISTRY_IMAGE" ] || {
|
|
docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
|
|
docker tag satnogs-db:latest $CI_REGISTRY_IMAGE/satnogs-db:$CI_COMMIT_REF_NAME
|
|
docker push $CI_REGISTRY_IMAGE/satnogs-db:$CI_COMMIT_REF_NAME
|
|
[ -z "$CI_COMMIT_TAG" ] || {
|
|
docker tag satnogs-db:latest $CI_REGISTRY_IMAGE/satnogs-db:latest
|
|
docker push $CI_REGISTRY_IMAGE/satnogs-db:latest
|
|
}
|
|
}
|
|
[ -z "$DOCKERHUB_PASSWORD" ] || {
|
|
docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD
|
|
docker tag satnogs-db:latest librespace/satnogs-db:$CI_COMMIT_REF_NAME
|
|
docker push librespace/satnogs-db:$CI_COMMIT_REF_NAME
|
|
[ -z "$CI_COMMIT_TAG" ] || {
|
|
docker tag satnogs-db:latest librespace/satnogs-db:latest
|
|
docker push librespace/satnogs-db:latest
|
|
}
|
|
}
|
|
only:
|
|
refs:
|
|
- master
|
|
- tags
|
|
trigger_master:
|
|
stage: trigger
|
|
image: alpine:3.9
|
|
before_script:
|
|
- apk add --no-cache curl
|
|
script:
|
|
- for trigger in $PIPELINE_TRIGGERS_MASTER; do curl -X POST "$trigger"; done
|
|
only:
|
|
refs:
|
|
- master
|
|
variables:
|
|
- $PIPELINE_TRIGGERS_MASTER
|
|
trigger_latest:
|
|
stage: trigger
|
|
image: alpine:3.9
|
|
before_script:
|
|
- apk add --no-cache curl
|
|
script:
|
|
- for trigger in $PIPELINE_TRIGGERS_LATEST; do curl -X POST "$trigger"; done
|
|
only:
|
|
refs:
|
|
- tags
|
|
variables:
|
|
- $PIPELINE_TRIGGERS_LATEST
|
|
pages:
|
|
stage: deploy
|
|
image: alpine
|
|
script:
|
|
- mv docs/_build/html/ public/
|
|
artifacts:
|
|
paths:
|
|
- public
|
|
only:
|
|
- tags
|