-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from ucsf-education/gh_actions
CI integration
- Loading branch information
Showing
14 changed files
with
436 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: Moodle Plugin CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '33 2 * * 1' # weekly, on Monday morning | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
mariadb: | ||
image: mariadb:10 | ||
env: | ||
MYSQL_USER: 'root' | ||
MYSQL_ALLOW_EMPTY_PASSWORD: "true" | ||
MYSQL_CHARACTER_SET_SERVER: "utf8mb4" | ||
MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci" | ||
ports: | ||
- 3306:3306 | ||
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- php: '8.2' | ||
moodle-branch: 'main' | ||
database: 'mariadb' | ||
- php: '8.2' | ||
moodle-branch: 'MOODLE_403_STABLE' | ||
database: 'mariadb' | ||
- php: '8.1' | ||
moodle-branch: 'MOODLE_402_STABLE' | ||
database: 'mariadb' | ||
- php: '8.1' | ||
moodle-branch: 'MOODLE_401_STABLE' | ||
database: 'mariadb' | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
with: | ||
path: plugin | ||
|
||
- name: Setup PHP ${{ matrix.php }} | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: ${{ matrix.extensions }} | ||
ini-values: max_input_vars=5000 | ||
# If you are not using code coverage, keep "none". Otherwise, use "pcov" (Moodle 3.10 and up) or "xdebug". | ||
# If you try to use code coverage with "none", it will fallback to phpdbg (which has known problems). | ||
coverage: none | ||
|
||
- name: Initialise moodle-plugin-ci | ||
run: | | ||
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4 | ||
echo $(cd ci/bin; pwd) >> $GITHUB_PATH | ||
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH | ||
sudo locale-gen en_AU.UTF-8 | ||
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV | ||
- name: Install moodle-plugin-ci | ||
run: | | ||
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 | ||
env: | ||
DB: ${{ matrix.database }} | ||
MOODLE_BRANCH: ${{ matrix.moodle-branch }} | ||
|
||
- name: PHP Lint | ||
if: ${{ !cancelled() }} | ||
run: moodle-plugin-ci phplint | ||
|
||
- name: PHP Mess Detector | ||
continue-on-error: true # This step will show errors but will not fail | ||
if: ${{ !cancelled() }} | ||
run: moodle-plugin-ci phpmd | ||
|
||
- name: Moodle Code Checker | ||
if: ${{ !cancelled() }} | ||
run: moodle-plugin-ci phpcs --max-warnings 0 | ||
|
||
- name: Moodle PHPDoc Checker | ||
if: ${{ !cancelled() }} | ||
run: moodle-plugin-ci phpdoc --max-warnings 0 | ||
|
||
- name: Validating | ||
if: ${{ !cancelled() }} | ||
run: moodle-plugin-ci validate | ||
|
||
- name: Check upgrade savepoints | ||
if: ${{ !cancelled() }} | ||
run: moodle-plugin-ci savepoints | ||
|
||
- name: Mustache Lint | ||
if: ${{ !cancelled() }} | ||
run: moodle-plugin-ci mustache | ||
|
||
- name: Grunt | ||
if: ${{ !cancelled() }} | ||
run: moodle-plugin-ci grunt --max-lint-warnings 0 | ||
|
||
- name: PHPUnit tests | ||
if: ${{ !cancelled() }} | ||
run: moodle-plugin-ci phpunit --fail-on-warning | ||
|
||
- name: Behat features | ||
if: ${{ !cancelled() }} | ||
run: moodle-plugin-ci behat --profile chrome | ||
|
||
- name: Mark cancelled jobs as failed. | ||
if: ${{ cancelled() }} | ||
run: exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ruleset name="MoodleCore"> | ||
<rule ref="moodle-extra"/> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Privacy Subsystem implementation for qtype_knowledgecheck. | ||
* | ||
* @package qtype_knowledgecheck | ||
* @copyright (c) The Regents of the University of California | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace qtype_knowledgecheck\privacy; | ||
|
||
use core_privacy\local\metadata\collection; | ||
use core_privacy\local\metadata\provider as base_provider; | ||
use core_privacy\local\request\user_preference_provider; | ||
use core_privacy\local\request\writer; | ||
|
||
/** | ||
* Privacy Subsystem for qtype_knowledgecheck implementing user_preference_provider. | ||
* | ||
* @package qtype_knowledgecheck | ||
* @copyright (c) The Regents of the University of California | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class provider implements base_provider, user_preference_provider { | ||
|
||
|
||
/** | ||
* Returns meta-data about this system. | ||
* | ||
* @param collection $collection The initialised collection to add items to. | ||
* @return collection A listing of user data stored through this system. | ||
*/ | ||
public static function get_metadata(collection $collection): collection { | ||
$collection->add_user_preference('qtype_knowledgecheck_defaultmark', 'privacy:preference:defaultmark'); | ||
return $collection; | ||
} | ||
|
||
/** | ||
* Export all user preferences for the plugin. | ||
* | ||
* @param int $userid The userid of the user whose data is to be exported. | ||
*/ | ||
public static function export_user_preferences(int $userid) { | ||
$preference = get_user_preferences('qtype_knowledgecheck_defaultmark', null, $userid); | ||
if (null !== $preference) { | ||
$desc = get_string('privacy:preference:defaultmark', 'qtype_knowledgecheck'); | ||
writer::export_user_preference('qtype_knowledgecheck', 'defaultmark', $preference, $desc); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.