Skip to content

Commit

Permalink
Merge branch 'moodle-release'
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentcornelis committed Dec 15, 2021
2 parents f3ecf03 + b26a898 commit e0fe021
Show file tree
Hide file tree
Showing 23 changed files with 213 additions and 66 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Moodle Plugin CI

on: [ push, pull_request ]

jobs:
test:
runs-on: ubuntu-18.04

services:
postgres:
image: postgres:10
env:
POSTGRES_USER: 'postgres'
POSTGRES_HOST_AUTH_METHOD: 'trust'
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
mariadb:
image: mariadb:10.5
env:
MYSQL_USER: 'root'
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3

strategy:
fail-fast: false
matrix:
include:
- php: '7.4'
moodle-branch: 'MOODLE_311_STABLE'
database: pgsql
- php: '7.4'
moodle-branch: 'MOODLE_310_STABLE'
database: mariadb
- php: '7.3'
moodle-branch: 'MOODLE_39_STABLE'
database: pgsql

steps:
- name: Check out repository code
uses: actions/checkout@v2
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
coverage: none

- name: Initialise moodle-plugin-ci
run: |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
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: ${{ always() }}
run: moodle-plugin-ci phplint

- name: PHP Copy/Paste Detector
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
run: moodle-plugin-ci phpcpd

- name: PHP Mess Detector
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
run: moodle-plugin-ci phpmd

- name: Moodle Code Checker
if: ${{ always() }}
run: moodle-plugin-ci codechecker --max-warnings 0

- name: Moodle PHPDoc Checker
if: ${{ always() }}
run: moodle-plugin-ci phpdoc

- name: Validating
if: ${{ always() }}
run: moodle-plugin-ci validate

- name: Check upgrade savepoints
if: ${{ always() }}
run: moodle-plugin-ci savepoints

- name: Mustache Lint
if: ${{ always() }}
run: moodle-plugin-ci mustache

- name: Grunt
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
run: moodle-plugin-ci grunt --max-lint-warnings 0

- name: PHPUnit tests
if: ${{ always() }}
run: moodle-plugin-ci phpunit

- name: Core privacy tests
if: ${{ always() }}
run: |
cd moodle
php admin/tool/phpunit/cli/init.php
vendor/bin/phpunit --fail-on-risky --disallow-test-output -v --filter tool_dataprivacy_metadata_registry_testcase
vendor/bin/phpunit --fail-on-risky --disallow-test-output -v --filter provider_testcase
- name: Behat features
if: ${{ always() }}
run: moodle-plugin-ci behat --profile chrome
66 changes: 66 additions & 0 deletions .github/workflows/moodle-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#
# Whenever a new tag is pushed, add the tagged version
# to the Moodle Plugins directory at https://moodle.org/plugins
#
# revision: 2021070201
#
name: Releasing in the Plugins directory

on:
push:
tags:
- '*'

workflow_dispatch:
inputs:
tag:
description: 'Tag to be released'
required: true

defaults:
run:
shell: bash

jobs:
release-at-moodle-org:
runs-on: ubuntu-latest
env:
PLUGIN: block_mfavatar
CURL: curl -s
ENDPOINT: https://moodle.org/webservice/rest/server.php
TOKEN: ${{ secrets.MOODLE_ORG_TOKEN }}
FUNCTION: local_plugins_add_version

steps:
- name: Call the service function
id: add-version
run: |
if [[ ! -z "${{ github.event.inputs.tag }}" ]]; then
TAGNAME="${{ github.event.inputs.tag }}"
elif [[ $GITHUB_REF = refs/tags/* ]]; then
TAGNAME="${GITHUB_REF##*/}"
fi
if [[ -z "${TAGNAME}" ]]; then
echo "No tag name has been provided!"
exit 1
fi
ZIPURL="https://api.github.com/repos/${{ github.repository }}/zipball/${TAGNAME}"
RESPONSE=$(${CURL} ${ENDPOINT} --data-urlencode "wstoken=${TOKEN}" \
--data-urlencode "wsfunction=${FUNCTION}" \
--data-urlencode "moodlewsrestformat=json" \
--data-urlencode "frankenstyle=${PLUGIN}" \
--data-urlencode "zipurl=${ZIPURL}" \
--data-urlencode "vcssystem=git" \
--data-urlencode "vcsrepositoryurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" \
--data-urlencode "vcstag=${TAGNAME}" \
--data-urlencode "changelogurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commits/${TAGNAME}" \
--data-urlencode "altdownloadurl=${ZIPURL}")
echo "::set-output name=response::${RESPONSE}"
- name: Evaluate the response
id: evaluate-response
env:
RESPONSE: ${{ steps.add-version.outputs.response }}
run: |
jq <<< ${RESPONSE}
jq --exit-status ".id" <<< ${RESPONSE} > /dev/null
50 changes: 0 additions & 50 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@
@unlink($tempfile);
}

