Skip to content

Commit

Permalink
Merge pull request #85 from kabalin/cineutral
Browse files Browse the repository at this point in the history
Promote CI tool neutrality.
  • Loading branch information
kabalin authored Feb 8, 2021
2 parents 9ed20e3 + c74ce42 commit d1a2c1e
Show file tree
Hide file tree
Showing 52 changed files with 114 additions and 114 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ jobs:
- name: Initialise moodle-plugin-ci
run: |
make init
cp -R tests/Fixture/moodle-local_travis ../moodle-local_travis
cp -R tests/Fixture/moodle-local_ci ../moodle-local_ci
echo $(cd bin; pwd) >> $GITHUB_PATH
echo $(cd vendor/bin; pwd) >> $GITHUB_PATH
echo "TRAVIS_BUILD_DIR="$(cd ../moodle-local_travis; pwd) >> $GITHUB_ENV
echo "TRAVIS_BUILD_DIR="$(cd ../moodle-local_ci; pwd) >> $GITHUB_ENV
# PHPUnit depends on en_AU.UTF-8 locale
sudo locale-gen en_AU.UTF-8
# Define NVM_DIR pointing to nvm installation.
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ before_install:
- phpenv config-rm xdebug.ini
- make init
# Mimic how a Moodle plugin would be run.
- cp -R tests/Fixture/moodle-local_travis ../moodle-local_travis
- cp -R tests/Fixture/moodle-local_ci ../moodle-local_ci
- export PATH="$(cd bin; pwd):$(cd vendor/bin; pwd):$PATH"
- export TRAVIS_BUILD_DIR=$(cd ../moodle-local_travis; pwd)
- export TRAVIS_BUILD_DIR=$(cd ../moodle-local_ci; pwd)

install:
- moodle-plugin-ci install -vvv
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![License](https://poser.pugx.org/moodlehq/moodle-plugin-ci/license)](//packagist.org/packages/moodlehq/moodle-plugin-ci)

The goal of this project is to facilitate the running of tests and code
analysis against a Moodle plugin in CI tools, such as [Travis
analysis against a Moodle plugin using CI environments, such as [Travis
CI](https://travis-ci.com) or [GitHub
Actions](https://docs.github.com/en/actions). All of these tests and tools
are run everytime a change is pushed to a GitHub branch or pull request.
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "moodlehq/moodle-plugin-ci",
"description": "Assists with running Moodle plugins in Travis CI",
"keywords": ["moodle", "travis", "ci", "testing"],
"description": "Helps running Moodle plugins analysis checks and tests under various CI environments.",
"keywords": ["moodle", "travis", "ci", "testing", "github", "actions"],
"type": "project",
"license": "GPL-3.0-or-later",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
title: Moodle Plugin CI
description: Moodle plugin + Travis CI
description: Moodle plugin test in CI environment
github_username: moodlehq
theme: minima
header_pages:
Expand Down
6 changes: 3 additions & 3 deletions tests/Bridge/MoodlePluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class MoodlePluginTest extends MoodleTestCase
public function testGetComponent()
{
$plugin = new MoodlePlugin($this->pluginDir);
$this->assertSame('local_travis', $plugin->getComponent());
$this->assertSame('local_ci', $plugin->getComponent());
}

public function testGetDependencies()
Expand Down Expand Up @@ -108,7 +108,7 @@ public function testGetFiles()
$this->pluginDir.'/classes/math.php',
$this->pluginDir.'/db/access.php',
$this->pluginDir.'/db/upgrade.php',
$this->pluginDir.'/lang/en/local_travis.php',
$this->pluginDir.'/lang/en/local_ci.php',
$this->pluginDir.'/lib.php',
$this->pluginDir.'/tests/lib_test.php',
$this->pluginDir.'/version.php',
Expand All @@ -134,7 +134,7 @@ public function testGetRelativeFiles()
'classes/math.php',
'db/access.php',
'db/upgrade.php',
'lang/en/local_travis.php',
'lang/en/local_ci.php',
'lib.php',
'tests/lib_test.php',
'version.php',
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/CopyPasteDetectorCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CopyPasteDetectorCommandTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
$this->pluginDir = __DIR__.'/../Fixture/moodle-local_travis';
$this->pluginDir = __DIR__.'/../Fixture/moodle-local_ci';
}

protected function executeCommand($pluginDir = null)
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/MessDetectorCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MessDetectorCommandTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
$this->pluginDir = __DIR__.'/../Fixture/moodle-local_travis';
$this->pluginDir = __DIR__.'/../Fixture/moodle-local_ci';
}

protected function executeCommand($pluginDir = null)
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/PHPLintCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PHPLintCommandTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
$this->pluginDir = __DIR__.'/../Fixture/moodle-local_travis';
$this->pluginDir = __DIR__.'/../Fixture/moodle-local_ci';
}

