Skip to content

Commit

Permalink
Add new travis matrix and appveyor CI
Browse files Browse the repository at this point in the history
  • Loading branch information
philipbelesky committed Oct 28, 2017
1 parent 4759e45 commit 5b8ec2c
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 21 deletions.
75 changes: 59 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,77 @@
# Globals
language: python
dist: trusty
sudo: required
group: edge
python:
- "3.4"
- "3.5"
- "3.6"
env:
global:
- CC_TEST_REPORTER_ID=e93289b66782f99213fec69659f0428021cf8cd284c79637e07323f15fd29461
addons:
postgresql: "9.6"
# chrome: stable # Re-enable for functional tests
# chrome: stable # Re-enable for functional tests if/when they work on Travis
services:
- postgresql
# Build Specific
matrix:
include:
- os: osx
osx_image: xcode9.1 # OS X 10.12
language: generic # Override global
before_install: # Need to bootstrap dependencies on OS X
- brew update # Need to update ruby first else python3 fails
- brew install python3 # Install latest Python3
- virtualenv env -p python3
- source env/bin/activate
- brew upgrade node # Install latest Node
before_script:
- brew services start postgresql
# We are testing, in effect, the local install so use local settings:
- cp tabbycat/local_settings.example tabbycat/local_settings.py
script:
- npm run gulp build
- python tabbycat/manage.py collectstatic
# TODO: get working later; currently lacks a database connection
#- python tabbycat/manage.py test -v 2 --exclude-tag=selenium
- os: linux
python: 3.4
- os: linux
python: 3.5
- os: linux
python: 3.6
# Setup/run/report code coverage tool (Only one build needs to do so)
before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
script:
- pip install coverage
- flake8 tabbycat
- coverage run tabbycat/manage.py test -v 2 --exclude-tag=selenium
after_script:
- coverage xml
- if [[ "$TRAVIS_PULL_REQUEST" == "false"]]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
- os: linux # Test docker seperately (currently isn't supported on OS X)
language: generic
install:
- echo "Testing Docker" # Override default install steps
services:
- docker
script:
- docker-compose build
# TODO: get working later; currently lacks a database connection
# - docker-compose run web python tabbycat/manage.py test -v 2 --exclude-tag=selenium

install:
- pip install --upgrade pip
- pip install -r requirements_common.txt
- pip install -r requirements_development.txt
- pip install coverage
- pip install -r requirements_development.txt # Needed for flake8
- nvm install node # Update to latest node version
- nvm use node # Switch to latest
- npm install npm # Update to latest npm version
- npm install
before_script: # code coverage tool
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
script:
- flake8 tabbycat
- coverage run tabbycat/manage.py test -v 2 --exclude-tag=selenium
after_script:
- coverage xml
- if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
- python tabbycat/manage.py test -v 2 --exclude-tag=selenium

# The below is used to enable selenium testing as per:
# https://docs.travis-ci.com/user/gui-and-headless-browsers/
# Currently it runs and loads the view; but doesn't seem to resolve the asserts
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ FROM python:3.6
ENV PYTHONUNBUFFERED 1

# Setup Node/NPM
RUN apt-get update && apt-get install curl
RUN apt-get update
RUN apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash && apt-get install -y nodejs

# Copy all our files into the baseimage and cd to that directory
Expand Down
81 changes: 81 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#---------------------------------#
# general configuration #
#---------------------------------#

# version format
version: 1.0.{build}

# you can use {branch} name in version format too
# version: 1.0.{build}-{branch}

# Build worker image (VM template)
image: Visual Studio 2017

# Don't expect a standard VS build project etc
build: false

# Set python version to not be the default (2.7.X)
environment:
matrix:
- PYTHON: "C:\\Python36"
PYTHON_VERSION: "3.6.1"
PYTHON_ARCH: "32"
global:
POSTGRES_ENV_POSTGRES_USER: postgres
POSTGRES_ENV_POSTGRES_PASSWORD: postgres
PGUSER: postgres
PGPASSWORD: postgres
POSTGRES_PATH: C:\Program Files\PostgreSQL\9.6

# scripts that are called at very beginning, before repo cloning
# init:
# - git config --global core.autocrlf input

clone_folder: c:\projects\tabbycat

# environment variables
# environment:
# my_var1: value1

# enable service required for build/tests
services:
- postgresql # start PostgreSQL 9.5 service

init:
- ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%
- set PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%

# scripts that run after cloning repository
install:
# by default, all script lines are interpreted as batch
# - echo This is batch
# to run script as a PowerShell command prepend it with ps:
# - ps: Write-Host 'This is PowerShell'
- choco install docker-compose

# before_test:
# - psql -c "CREATE USER test WITH PASSWORD 'test';" -U postgres

test_script:
- cd c:\projects\tabbycat
- copy tabbycat\local_settings.example tabbycat\local_settings.py # Need to use local build opt
# Update local connection settings
- python -m pip install -U pip
- pip install -r requirements_common.txt
- npm install
# Test gulp building
- npm run gulp build
- python tabbycat/manage.py collectstatic
# Test Docker Building
# This fails at apt-get; apparently something to do with
# http://www.sovsystems.com/powercli-core-on-mac-or-linux-made-easy-with-help/
#- docker-compose build
#- docker-compose run web python tabbycat/manage.py runserver
# Currently disabled; database connection isuses
# - ps: SET PGUSER=postgres
# - ps: SET PGPASSWORD=postgres
# - ps: python tabbycat/manage.py test -v 2

# deploy_script:
# - docker login -u="$env:DOCKER_USER" -p="$env:DOCKER_PASS"
# - docker push me/myfavoriteapp
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# Can run management commands with
# $ docker-compose run web /code/manage.py whatever

version: '2.1'

version: '2'
services:
db:
image: postgres:9.6
Expand All @@ -36,6 +36,7 @@ services:
volumes:
- .:/tcd
- node_modules:/tcd/node_modules

volumes:
pgdata:
node_modules:
1 change: 1 addition & 0 deletions requirements_common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ django-gfklookupwidget==1.0.5 # Replaces object_id field with a search
munkres==1.0.12 # Algorithm for adjudicator allocation
dj-cmd==1.0 # Provides the dj command alias
raven==6.2.1 # Client for Sentry error tracking
selenium==3.6.0 # Functional testing (in here for CI tests)

# Database

Expand Down
1 change: 0 additions & 1 deletion requirements_development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ flake8==3.5.0 # For testing/linting
flake8-import-order==0.14.1 # Flake plugin for import order
flake8-quotes==0.12.0 # Flake plugin for quotes
pep8-naming==0.4.1 # Flake plugin for naming conventions
selenium==3.6.0 # Functional testing framework
chromedriver_installer==0.0.6 # Functional testing Chrome interface

# Documentation Dependencies
Expand Down
4 changes: 2 additions & 2 deletions tabbycat/local_settings.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ DATABASES = {
'ENGINE' : 'django.db.backends.postgresql_psycopg2',
'NAME' : 'postgres',
'USER' : 'postgres',
'PASSWORD': '',
'HOST': 'db',
'PASSWORD': 'postgres',
'HOST': 'localhost',
'PORT': '5432',
'CONN_MAX_AGE': 600,
}
Expand Down

0 comments on commit 5b8ec2c

Please sign in to comment.