1
0
Fork 0
satnogs-db/.gitlab-ci.yml

101 lines
2.4 KiB
YAML

stages:
- static
- build
- test
- deploy
- trigger
static_js_css:
stage: static
image: node
script:
- npm install -g eslint stylelint
- eslint 'db/static/js/*.js'
- stylelint 'db/static/css/*.css'
static_python:
stage: static
image: python:2.7
before_script:
- pip install tox
script:
- tox -e flake8
build:
stage: build
image: python:2.7
script:
- rm -rf dist
- python setup.py sdist bdist_wheel
artifacts:
expire_in: 1 week
when: always
paths:
- dist
build3:
stage: build
image: python:3.6
script:
- rm -rf dist
- python setup.py sdist bdist_wheel
artifacts:
expire_in: 1 week
when: always
paths:
- dist
test:
stage: test
image: python:2.7
before_script:
- pip install tox
script:
- tox -e deps,pytest
docker:
stage: deploy
image: docker:latest
services:
- docker:dind
before_script:
- apk --update add py-pip
- pip install docker-compose
script:
- CACHE_IMAGE="${CI_REGISTRY_IMAGE:+$CI_REGISTRY_IMAGE/satnogs-db:$CI_COMMIT_REF_NAME}"; 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 "$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
}
only:
refs:
- master
- dev
trigger_master:
stage: trigger
image: alpine
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_dev:
stage: trigger
image: alpine
before_script:
- apk add --no-cache curl
script:
- for trigger in $PIPELINE_TRIGGERS_DEV; do curl -X POST "$trigger"; done
only:
refs:
- dev
variables:
- $PIPELINE_TRIGGERS_DEV