diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b22af4a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,117 @@ +name: Moodle plugin CI +on: [push, pull_request] + +jobs: + test: + runs-on: 'ubuntu-latest' + strategy: + fail-fast: false + matrix: + include: + - php: '7.4' + moodle-branch: 'master' + database: 'pgsql' + - php: '7.4' + moodle-branch: 'MOODLE_311_STABLE' + database: 'mariadb' + - php: '7.3' + moodle-branch: 'MOODLE_310_STABLE' + database: 'pgsql' + - php: '7.2' + moodle-branch: 'MOODLE_39_STABLE' + database: 'mariadb' + + services: + postgres: + image: postgres + env: + POSTGRES_USER: 'postgres' + POSTGRES_HOST_AUTH_METHOD: 'trust' + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 3 + ports: + - 5432:5432 + + mariadb: + image: mariadb + 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 + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + path: plugin + + - name: Install node + uses: actions/setup-node@v1 + with: + node-version: '14.15.0' + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring, pgsql, mysqli + + - name: Deploy moodle-plugin-ci + run: | + composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3 + # Add dirs to $PATH + echo $(cd ci/bin; pwd) >> $GITHUB_PATH + echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH + # PHPUnit depends on en_AU.UTF-8 locale + sudo locale-gen en_AU.UTF-8 + + - name: Install Moodle + run: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 + env: + DB: ${{ matrix.database }} + MOODLE_BRANCH: ${{ matrix.moodle-branch }} + + - name: phplint + if: ${{ always() }} + run: moodle-plugin-ci phplint + + - name: phpcpd + if: ${{ always() }} + run: moodle-plugin-ci phpcpd + + - name: phpmd + if: ${{ always() }} + run: moodle-plugin-ci phpmd + + - name: codechecker + if: ${{ always() }} + run: moodle-plugin-ci codechecker + + - name: validate + if: ${{ always() }} + run: moodle-plugin-ci validate + + - name: savepoints + if: ${{ always() }} + run: moodle-plugin-ci savepoints + + - name: mustache + if: ${{ always() }} + run: moodle-plugin-ci mustache + + - name: grunt + if: ${{ always() }} + run: moodle-plugin-ci grunt + + - name: phpunit + if: ${{ always() }} + run: moodle-plugin-ci phpunit + + - name: behat + if: ${{ always() }} + run: moodle-plugin-ci behat --profile chrome diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 03f36b4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,86 +0,0 @@ -language: php - -os: linux -dist: xenial - -services: - - mysql - - postgresql - -addons: - firefox: "47.0.1" - apt: - packages: - - openjdk-8-jre-headless - - chromium-chromedriver - -cache: - directories: - - $HOME/.composer/cache - - $HOME/.npm - -jobs: - include: - - php: 7.3 - env: - - MOODLE_BRANCH=master - - DB=pgsql - - - php: 7.4 - env: - - MOODLE_BRANCH=MOODLE_39_STABLE - - DB=mysqli - - - php: 7.3 - env: - - MOODLE_BRANCH=MOODLE_38_STABLE - - DB=pgsql - - CHECK_GRUNT=yes - - - php: 7.2 - env: - - MOODLE_BRANCH=MOODLE_37_STABLE - - DB=mysqli - - - php: 7.1 - env: - - MOODLE_BRANCH=MOODLE_36_STABLE - - DB=pgsql - - NODE=8.9 - - - php: 7.0 - env: - - MOODLE_BRANCH=MOODLE_35_STABLE - - DB=mysqli - -before_install: - - phpenv config-rm xdebug.ini - - - if [ -z $CHECK_GRUNT ]; then - export CHECK_GRUNT=no; - fi - - - if [ -z $NODE ]; then - export NODE=14; - fi - - nvm install $NODE - - nvm use $NODE - - - cd ../.. - - composer create-project -n --no-dev --prefer-dist moodlerooms/moodle-plugin-ci ci ^2 - - export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH" - -install: - - moodle-plugin-ci install - -script: - - moodle-plugin-ci phplint - - moodle-plugin-ci phpcpd - - moodle-plugin-ci phpmd || true # report issues, but don't fail the build. - - moodle-plugin-ci codechecker - - moodle-plugin-ci validate - - moodle-plugin-ci savepoints - - moodle-plugin-ci mustache || true # report issues, but don't fail the build. - - moodle-plugin-ci grunt || [ "$CHECK_GRUNT" = 'no' ] - - moodle-plugin-ci phpunit - - moodle-plugin-ci behat diff --git a/amd/build/reportcategories.min.js.map b/amd/build/reportcategories.min.js.map new file mode 100644 index 0000000..aa092f3 --- /dev/null +++ b/amd/build/reportcategories.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/reportcategories.js"],"names":["define","$","t","init","on","expandCollapse","expandCollapseAll","updateExpandCollapseAll","e","catwrapper","target","closest","length","hasClass","removeClass","addClass","preventDefault","link","text","data"],"mappings":"AA0BAA,OAAM,qCAAC,CAAC,QAAD,CAAD,CAAa,SAASC,CAAT,CAAY,CAI3B,GAAIC,CAAAA,CAAC,CAAG,CAKJC,IAAI,CAAE,eAAW,CACbF,CAAC,CAAC,MAAD,CAAD,CAAUG,EAAV,CAAa,OAAb,CAAsB,mBAAtB,CAA2CF,CAAC,CAACG,cAA7C,EACAJ,CAAC,CAAC,yBAAD,CAAD,CAA6BG,EAA7B,CAAgC,OAAhC,CAAyCF,CAAC,CAACI,iBAA3C,EACAJ,CAAC,CAACK,uBAAF,EACH,CATG,CAgBJF,cAAc,CAAE,wBAASG,CAAT,CAAY,CACxB,GAAIC,CAAAA,CAAU,CAAGR,CAAC,CAACO,CAAC,CAACE,MAAH,CAAD,CAAYC,OAAZ,CAAoB,gBAApB,CAAjB,CACA,GAAIF,CAAU,CAACG,MAAf,CAAuB,CACnB,GAAIH,CAAU,CAACI,QAAX,CAAoB,qBAApB,CAAJ,CAAgD,CAC5CJ,CAAU,CAACK,WAAX,CAAuB,qBAAvB,EAA8CC,QAA9C,CAAuD,oBAAvD,CACH,CAFD,IAEO,CACHN,CAAU,CAACK,WAAX,CAAuB,oBAAvB,EAA6CC,QAA7C,CAAsD,qBAAtD,CACH,CACDP,CAAC,CAACQ,cAAF,GACAd,CAAC,CAACK,uBAAF,EACH,CACJ,CA3BG,CAkCJD,iBAAiB,CAAE,2BAASE,CAAT,CAAY,CAC3B,GAAwC,CAApC,GAAAP,CAAC,CAAC,qBAAD,CAAD,CAAyBW,MAA7B,CAA2C,CAEvCX,CAAC,CAAC,gBAAD,CAAD,CAAoBa,WAApB,CAAgC,qBAAhC,EACAb,CAAC,CAAC,gBAAD,CAAD,CAAoBc,QAApB,CAA6B,oBAA7B,CACH,CAJD,IAIO,CAEHd,CAAC,CAAC,gBAAD,CAAD,CAAoBa,WAApB,CAAgC,oBAAhC,EACAb,CAAC,CAAC,gBAAD,CAAD,CAAoBc,QAApB,CAA6B,qBAA7B,CACH,CACDP,CAAC,CAACQ,cAAF,GACAd,CAAC,CAACK,uBAAF,EACH,CA9CG,CAoDJA,uBAAuB,CAAE,kCAAW,CAChC,GAAIU,CAAAA,CAAI,CAAGhB,CAAC,CAAC,yBAAD,CAAZ,CACA,GAAwC,CAApC,GAAAA,CAAC,CAAC,qBAAD,CAAD,CAAyBW,MAA7B,CAA2C,CAEvCK,CAAI,CAACC,IAAL,CAAUD,CAAI,CAACE,IAAL,CAAU,eAAV,CAAV,CACH,CAHD,IAGO,CAEHF,CAAI,CAACC,IAAL,CAAUD,CAAI,CAACE,IAAL,CAAU,iBAAV,CAAV,CACH,CACJ,CA7DG,CAAR,CAgEA,MAAOjB,CAAAA,CACV,CArEK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/*\n * JavaScript to expand/collapse sections.\n *\n * @package report_customsql\n * @copyright 2014 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * @module report_customsql/reportcategories\n */\ndefine(['jquery'], function($) {\n /**\n * @alias module:report_customsql/reportcategories\n */\n var t = {\n\n /**\n * Initialise the tabs.\n */\n init: function() {\n $('body').on('click', '.csql_category h2', t.expandCollapse);\n $('.csql_expandcollapseall').on('click', t.expandCollapseAll);\n t.updateExpandCollapseAll();\n },\n\n /**\n * Event handler for expanding or collapsing one section.\n *\n * @param {Event} e DOM event.\n */\n expandCollapse: function(e) {\n var catwrapper = $(e.target).closest('.csql_category');\n if (catwrapper.length) {\n if (catwrapper.hasClass('csql_categoryhidden')) {\n catwrapper.removeClass('csql_categoryhidden').addClass('csql_categoryshown');\n } else {\n catwrapper.removeClass('csql_categoryshown').addClass('csql_categoryhidden');\n }\n e.preventDefault();\n t.updateExpandCollapseAll();\n }\n },\n\n /**\n * Event handler for expanding or collapsing one section.\n *\n * @param {Event} DOM event.\n */\n expandCollapseAll: function(e) {\n if ($('.csql_categoryshown').length === 0) {\n // All categories collapsed, do expand all.\n $('.csql_category').removeClass('csql_categoryhidden');\n $('.csql_category').addClass('csql_categoryshown');\n } else {\n // All Some categories open, do collapse all.\n $('.csql_category').removeClass('csql_categoryshown');\n $('.csql_category').addClass('csql_categoryhidden');\n }\n e.preventDefault();\n t.updateExpandCollapseAll();\n },\n\n /**\n * Update the text of the expand/collpase all link, based\n * on whether any sections are open.\n */\n updateExpandCollapseAll: function() {\n var link = $('.csql_expandcollapseall');\n if ($('.csql_categoryshown').length === 0) {\n // All categories collapsed, link should expand all.\n link.text(link.data('expandalltext'));\n } else {\n // All Some categories open, link should collapse all.\n link.text(link.data('collapsealltext'));\n }\n }\n };\n\n return t;\n});\n"],"file":"reportcategories.min.js"} \ No newline at end of file