echo json_encode($array);
echo json_encode($array);
1 change: 1 addition & 0 deletions block_mfavatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,4 @@ public function get_content() {
return $this->content;
}
}

6 changes: 3 additions & 3 deletions classes/avatargenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class avatargenerator {
* @var array
*/
protected $config = [
// Supported: "gd", "imagick".
// Supported: "gd" / "imagick".
'driver' => 'gd',

// Initial generator class.
Expand Down Expand Up @@ -177,7 +177,7 @@ public function set_avatar_for_all_users($parts = 'fullname') {
/**
* Get new avatar object.
*
* @param $string
* @param string $string
*
* @return Avatar
*/
Expand Down Expand Up @@ -213,4 +213,4 @@ protected function save(stdClass $user, Avatar $avatar) {
@unlink($tempfile);
}

}
}
1 change: 1 addition & 0 deletions classes/observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ public static function user_updated(\core\event\user_updated $event) : void {
$avatargenerator->set_avatar_single_user($user);
}
}

2 changes: 1 addition & 1 deletion classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ class provider implements \core_privacy\local\metadata\null_provider {
public static function get_reason() : string {
return 'privacy:null_reason';
}
}
}
2 changes: 1 addition & 1 deletion classes/task/update_avatars.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ public function execute() {

return true;
}
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"laravolt/avatar": "^2.0",
"danielstjules/stringy": "~3.1.0"
}
}
}
1 change: 1 addition & 0 deletions composer.lock

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

2 changes: 1 addition & 1 deletion db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
],
'clonepermissionsfrom' => 'moodle/my:manageblocks',
],
];
];
2 changes: 1 addition & 1 deletion db/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
'internal' => false, // This means that we get events only after transaction commit.
'priority' => 1000,
],
];
];
2 changes: 1 addition & 1 deletion db/tasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
'month' => '*',
'dayofweek' => '*',
],
];
];
1 change: 1 addition & 0 deletions lang/en/block_mfavatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@
$string['avatar_initials_forced_desc'] = 'If this is turned on the user pictures will overridden.';
$string['task:update_avatars'] = 'Update user avatars';
$string['returntoprofile'] = 'Return to your profile';

1 change: 1 addition & 0 deletions lang/nl/block_mfavatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@
$string['failed:permission_editownprofile'] = 'Fout: gebruikers kunnen hun afbeelding niet zelf bewerken.';
$string['privacy:null_reason'] = 'Er worden geen gegevens opgeslagen door deze plugin.';
$string['returntoprofile'] = 'Keer terug naar je profiel';

1 change: 1 addition & 0 deletions module.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,4 @@ M.block_mfavatar = {
M.block_mfavatar.log(err);
}
};

1 change: 1 addition & 0 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,4 @@ public function snapshot_tool() : string {
}

}

2 changes: 1 addition & 1 deletion settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@
$settings->add(new admin_setting_configcheckbox('block_mfavatar/avatar_initials_forced',
get_string('avatar_initials_forced', 'block_mfavatar'),
get_string('avatar_initials_forced_desc', 'block_mfavatar'), 0));
}
}
1 change: 1 addition & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@
.clearboth {
clear: both;
}

2 changes: 1 addition & 1 deletion thirdpartylibs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
<license>MIT</license>
<licenseversion></licenseversion>
</library>
</libraries>
</libraries>
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
**/

defined('MOODLE_INTERNAL') || die;
$plugin->release = '3.10.0';
$plugin->release = '3.11.0';
$plugin->maturity = MATURITY_STABLE;
$plugin->version = 2020111800; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2021121500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2018051700; // Requires this Moodle 3.5 version.
$plugin->component = 'block_mfavatar'; // Full name of the plugin (used for diagnostics).
4 changes: 2 additions & 2 deletions view/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
echo $OUTPUT->header();

if ($CFG->disableuserimages) {
print_error("disableuserimages", 'block_mfavatar');
throw new moodle_exception('disableuserimages', 'block_mfavatar');
}

echo $renderer->snapshot_tool();
echo $OUTPUT->footer();
echo $OUTPUT->footer();

0 comments on commit e0fe021

Please sign in to comment.