protected function executeCommand($pluginDir = null)
Expand Down
2 changes: 1 addition & 1 deletion tests/Fake/Bridge/DummyMoodlePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@

class DummyMoodlePlugin extends MoodlePlugin
{
public $component = 'local_travis';
public $component = 'local_ci';
public $dependencies = ['mod_forum'];
}
4 changes: 2 additions & 2 deletions tests/Fixture/bad-install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="local_travis_config" COMMENT="This is a config table.">
<TABLE NAME="local_ci_config" COMMENT="This is a config table.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
Expand All @@ -26,7 +26,7 @@
<KEY NAME="name" TYPE="unique" FIELDS="name"/>
</KEYS>
</TABLE>
<TABLE NAME="local_travis_config2" COMMENT="This is a config table.">
<TABLE NAME="local_ci_config2" COMMENT="This is a config table.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
Expand Down
6 changes: 3 additions & 3 deletions tests/Fixture/broken-upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
/**
* Plugin upgrade file
*
* @package local_travis
* @package local_ci
* @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

/**
* Execute local_travis upgrade from the given old version.
* Execute local_ci upgrade from the given old version.
*
* @param int $oldversion
* @return bool
*/
function xmldb_local_travis_upgrade($oldversion) {
function xmldb_local_ci_upgrade($oldversion) {
if ($oldversion < 2011033101) {
upgrade_plugin_savepoint(true, 2011033102, 'local', 'travis');
}
Expand Down
3 changes: 3 additions & 0 deletions tests/Fixture/moodle-local_ci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This is a plugin to help test CI build and test process.

Note: the behat.feature file is a copy of Moodle's auth/tests/behat/login.feature
2 changes: 2 additions & 0 deletions tests/Fixture/moodle-local_ci/amd/build/keys.min.js

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
/**
* This is copied from mod/lti.
*
* @module local_travis/keys
* @module local_ci/keys
* @class keys
* @package local_travis
* @package local_ci
* @copyright 2015 Ryan Wyllie <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since 3.1
*/
define([], function ()
{
return /** @alias module:local_travis/keys */ {
return /** @alias module:local_ci/keys */ {
ENTER: 13,
SPACE: 32
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
/**
* Math class.
*
* @package local_travis
* @package local_ci
* @copyright Copyright (c) 2015 Blackboard Inc. (http://www.blackboard.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace local_travis;
namespace local_ci;

defined('MOODLE_INTERNAL') || die();

/**
* Math class.
*
* @package local_travis
* @package local_ci
* @copyright Copyright (c) 2015 Blackboard Inc. (http://www.blackboard.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Plugin capabilities
*
* @package local_travis
* @package local_ci
* @copyright Copyright (c) 2015 Blackboard Inc. (http://www.blackboard.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="local/travis/db" VERSION="2015071000" COMMENT="XMLDB file for Moodle local/travis"
<XMLDB PATH="local/ci/db" VERSION="2015071000" COMMENT="XMLDB file for Moodle local/ci"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="local_travis_config" COMMENT="This is a config table.">
<TABLE NAME="local_ci_config" COMMENT="This is a config table.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
Expand All @@ -16,4 +16,4 @@
</KEYS>
</TABLE>
</TABLES>
</XMLDB>
</XMLDB>
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
/**
* Plugin upgrade file
*
* @package local_travis
* @package local_ci
* @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

/**
* Execute local_travis upgrade from the given old version.
* Execute local_ci upgrade from the given old version.
*
* @param int $oldversion
* @return bool
*/
function xmldb_local_travis_upgrade($oldversion) {
function xmldb_local_ci_upgrade($oldversion) {
if ($oldversion < 2011033101) {
upgrade_plugin_savepoint(true, 2011033101, 'local', 'travis');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Language definitions.
*
* @package local_travis
* @package local_ci
* @copyright Copyright (c) 2015 Blackboard Inc. (http://www.blackboard.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Just to give analysis tools something to work on.
*
* @package local_travis
* @package local_ci
* @copyright Copyright (c) 2015 Blackboard Inc. (http://www.blackboard.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -31,7 +31,7 @@
* @param int $b A integer
* @return int
*/
function local_travis_add($a, $b) {
function local_ci_add($a, $b) {
// Let's add them.
return $a + $b;
}
Expand All @@ -43,19 +43,19 @@ function local_travis_add($a, $b) {
* @param int $b A integer
* @return int
*/
function local_travis_subtract($a, $b) {
function local_ci_subtract($a, $b) {
// Let's subtract them.
return $a - $b;
}

/**
* Math class.
*
* @package local_travis
* @package local_ci
* @copyright Copyright (c) 2015 Blackboard Inc. (http://www.blackboard.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class local_travis_math {
class local_ci_math {
/**
* Add
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Example CSS file. */
.local_travis .widget {
.local_ci .widget {
padding: 5px;
color: #060;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@local @local_travis
@local @local_ci
Feature: Testing feature from auth login

Scenario: Log in with the predefined admin user with Javascript disabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
/**
* Simple test to see if PHPUnit is running
*
* @package local_travis
* @package local_ci
* @copyright Copyright (c) 2015 Blackboard Inc. (http://www.blackboard.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

use local_travis\math;
use local_ci\math;

defined('MOODLE_INTERNAL') || die();

Expand All @@ -31,34 +31,34 @@
/**
* The test
*
* @package local_travis
* @package local_ci
* @copyright Copyright (c) 2015 Blackboard Inc. (http://www.blackboard.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class local_travis_lib_testcase extends basic_testcase {
class local_ci_lib_testcase extends basic_testcase {
/**
* Test addition.
*/
public function test_local_travis_add() {
$this->assertEquals(4, local_travis_add(2, 2));
$this->assertEquals(2, local_travis_add(4, -2));
$this->assertEquals(0, local_travis_add(-4, 4));
public function test_local_ci_add() {
$this->assertEquals(4, local_ci_add(2, 2));
$this->assertEquals(2, local_ci_add(4, -2));
$this->assertEquals(0, local_ci_add(-4, 4));
}

/**
* Test subtraction.
*/
public function test_local_travis_subtract() {
$this->assertEquals(0, local_travis_subtract(2, 2));
$this->assertEquals(6, local_travis_subtract(4, -2));
$this->assertEquals(-8, local_travis_subtract(-4, 4));
public function test_local_ci_subtract() {
$this->assertEquals(0, local_ci_subtract(2, 2));
$this->assertEquals(6, local_ci_subtract(4, -2));
$this->assertEquals(-8, local_ci_subtract(-4, 4));
}

/**
* Test math class.
*/
public function test_local_travis_math() {
$math = new local_travis_math();
public function test_local_ci_math() {
$math = new local_ci_math();
$this->assertEquals(4, $math->add(2, 2));
$this->assertEquals(2, $math->add(4, -2));
$this->assertEquals(0, $math->add(-4, 4));
Expand All @@ -67,7 +67,7 @@ public function test_local_travis_math() {
/**
* Test math class.
*/
public function test_local_travis_math_class() {
public function test_local_ci_math_class() {
$math = new math();
$this->assertEquals(4, $math->add(2, 2));
$this->assertEquals(2, $math->add(4, -2));
Expand Down
File renamed without changes.
Loading

0 comments on commit d1a2c1e

Please sign in to comment.