-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: change Travis to use Docker #133
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,31 +16,28 @@ language: python | |
cache: | ||
- pip | ||
|
||
services: | ||
- mysql | ||
- postgresql | ||
|
||
addons: | ||
postgresql: "10" | ||
apt: | ||
packages: | ||
- postgresql-10 | ||
- postgresql-client-10 | ||
|
||
env: | ||
global: | ||
- DOCKER_COMPOSE_VERSION=1.26.2 | ||
matrix: | ||
- EXTRAS=sqlite REQUIREMENTS=lowest SQLALCHEMY_DATABASE_URI="sqlite:///test.db" | ||
- EXTRAS=mysql REQUIREMENTS=lowest SQLALCHEMY_DATABASE_URI="mysql+pymysql://travis@localhost:3306/invenio" | ||
- EXTRAS=postgresql REQUIREMENTS=lowest SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://postgres@localhost:5432/invenio" POSTGRESQL_VERSION="9.6" | ||
- EXTRAS=postgresql REQUIREMENTS=lowest SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://postgres@localhost:5432/invenio" POSTGRESQL_VERSION="10" | ||
- EXTRAS=mysql REQUIREMENTS=lowest DOCKER_SERVICE=mysql SQLALCHEMY_DATABASE_URI="mysql+pymysql://testuser:testpsw@localhost:3306/invenio" MYSQL_VERSION="5.7" | ||
- EXTRAS=postgresql REQUIREMENTS=lowest DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="9.6" | ||
- EXTRAS=postgresql REQUIREMENTS=lowest DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="10" | ||
- EXTRAS=postgresql REQUIREMENTS=lowest DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="11" | ||
- EXTRAS=postgresql REQUIREMENTS=lowest DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="12" | ||
- EXTRAS=sqlite REQUIREMENTS=release SQLALCHEMY_DATABASE_URI="sqlite:///test.db" | ||
- EXTRAS=mysql REQUIREMENTS=release SQLALCHEMY_DATABASE_URI="mysql+pymysql://travis@localhost:3306/invenio" | ||
- EXTRAS=postgresql REQUIREMENTS=release SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://postgres@localhost:5432/invenio" POSTGRESQL_VERSION="9.6" | ||
- EXTRAS=postgresql REQUIREMENTS=release SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://postgres@localhost:5432/invenio" POSTGRESQL_VERSION="10" | ||
- EXTRAS=mysql REQUIREMENTS=release DOCKER_SERVICE=mysql SQLALCHEMY_DATABASE_URI="mysql+pymysql://testuser:testpsw@localhost:3306/invenio" MYSQL_VERSION="5.7" | ||
- EXTRAS=postgresql REQUIREMENTS=release DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="9.6" | ||
- EXTRAS=postgresql REQUIREMENTS=release DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="10" | ||
- EXTRAS=postgresql REQUIREMENTS=release DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="11" | ||
- EXTRAS=postgresql REQUIREMENTS=release DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="12" | ||
- EXTRAS=sqlite REQUIREMENTS=devel SQLALCHEMY_DATABASE_URI="sqlite:///test.db" | ||
- EXTRAS=mysql REQUIREMENTS=devel SQLALCHEMY_DATABASE_URI="mysql+pymysql://travis@localhost:3306/invenio" | ||
- EXTRAS=postgresql REQUIREMENTS=devel SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://postgres@localhost:5432/invenio" POSTGRESQL_VERSION="9.6" | ||
- EXTRAS=postgresql REQUIREMENTS=devel SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://postgres@localhost:5432/invenio" POSTGRESQL_VERSION="10" | ||
- EXTRAS=mysql REQUIREMENTS=devel DOCKER_SERVICE=mysql SQLALCHEMY_DATABASE_URI="mysql+pymysql://testuser:testpsw@localhost:3306/invenio" MYSQL_VERSION="5.7" | ||
- EXTRAS=postgresql REQUIREMENTS=devel DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="9.6" | ||
- EXTRAS=postgresql REQUIREMENTS=devel DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="10" | ||
- EXTRAS=postgresql REQUIREMENTS=devel DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="11" | ||
- EXTRAS=postgresql REQUIREMENTS=devel DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="12" | ||
|
||
python: | ||
- "3.6" | ||
|
@@ -51,32 +48,42 @@ matrix: | |
fast_finish: true | ||
allow_failures: | ||
- env: EXTRAS=sqlite REQUIREMENTS=devel SQLALCHEMY_DATABASE_URI="sqlite:///test.db" | ||
- env: EXTRAS=mysql REQUIREMENTS=devel SQLALCHEMY_DATABASE_URI="mysql+pymysql://travis@localhost:3306/invenio" | ||
- env: EXTRAS=postgresql REQUIREMENTS=devel SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://postgres@localhost:5432/invenio" POSTGRESQL_VERSION="9.6" | ||
- env: EXTRAS=postgresql REQUIREMENTS=devel SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://postgres@localhost:5432/invenio" POSTGRESQL_VERSION="10" | ||
- env: EXTRAS=mysql REQUIREMENTS=devel DOCKER_SERVICE=mysql SQLALCHEMY_DATABASE_URI="mysql+pymysql://testuser:testpsw@localhost:3306/invenio" MYSQL_VERSION="5.7" | ||
- env: EXTRAS=postgresql REQUIREMENTS=devel DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="9.6" | ||
- env: EXTRAS=postgresql REQUIREMENTS=devel DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="10" | ||
- env: EXTRAS=postgresql REQUIREMENTS=devel DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="11" | ||
- env: EXTRAS=postgresql REQUIREMENTS=devel DOCKER_SERVICE=postgresql SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://testuser:testpsw@localhost:5432/invenio" POSTGRESQL_VERSION="12" | ||
- python: 3.8 | ||
|
||
before_install: | ||
# docker-compose setup | ||
- sudo rm /usr/local/bin/docker-compose | ||
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose | ||
- chmod +x docker-compose | ||
- sudo mv docker-compose /usr/local/bin | ||
# Python | ||
- "travis_retry pip install --upgrade pip setuptools py" | ||
- "travis_retry pip install twine wheel coveralls requirements-builder" | ||
- "requirements-builder -e docs,versioning,tests,$EXTRAS --level=min setup.py > .travis-lowest-requirements.txt" | ||
- "requirements-builder -e docs,versioning,tests,$EXTRAS --level=pypi setup.py > .travis-release-requirements.txt" | ||
- "requirements-builder -e docs,versioning,tests,$EXTRAS --level=dev --req requirements-devel.txt setup.py > .travis-devel-requirements.txt" | ||
- "psql --version" | ||
- if [$EXTRAS == "postgresql"]; then sudo systemctl stop postgresql; fi | ||
- if [$EXTRAS == "postgresql"]; then travis_setup_postgresql $POSTGRESQL_VERSION; fi | ||
- if [$EXTRAS == "postgresql"]; then sudo systemctl start postgresql@$POSTGRESQL_VERSION-main; fi | ||
- "mysql -e 'CREATE DATABASE IF NOT EXISTS invenio;' -uroot" | ||
- "psql -c 'CREATE DATABASE invenio;' -U postgres" | ||
|
||
install: | ||
- "travis_retry pip install -r .travis-${REQUIREMENTS}-requirements.txt" | ||
- "travis_retry pip install -e .[docs,versioning,tests,$EXTRAS]" | ||
- "psql --version" | ||
|
||
before_script: | ||
- "docker --version" | ||
- "docker-compose --version" | ||
- if [ -n "${DOCKER_SERVICE}" ]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not be needed: Which case triggers this if? I am not able to understand it. |
||
docker-compose -f docker-services.yml up -d "${DOCKER_SERVICE}"; fi | ||
|
||
script: | ||
- "./run-tests.sh" | ||
|
||
after_script: | ||
- docker-compose -f docker-services.yml down | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should not be needed either. Should use |
||
|
||
after_success: | ||
- coveralls | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file should not be needed. |
||
# | ||
# Copyright (C) 2020 CERN. | ||
# | ||
# Invenio is free software; you can redistribute it and/or modify it | ||
# under the terms of the MIT License; see LICENSE file for more details. | ||
|
||
version: "2.3" | ||
services: | ||
mysql: | ||
image: mysql:${MYSQL_VERSION} | ||
restart: "always" | ||
environment: | ||
- "MYSQL_ROOT_PASSWORD=testrootpsw" | ||
- "MYSQL_DATABASE=invenio" | ||
- "MYSQL_USER=testuser" | ||
- "MYSQL_PASSWORD=testpsw" | ||
ports: | ||
- "3306:3306" | ||
postgresql: | ||
image: postgres:${POSTGRESQL_VERSION} | ||
restart: "always" | ||
environment: | ||
- "POSTGRES_USER=testuser" | ||
- "POSTGRES_PASSWORD=testpsw" | ||
- "POSTGRES_DB=invenio" | ||
ports: | ||
- "5432:5432" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to avoid all the
DOCKER_SERVICE
andURIs
.