Skip to content

Commit

Permalink
Add Github Actions config for CI and PHP syntax checking
Browse files Browse the repository at this point in the history
This adds continuous-integration configuration
for checking PHP syntax.

Refs: #817
  • Loading branch information
samwilson committed Jul 25, 2022
1 parent 5c0057a commit b1e03e7
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,31 @@
name: CI

on: [push, pull_request]

jobs:
build:

strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]

runs-on: ${{matrix.os}}

steps:
- name: Checkout
uses: actions/checkout@v1

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{matrix.php}}
extensions: fileinfo, json, pdo, mbstring

- name: Install
run: |
composer install
- name: Test
run: |
composer test
6 changes: 5 additions & 1 deletion .gitignore
Expand Up @@ -19,4 +19,8 @@

# Eclipse
.settings
.project
.project

# Composer
vendor/

19 changes: 19 additions & 0 deletions composer.json
@@ -0,0 +1,19 @@
{
"name": "piwigo/piwigo",
"description": "A full featured open source photo gallery for the web.",
"license": "GPL-2.0-only",
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.0"
},
"config": {
"platform": {
"php": "5.6"
}
},
"scripts": {
"test": [
"composer validate",
"parallel-lint . --exclude vendor/ --exclude include/random_compat/"
]
}
}
75 changes: 75 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions include/ws_protocols/xmlrpc_encoder.php
Expand Up @@ -6,6 +6,8 @@
// | file that was distributed with this source code. |
// +-----------------------------------------------------------------------+

if (!function_exists('xmlrpc_encode'))
{
function xmlrpc_encode($data)
{
switch (gettype($data))
Expand Down Expand Up @@ -44,6 +46,7 @@ function xmlrpc_encode($data)
return $return;
}
}
}

class PwgXmlRpcEncoder extends PwgResponseEncoder
{
Expand Down
3 changes: 2 additions & 1 deletion tools/test_piwigo.php
Expand Up @@ -261,7 +261,8 @@ function add_picture($option, $cookies, $pwg_token)
;';

$res = $mysqli->query($query);
if (($row = $res->fetch_row())[0] > 0) {
$row = $res->fetch_row();
if ($row[0] > 0) {
echo "Add a Picture OK!\n";
}
else {
Expand Down

0 comments on commit b1e03e7

Please sign in to comment.