From 64add3e78259b6b49d0dddfd2e8e909801619b44 Mon Sep 17 00:00:00 2001 From: Antoine Legrand <2t.antoine@gmail.com> Date: Tue, 2 May 2017 16:08:24 +0200 Subject: [PATCH] Add gitlab-ci --- .gitlab-ci.yml | 132 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..0b8336c30 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,132 @@ +--- +stages: + - 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: "." + +cache: + paths: + - cache + - /pip-cache + - /apt-cache + key: "$CI_PROJECT_ID" + + +.job: &job + before_script: + - mkdir -p /apt-cache + - apt-get update + - apt-get install -o dir::cache::archives="/apt-cache" -y python-dev g++ libjpeg62-dev libevent-dev libldap2-dev libsasl2-dev libpq-dev libffi-dev libgpgme11-dev nodejs jpegoptim optipng w3m + - pip install -r requirements.txt + - pip install -r requirements-tests.txt + script: + - echo test + tags: + - kubernetes + image: quay.io/quay/quay:build + + +unit-tests: + <<: *job + stage: unit-tests + script: + - py.test --timeout=7200 --verbose --show-count ./ --color=no + + +registry-tests: + <<: *job + stage: unit-tests + script: + - py.test --timeout=7200 --verbose --show-count ./test/registry_tests.py --color=no + + +karma-tests: + <<: *job + stage: unit-tests + script: + - yarn install --ignore-engines + - yarn test + +code-styles: + <<: *job + stage: unit-tests + script: + - echo "yapf" + - echo "pycodestyle" + - echo "pylint" + + +postgres: + <<: *job + variables: + TEST_DATABASE_URI: 'postgresql://quay:quay@localhost/quay' + SKIP_DB_SCHEMA: 'true' + POSTGRES_PASSWORD: quay + POSTGRES_USER: quay + stage: integration + services: + - postgres:9.6 + script: + - alembic upgrade head + - py.test --timeout=7200 --verbose --show-count ./ --color=no --ignore=endpoints/appr/test/ + + + +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 + stage: integration + services: + - mysql + script: + - alembic upgrade head + - py.test --timeout=7200 --verbose --show-count ./ --color=no --ignore=endpoints/appr/test/ + + +# # TODO (@ant31) +# .docker: &docker +# variables: +# DOCKER_HOST: tcp://localhost:2375 +# image: docker:git +# before_script: +# - docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io +# services: +# - docker:dind +# tags: +# - kubernetes + +# docker-push: +# <<: *docker +# stage: release +# script: +# - echo "push container to the quay prod repo" +# - docker build --no-cache -t quay.io/quay/quay-branches:$CI_BUILD_REF_NAME . +# - docker push quay.io/quay/quay-branches:$CI_BUILD_REF_NAME + +# helm-push: +# <<: *docker +# stage: release +# script: +# - echo "build chart" + +# deploy-staging: +# when: manual +# stage: deploy +# script: +# - echo "deploy-staging"