Skip to content

Instantly share code, notes, and snippets.

@phrfpeixoto
Last active October 17, 2019 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phrfpeixoto/59604bbeb4f01ba411addf5cc10e1c2a to your computer and use it in GitHub Desktop.
Save phrfpeixoto/59604bbeb4f01ba411addf5cc10e1c2a to your computer and use it in GitHub Desktop.
image: python:3.7
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
- venv/
variables:
MYSQL_ROOT_PASSWORD: "ooops"
MYSQL_DATABASE: "database"
MYSQL_USER: "testuser"
MYSQL_PASSWORD: "testpass"
services:
- name: mysql:latest
command: ["--default-authentication-plugin=mysql_native_password"]
before_script:
- apt-get update && apt-get -y install sed default-mysql-client
- python -V # Print out python version for debugging
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
test:
script:
- cp testing.ini.sample testing.ini
- sed -i 's/localhost:3306/mysql:3306/g' testing.ini
- mysql -h mysql -u root -p$MYSQL_ROOT_PASSWORD -e 'CREATE DATABASE another'
- mysql -h mysql -u root -p$MYSQL_ROOT_PASSWORD -e "GRANT ALL PRIVILEGES ON another.* TO testuser@'%'"
- pip install -e ".[testing]"
- pytest --cov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment