Skip to content
Permalink
Browse files

Adds Travis CI support (#78)

* Adds support for Travis CI
* Adds build status badge to readme
* Fixes original timestamp default value in schema dump
* Miscellaneous fixes

Fixes #10
  • Loading branch information...
corazzi authored and RocketMan committed Oct 23, 2019
1 parent 78d8640 commit 39f083d6a56165de35c5fd26591486998fe9ff61
Showing with 76 additions and 5 deletions.
  1. +3 −0 .gitignore
  2. +41 −0 .travis.yml
  3. +1 −0 README.md
  4. +25 −0 build/travis-ci-apache
  5. +1 −0 build/zookeeper.ini
  6. +2 −2 config/config.example.php
  7. +1 −1 db/zkdbSchema.sql
  8. +1 −1 ui/Home.php
  9. +1 −1 ui/Main.php
@@ -0,0 +1,3 @@
.idea/
.DS_Store
config/config.php
@@ -0,0 +1,41 @@
language: php

php:
- 5.6
- 7.2

services:
- mysql

before_install:
- mysql -e 'CREATE DATABASE zookeeper'

before_script:
# Install Apache
- sudo apt-get update
- sudo apt-get install apache2 libapache2-mod-fastcgi
# Enable php-fpm
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo a2enmod rewrite actions fastcgi alias
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
- sudo chown -R travis:travis /var/lib/apache2/fastcgi
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
# Configure Apache vhosts
- sudo cp -f build/travis-ci-apache /etc/apache2/sites-available/000-default.conf
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
- sudo service apache2 restart
# Set timezone
- phpenv config-add build/zookeeper.ini
# Copy configuration file
- cp config/config.example.php config/config.php
# Set up MySQL
- mysql -u root zookeeper < db/zkdbSchema.sql
- mysql -u root zookeeper < db/categories.sql
- mysql -u root zookeeper < db/chartemail.sql
- mysql -u root zookeeper < db/bootstrapUser.sql
# Set some $_SERVER vars used in Main.php
- export HTTP_ACCEPT="application/json"
- export HTTP_USER_AGENT="Travis CI"

script: php zk test action=test subaction=test
@@ -1,4 +1,5 @@
## Zookeeper Online
[![Build Status](https://travis-ci.org/rocketman/zookeeper.svg?branch=master)](https://travis-ci.org/rocketman/zookeeper)

Zookeeper Online is a music database and charting application for
college and independent radio.
@@ -0,0 +1,25 @@
<VirtualHost *:80>
# [...]

DocumentRoot %TRAVIS_BUILD_DIR%

<Directory "%TRAVIS_BUILD_DIR%/">
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
Require all granted
</Directory>

# Wire up Apache to use Travis CI's php-fpm.
<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization

<Directory /usr/lib/cgi-bin>
Require all granted
</Directory>
</IfModule>

# [...]
</VirtualHost>
@@ -0,0 +1 @@
date.timezone="Europe/London"
@@ -100,8 +100,8 @@
'db' => [
'driver' => 'mysql',
'host' => 'localhost',
'database' => '',
'user' => '',
'database' => 'zookeeper',
'user' => 'root',
'pass' => '',
],
@@ -364,7 +364,7 @@ CREATE TABLE IF NOT EXISTS `tracks` (
`track` varchar(80) DEFAULT NULL,
`album` varchar(80) DEFAULT NULL,
`label` varchar(80) DEFAULT NULL,
`created` timestamp DEFAULT NULL,
`created` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `list` (`list`),
KEY `tag` (`tag`),
@@ -50,7 +50,7 @@ private function emitTopPlays($numweeks=1, $limit=10) {
if($weeks && ($lastWeek = $weeks->fetch()))
list($y,$m,$d) = explode("-", $lastWeek["week"]);
if(!$y)
if(! isset($y) || !$y)
return; // No charts! bail.
if(!$numWeeks || $numWeeks == 1)
@@ -44,7 +44,7 @@ public function processRequest($dispatcher) {
$isJson = substr($_SERVER["HTTP_ACCEPT"], 0, 16) === 'application/json';
if ($isJson) {
$action = $_REQUEST["action"];
$subAction = $_REQUEST["subaction"];
$subaction = $_REQUEST["subaction"];
$dispatcher->dispatch($action, $subaction, $this->session);
} else {
$this->emitResponseHeader();

0 comments on commit 39f083d

Please sign in to comment.
You can’t perform that action at this time.