Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub actions for syntax checks #16

Merged
merged 1 commit into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/standard_bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Bug report
about: Standard SMF Bug report

---

#### Description
--Description Here--

### Steps to reproduce
1.
2.

### Environment (complete as necessary)
- Version/Git revision:
- Database Type:
- Database Version:
- PHP Version:


### Additional information/references
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/standard_pr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Pull Request
about: Standard SMF Pull Request

---

#### Description
--PR Summary here--

### Issues References (Fixes|Related|Closes)
1.
2.
67 changes: 67 additions & 0 deletions .github/check-php-syntax.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

/**
* Simple Machines Forum (SMF)
*
* @package SMF
* @author Simple Machines https://www.simplemachines.org
* @copyright 2020 Simple Machines and individual contributors
* @license https://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.1 RC3
*/

// Stuff we will ignore.
$ignoreFiles = array(
);

/* This is mostly meant for local usage.
To add additional PHP Binaries, create a check-php-syntax-binaries.txt
Add in this in each line the binary file, i.e: /usr/bin/php
*/
$addditionalPHPBinaries = array();
if (file_exists(dirname(__FILE__) . '/check-php-syntax-binaries.txt'))
$addditionalPHPBinaries = file(dirname(__FILE__) . '/check-php-syntax-binaries.txt');

$curDir = '.';
if (isset($_SERVER['argv'], $_SERVER['argv'][1]))
$curDir = $_SERVER['argv'][1];

$foundBad = false;
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($curDir, FilesystemIterator::UNIX_PATHS)) as $currentFile => $fileInfo)
{
// Only check PHP
if ($fileInfo->getExtension() !== 'php')
continue;

foreach ($ignoreFiles as $if)
if (preg_match('~' . $if . '~i', $currentFile))
continue 2;

# Always check against the base.
$result = trim(shell_exec('php -l ' . $currentFile));

if (!preg_match('~No syntax errors detected in ' . $currentFile . '~', $result))
{
$foundBad = true;
fwrite(STDERR, 'PHP via $PATH: ' . $result . "\n");
continue;
}

// We have additional binaries we want to test against?
foreach ($addditionalPHPBinaries as $binary)
{
$binary = trim($binary);
$result = trim(shell_exec($binary . ' -l ' . $currentFile));

if (!preg_match('~No syntax errors detected in ' . $currentFile . '~', $result))
{
$foundBad = true;
fwrite(STDERR, 'PHP via ' . $binary . ': ' . $result . "\n");
continue 2;
}
}
}

if (!empty($foundBad))
exit(1);
22 changes: 22 additions & 0 deletions .github/workflows/Syntax-Check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: PHP Syntax Check

on: [push, pull_request]

jobs:
syntax-checker:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ]
name: PHP ${{ matrix.php }} Syntax Check
steps:
- uses: actions/checkout@master
with:
submodules: true
- name: Setup PHP
id: SetupPHP
uses: nanasess/setup-php@master
with:
php-version: ${{ matrix.php }}
- run: php ./.github/check-php-syntax.php ./
17 changes: 17 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ForumSessionProvider License
============================
Copyright (c) 2020, Simple Machines
Copyright (c) 2019, SleePy
Copyright (c) 2019, Vekseid

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4 changes: 4 additions & 0 deletions ForumSsoProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ public static function onSpecialPageBeforeExecute($special, $subPage)
{
global $wgForumSessionProviderInstance;

// Ensure its callable.
if (!is_callable($wgForumSessionProviderInstance, 'doRedirect'))
return;

// The case of some of these isn't always consistent with what shows up in the url.
$special_action = strtolower($special->getName());

Expand Down
18 changes: 3 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ To use, the contents of the ForumSsoProvider directory need to be placed into ex
wfLoadExtension('ForumSsoProvider');

# Required LocalSettings
All settings should be defined prior to calling `wfLoadExtension('ForumSsoProvider');` in your LocalSettings.php
### Path to Forum Software

$wgSMFPath = '/path/to/smf/root/';
Expand Down Expand Up @@ -106,21 +107,8 @@ This bloats pretty quickly, so you'll want to comment it out after you have reso
----
Getting New SMF Forks In
------------------------
If you are familiar with how your fork's authentication works, feel free to submit a pull request.
If you are familiar with how your fork's authentication works, feel free to submit a pull request.

Issues or changes
------------------------
If an issue has occurred, please open a new issue. If you have a change, please submit a pull request.













If an issue has occurred, please open a new issue. If you have a change, please submit a pull request.