Skip to content

Commit

Permalink
Migrate CI to GitHub Actions (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketMan authored Jun 4, 2023
1 parent 8688be1 commit ede937f
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 92 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.4', '8.0', '8.2']

steps:
- name: Checkout source
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
ini-values: date.timezone="Europe/London"

- name: Setup Apache
uses: thunder/apache-shiva-php-action@v1
with:
php-version: ${{ matrix.php-versions }}
site-directory: $GITHUB_WORKSPACE
http-port: 8080

- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
composer-options: "--no-dev"

- name: Create configuration
run: |
cp config/config.example.php config/config.php
sed -i -e "s,'pass' => '','pass' => 'root',g" config/config.php
printf "[client]\nuser=root\npassword=root\n" > ~/.my.cnf
- name: Setup database
run: |
sudo systemctl start mysql.service
mysql -e 'CREATE DATABASE zookeeper'
mysql zookeeper < db/zkdbSchema.sql
mysql zookeeper < db/categories.sql
mysql zookeeper < db/chartemail.sql
mysql zookeeper < db/bootstrapUser.sql
- name: Validate
run: php zk validate url=http://127.0.0.1:8080/
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

3 changes: 0 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ The following is an overview of the source code directory structure:
api/
JSON:API implementation.

build/
files for continuous integration

config/
config.php
This is the main configuration file. It includes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Zookeeper Online
[![last commit](https://badgen.net/github/last-commit/RocketMan/zookeeper)](https://github.com/RocketMan/zookeeper/commits/master)
[![Build Status](https://travis-ci.com/RocketMan/zookeeper.svg?branch=master)](https://travis-ci.com/github/RocketMan/zookeeper)
[![Build Status](https://github.com/RocketMan/zookeeper/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/RocketMan/zookeeper/actions/workflows/main.yml)

[![license](https://badgen.net/github/license/RocketMan/zookeeper)](https://github.com/RocketMan/zookeeper/blob/master/LICENSE)
[![latest version](https://badgen.net/github/release/RocketMan/zookeeper?label=latest)](https://github.com/RocketMan/zookeeper/releases)
Expand Down
13 changes: 0 additions & 13 deletions build/php-fpm-redirect

This file was deleted.

25 changes: 0 additions & 25 deletions build/travis-ci-apache

This file was deleted.

1 change: 0 additions & 1 deletion build/zookeeper.ini

This file was deleted.

6 changes: 3 additions & 3 deletions engine/impl/Playlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -700,10 +700,10 @@ public function insertTrack($playlistId, $tag, $artist, $track, $album, $label,
$tagName = $haveTag ? ", tag" : "";
$tagValue = $haveTag ? ", ?" : "";

$names = "(list, artist, track, album, label, seq, created ${tagName})";
$values = "VALUES (?, ?, ?, ?, ?, ?, ? ${tagValue});";
$names = "(list, artist, track, album, label, seq, created {$tagName})";
$values = "VALUES (?, ?, ?, ?, ?, ?, ? {$tagValue});";

$query = "INSERT INTO tracks ${names} ${values}";
$query = "INSERT INTO tracks {$names} {$values}";
$stmt = $this->prepare($query);
$stmt->bindValue(1, (int)$playlistId, \PDO::PARAM_INT);
$stmt->bindValue(2, $artist);
Expand Down
6 changes: 3 additions & 3 deletions engine/impl/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function updateUser($user, $password, $realname="XXZZ", $groups="XXZZ", $
$comma = ",";
}
if($groups != "XXZZ") {
$query .= $comma." groups=?";
$query .= $comma." `groups`=?";
$comma = ",";
}
if($expiration != "XXZZ")
Expand All @@ -226,7 +226,7 @@ public function updateUser($user, $password, $realname="XXZZ", $groups="XXZZ", $

public function insertUser($user, $password, $realname, $groups, $expiration) {
$salt = substr(md5(uniqid(rand())), 0, 2);
$query = "INSERT INTO users (name, password, realname, groups, expires) VALUES (?, ?, ?, ?, ?)";
$query = "INSERT INTO users (name, password, realname, `groups`, expires) VALUES (?, ?, ?, ?, ?)";
$stmt = $this->prepare($query);
$stmt->bindValue(1, $user);
$stmt->bindValue(2, $salt.md5($salt.$password));
Expand Down Expand Up @@ -292,7 +292,7 @@ public function deleteAPIKeys($user, array $ids) {
}

public function lookupAPIKey($apikey) {
$query = "SELECT user, groups, realname FROM apikeys a ".
$query = "SELECT user, `groups`, realname FROM apikeys a ".
"LEFT JOIN users u ON a.user = u.name ".
"WHERE apikey=?";
$stmt = $this->prepare($query);
Expand Down

0 comments on commit ede937f

Please sign in to comment.