This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/.gitlab-ci.yml
2017-06-06 05:31:28 +02:00

145 lines
3 KiB
YAML

---
stages:
- docker-build
- unit-tests
- integration
- release
- deploy
variables:
FAILFASTCI_NAMESPACE: 'quay'
IMAGE: quay.io/quay/quay
PIP_CACHE_DIR: pip-cache
PIP: /venv/bin/pip
PYTEST: /venv/bin/py.test
TEST: "true"
PYTHONPATH: "."
# STAGE 1: container build
.docker: &docker
variables:
DOCKER_DRIVER: aufs
image: docker:git
before_script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io
services:
- docker:dind
tags:
- docker
container-base-build:
<<: *docker
stage: docker-build
script:
- docker build --cache-from quay.io/quay/quay-base:latest -t quay.io/quay/quay-base:latest -f quay-base.dockerfile .
- docker push quay.io/quay/quay-base:latest
when: manual
container-build:
<<: *docker
stage: docker-build
script:
- docker build -t quay.io/quay/quay-ci:$CI_COMMIT_REF_SLUG -f quay.dockerfile .
- docker push quay.io/quay/quay-ci:$CI_COMMIT_REF_SLUG
# STAGE 2: Unit tests & code-style
.job: &job
variables:
GIT_STRATEGY: none
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
before_script:
- cd /
- source venv/bin/activate
tags:
- kubernetes
unit-tests:
<<: *job
stage: unit-tests
script:
- py.test --timeout=7200 --verbose --show-count ./ --color=no -x
registry-tests:
<<: *job
stage: unit-tests
script:
- py.test --timeout=7200 --verbose --show-count ./test/registry_tests.py --color=no -x
karma-tests:
<<: *job
stage: unit-tests
script:
- yarn test
code-styles:
<<: *job
stage: unit-tests
script:
- echo "yapf"
- echo "pycodestyle"
- echo "pylint"
# Stage 3: Integration/e2e tests
postgres:
<<: *job
variables:
TEST_DATABASE_URI: 'postgresql://quay:quay@localhost/quay'
SKIP_DB_SCHEMA: 'true'
POSTGRES_PASSWORD: quay
POSTGRES_USER: quay
GIT_STRATEGY: none
stage: integration
services:
- postgres:9.6
script:
- sleep 30
- alembic upgrade head
- PYTHONPATH="." TEST="true" py.test --timeout=7200 --verbose --show-count ./ --color=no --ignore=endpoints/appr/test/ -x
mysql:
<<: *job
variables:
TEST_DATABASE_URI: 'mysql+pymysql://quay:quay@localhost/quay'
SKIP_DB_SCHEMA: 'true'
MYSQL_ROOT_PASSWORD: quay
MYSQL_DATABASE: quay
MYSQL_USER: quay
MYSQL_PASSWORD: quay
GIT_STRATEGY: none
stage: integration
services:
- mysql
script:
- sleep 30
- alembic upgrade head
- PYTHONPATH="." TEST="true" py.test --timeout=7200 --verbose --show-count ./ --color=no --ignore=endpoints/appr/test/ -x
# e2e-demo:
# <<: *job
# image: python:2.7
# variables:
# TEST_DATABASE_URI: 'postgresql://quay:quay@localhost/quay'
# SKIP_DB_SCHEMA: 'true'
# POSTGRES_PASSWORD: quay
# POSTGRES_USER: quay
# GIT_STRATEGY: none
# stage: integration
# before_script:
# - cd /
# services:
# - postgres:9.6
# - quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
# script:
# - sleep 240
# - curl localhost:80/cnr/version
# allow_failure: true