├── index.html
├── .htaccess
├── myram
├── ramdisk
│ ├── readme.txt
│ ├── linux
│ │ ├── up.sh
│ │ └── down.sh
│ └── darwin
│ │ ├── down.sh
│ │ └── up.sh
├── postgres
│ ├── down.sh
│ └── up.sh
└── mysql
│ ├── down.sh
│ └── up.sh
├── tests
├── fixtures
│ ├── remote_branch_reporter
│ │ ├── MDL-54987
│ │ │ ├── csslint.out
│ │ │ ├── csslint.xml
│ │ │ ├── phplint.xml
│ │ │ ├── shifter.xml
│ │ │ ├── savepoints.xml
│ │ │ ├── thirdparty.xml
│ │ │ ├── grunt.xml
│ │ │ └── eslint.xml
│ │ ├── MDL-55322
│ │ │ ├── csslint.out
│ │ │ ├── csslint.xml
│ │ │ ├── commits.xml
│ │ │ ├── docs.xml
│ │ │ ├── grunt.xml
│ │ │ ├── phplint.xml
│ │ │ ├── shifter.xml
│ │ │ ├── cs.xml
│ │ │ ├── savepoints.xml
│ │ │ ├── thirdparty.xml
│ │ │ ├── patchset.xml
│ │ │ └── jshint.xml
│ │ └── README.md
│ ├── checkstyle
│ │ ├── commits-info.txt
│ │ ├── gherkinlint_ok.xml
│ │ ├── grunt-errors.txt
│ │ ├── commits-info.xml
│ │ ├── savepoints.txt
│ │ ├── shifter.xml
│ │ ├── commits.txt
│ │ ├── savepoints.xml
│ │ ├── grunt-build-failed.xml
│ │ ├── thirdparty.xml
│ │ ├── thirdparty.txt
│ │ ├── grunt-build-failed.txt
│ │ ├── gherkinlint_ok.txt
│ │ ├── commits.xml
│ │ ├── phplint.xml
│ │ ├── phplint.txt
│ │ ├── grunt.xml
│ │ ├── gherkinlint_err.txt
│ │ ├── gherkinlint_err.xml
│ │ ├── mustachelint.txt
│ │ ├── grunt.txt
│ │ └── mustachelint.xml
│ ├── define_excluded
│ │ ├── format-excluded_list_wildchars-expected.txt
│ │ ├── format-excluded_grep-expected.txt
│ │ ├── format-excluded_comma_wildchars-expected.txt
│ │ ├── format-excluded_comma-expected.txt
│ │ ├── format-excluded_list-expected.txt
│ │ └── format-excluded-expected.txt
│ ├── verify_commit_messages
│ │ ├── no-issue-id.patch
│ │ ├── no-code-area.patch
│ │ ├── no-colon.patch
│ │ ├── ok.patch
│ │ ├── includes-parent-in-message.patch
│ │ ├── too-long.patch
│ │ ├── too-long-body.patch
│ │ ├── warning-elsewhere.patch
│ │ ├── amos-no-modified-files.patch
│ │ ├── backslash-ended-lines.patch
│ │ ├── amos-good-commands.patch
│ │ ├── amos-bad-syntax.patch
│ │ └── amos-incomplete.patch
│ ├── 31-php_lint-bad.patch
│ ├── check_upgrade_savepoints
│ │ ├── no_return_statement.patch
│ │ ├── blank_upgrade_file.patch
│ │ ├── repeated_savepoint.patch
│ │ ├── if_without_savepoint.patch
│ │ ├── multiple_return.patch
│ │ ├── returning_bool.patch
│ │ ├── wrong_savepoint_version.patch
│ │ ├── too_high_savepoint.patch
│ │ └── out_of_order.patch
│ ├── versions_check_set
│ │ ├── no_moodle_internal.patch
│ │ ├── main_version_missing.patch
│ │ ├── invalid_component.patch
│ │ ├── no_version_defined.patch
│ │ ├── invalid_date.patch
│ │ ├── extra_version_digit.patch
│ │ ├── short_version.patch
│ │ ├── version_too_far_in_future.patch
│ │ └── short_array_syntax.patch
│ ├── 31-thirdparty-edgecase.patch
│ ├── 31-php_lint-ok.patch
│ ├── 32-thirdparty-lib-added.patch
│ ├── 31-php_lint-vendor.patch
│ ├── 32-grunt-js-unbuilt.patch
│ ├── 31-mustache_lint-js_test.patch
│ ├── 31-whitespace-error.patch
│ ├── 31-mustache_lint-full-html-body.patch
│ ├── 31-mustache_lint-quote_and_uniq.patch
│ ├── 32-grunt-less-unbuilt.patch
│ ├── 31-thirdparty-error.patch
│ ├── 39-mustache_lint_plugins-ignores.patch
│ ├── 31-mustache_lint-partials-loaded.patch
│ ├── 31-mustache_lint-theme_loading.patch
│ ├── 31-thirdparty-ok.patch
│ ├── 31-mustache_lint-html-validator-fail.patch
│ ├── 31-mustache_lint-mustache-syntax-error.patch
│ ├── 31-mustache_lint-no-content.patch
│ ├── 31-mustache_lint-no-example.patch
│ ├── 31-mustache_lint-invalid-json.patch
│ ├── 31-mustache_lint-ok.patch
│ ├── 311-upgrade_external_backup-all-wrong.patch
│ └── 311-upgrade_external_backup-no-changes.patch
├── libs
│ ├── bats-assert
│ │ └── load.bash
│ └── bats-support
│ │ ├── load.bash
│ │ └── src
│ │ └── error.bash
├── 1-list_valid_components.bats
├── 1-diff_extract_changes.bats
├── 1-define_excluded.bats
├── 0-setup.bats
├── 1-detect_conflicts.bats
├── 1-thirdparty_check.bats
├── 1-illegal_whitespace.bats
├── 1-mustache_lint_plugins.bats
├── 1-remote_branch_reporter.bats
├── 1-php_lint.bats
├── 1-travis-branch-checker.bats
├── 1-checkstyle_manipulations.bats
├── 1-grunt_process.bats
└── 1-versions_check_set.bats
├── jenkins_cli
└── jenkins-cli.jar
├── composer.json
├── package.json
├── mustache_lint
├── running_validator.txt
├── simple_core_component_mustache_loader.php
├── js_helper.php
└── mustache_lint.sh
├── tracker_automations
├── bulk_prelaunch_jobs
│ └── criteria
│ │ ├── list_of_mdls
│ │ ├── postissue.sh
│ │ ├── query.sh
│ │ └── jobs.sh
│ │ ├── awaiting_integration
│ │ ├── postissue.sh
│ │ ├── query.sh
│ │ └── jobs.sh
│ │ └── list_of_mdls_sdev
│ │ ├── postissue.sh
│ │ ├── query.sh
│ │ └── jobs.sh
├── bulk_precheck_issues
│ ├── criteria
│ │ ├── developer_request
│ │ │ ├── query.sh
│ │ │ └── postissue.sh
│ │ ├── awaiting_peer_review
│ │ │ ├── postissue.sh
│ │ │ └── query.sh
│ │ └── awaiting_integration
│ │ │ ├── query.sh
│ │ │ ├── postissue.sh
│ │ │ └── override-defaults.sh
│ └── util.sh
├── check_marked_as_integrated
│ └── util.sh
├── remove_ci_label_from_wip
│ └── remove_ci_label_from_wip.sh
├── close_tested_issues
│ └── close_tested_issues.sh
└── delay_awaiting_issues
│ └── delay_awaiting_issues.sh
├── tracker_content_gadget
├── personal_candidate_picker.html
└── personal_current_picker.html
├── .gitignore
├── project_size_report
└── project_size_report.sh
├── lang
└── en
│ └── local_ci.php
├── README.md
├── check_upgrade_savepoints
└── check_upgrade_savepoints.sh
├── version.php
├── groovyscripts
├── remove_post_action_from_all_jobs.groovy
└── add_notification_webhook_to_all_jobs.groovy
├── git_garbage_collector
└── git_garbage_collector.sh
├── list_changed_files
└── list_changed_files.sh
├── run_phpunittests
└── config.php.template
├── verify_commit_messages
└── check_amos.php
├── .travis.yml
├── prepare_composer_stuff
└── prepare_composer_stuff.sh
├── thirdparty_check
├── thirdparty_check.sh
└── thirdpartylocations.php
└── php_lint
└── php_lint.sh
/index.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.htaccess:
--------------------------------------------------------------------------------
1 | Deny from all
2 |
--------------------------------------------------------------------------------
/myram/ramdisk/readme.txt:
--------------------------------------------------------------------------------
1 | Based and adapted from: https://gist.github.com/koshigoe/822455
2 |
--------------------------------------------------------------------------------
/tests/fixtures/remote_branch_reporter/MDL-54987/csslint.out:
--------------------------------------------------------------------------------
1 | csslint: No files specified.
2 |
--------------------------------------------------------------------------------
/tests/fixtures/remote_branch_reporter/MDL-55322/csslint.out:
--------------------------------------------------------------------------------
1 | csslint: No files specified.
2 |
--------------------------------------------------------------------------------
/tests/libs/bats-assert/load.bash:
--------------------------------------------------------------------------------
1 | source "$(dirname "${BASH_SOURCE[0]}")/src/assert.bash"
2 |
--------------------------------------------------------------------------------
/jenkins_cli/jenkins-cli.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marinaglancy/moodle-local_ci/master/jenkins_cli/jenkins-cli.jar
--------------------------------------------------------------------------------
/tests/fixtures/checkstyle/commits-info.txt:
--------------------------------------------------------------------------------
1 | b21c515*info*AMOS - String to be copied: searchengine/admin to type_search/plugin
2 |
--------------------------------------------------------------------------------
/tests/fixtures/remote_branch_reporter/MDL-54987/csslint.xml:
--------------------------------------------------------------------------------
1 |
Hello {{text}}
29 | +{{#js}} 30 | + var my_message = 'Hello {{text}}'; 31 | + alert(my_message); 32 | +{{/js}} 33 | -- 34 | 2.10.0 35 | 36 | -------------------------------------------------------------------------------- /tests/fixtures/checkstyle/gherkinlint_err.txt: -------------------------------------------------------------------------------- 1 | [{"filePath":"/admin/tool/behat/tests/fixtures/core/test_2.feature","errors":[]},{"filePath":"/admin/tool/behat/tests/fixtures/theme/withfeatures/theme_test_1.feature","errors":[{"message":"Wrong indentation for \"given\", expected indentation level of 4, but got 6","rule":"indentation","line":9},{"message":"Wrong indentation for \"given\", expected indentation level of 4, but got 6","rule":"indentation","line":10}]},{"filePath":"/admin/tool/behat/tests/fixtures/theme/withfeatures/theme_test_2.feature","errors":[{"message":"Feature name is already used in: admin/tool/behat/tests/fixtures/core/test_2.feature","rule":"no-dupe-feature-names","line":2}]},{"filePath":"/admin/tool/capability/tests/behat/show_capabilies.feature","errors":[]},{"filePath":"/admin/tool/task/tests/behat/clear_fail_delay.feature","errors":[{"message":"Multiple empty lines are not allowed","rule":"no-multiple-empty-lines","line":26}]},{"filePath":"/admin/tool/task/tests/behat/manage_tasks.feature","errors":[]}] 2 | -------------------------------------------------------------------------------- /tests/fixtures/31-whitespace-error.patch: -------------------------------------------------------------------------------- 1 | From e85a153c0a41fdf85c1a8f2a4467647eabfc87d6 Mon Sep 17 00:00:00 2001 2 | From: Dan Poltawski{{message}}
34 | + 35 | + 36 | -- 37 | 2.10.0 38 | 39 | -------------------------------------------------------------------------------- /tests/fixtures/31-mustache_lint-quote_and_uniq.patch: -------------------------------------------------------------------------------- 1 | From 102f9eaa8ba06e42222291a0f7ab10d70d91e7db Mon Sep 17 00:00:00 2001 2 | From: Dan PoltawskiHello World
52 | -- 53 | 2.10.0 54 | 55 | -------------------------------------------------------------------------------- /list_changed_files/list_changed_files.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # $gitcmd: Path to the git CLI executable 3 | # $gitdir: Directory containing git repo 4 | # $initialcommit: hash of the initial commit 5 | # $finalcommit: hash of the final commit 6 | 7 | # List the modified files in a git repository between 2 commits. 8 | # (relative to the root dir of the git repository) 9 | 10 | # Don't be strict. Script has own error control handle 11 | set +e 12 | 13 | # Verify everything is set 14 | required="gitcmd gitdir initialcommit finalcommit" 15 | for var in $required; do 16 | if [ -z "${!var}" ]; then 17 | echo "Error: ${var} environment variable is not defined. See the script comments." 18 | exit 1 19 | fi 20 | done 21 | 22 | # calculate some variables 23 | mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 24 | 25 | cd ${gitdir} 26 | 27 | # verify initial commit exists 28 | ${gitcmd} rev-parse --quiet --verify ${initialcommit} > /dev/null 29 | if [[ ${PIPESTATUS[0]} -ne 0 ]]; then 30 | echo "Error: initial commit does not exist (${initialcommit})" 31 | exit 1 32 | fi 33 | 34 | # verify final commit exists 35 | ${gitcmd} rev-parse --quiet --verify ${finalcommit} > /dev/null 36 | if [[ ${PIPESTATUS[0]} -ne 0 ]]; then 37 | echo "Error: final commit does not exist (${finalcommit})" 38 | exit 1 39 | fi 40 | 41 | # verify initial commit is ancestor of final commit 42 | ${gitcmd} merge-base --is-ancestor ${initialcommit} ${finalcommit} > /dev/null 2>&1 43 | if [[ ${PIPESTATUS[0]} -ne 0 ]]; then 44 | echo "Error: unrelated commits are not comparable (${initialcommit} and ${finalcommit})" 45 | exit 1 46 | fi 47 | 48 | # get all the files changed between both commits (no matter the diffs are empty) 49 | git log --name-only --pretty=oneline --full-index ${initialcommit}..${finalcommit} | \ 50 | grep -vE '^[0-9a-f]{40} ' | sort | uniq 51 | -------------------------------------------------------------------------------- /run_phpunittests/config.php.template: -------------------------------------------------------------------------------- 1 | wwwroot = 'http://localhost'; 9 | $CFG->admin = 'admin'; 10 | $CFG->directorypermissions = 00777; 11 | $CFG->dataroot='%%DATADIR%%'; 12 | 13 | // DB settings 14 | $CFG->dblibrary='%%DBLIBRARY%%'; 15 | $CFG->dbtype='%%DBTYPE%%'; 16 | $CFG->dbhost='%%DBHOST%%'; 17 | $CFG->dbuser='%%DBUSER%%'; 18 | $CFG->dbpass='%%DBPASS%%'; 19 | $CFG->dbname='%%DBNAME%%'; 20 | $CFG->dboptions=array(); 21 | 22 | // PHPUNIT settings 23 | $CFG->phpunit_prefix='p_'; 24 | $CFG->phpunit_dataroot='%%DATADIRPHPUNIT%%'; 25 | 26 | // Set correct server timezone 27 | date_default_timezone_set('Europe/Madrid'); 28 | 29 | // Debugging and performance footer 30 | $CFG->debug = E_ALL | E_STRICT; 31 | $CFG->xmlstrictheaders = false; 32 | $CFG->debugdisplay = true; 33 | $CFG->perfdebug = 15; 34 | define('MDL_PERFDB' , true); 35 | $CFG->upgradeshowsql = true; 36 | $CFG->debugpageinfo = true; 37 | 38 | // Early profiling 39 | $CFG->earlyprofilingenabled = true; 40 | $CFG->profilingautofrec = 10; 41 | $CFG->profilingincluded = '/*view.php,/*index.php'; 42 | $CFG->profilingallowme = true; 43 | $CFG->profilingallowall = true; 44 | 45 | // Disable lang cache to get immediate changes 46 | $CFG->langstringcache = false; 47 | 48 | // STOP any mailout 49 | $CFG->noemailever = true; 50 | 51 | // Ensure some stuff is always enabled 52 | $CFG->enablecompletion = true; 53 | $CFG->enableavailability = true; 54 | $CFG->usetags = true; 55 | $CFG->enableoutcomes = true; 56 | $CFG->usecomments = true; 57 | 58 | // Extra settings 59 | %%EXTRACONFIG%% 60 | 61 | require_once(dirname(__FILE__) . '/lib/setup.php'); 62 | // MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES, 63 | // RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE. 64 | -------------------------------------------------------------------------------- /tests/1-thirdparty_check.bats: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bats 2 | 3 | load libs/shared_setup 4 | 5 | setup () { 6 | create_git_branch MOODLE_31_STABLE v3.1.0 7 | } 8 | 9 | @test "thirdparty_check: thirdpartyfile modified OK" { 10 | git_apply_fixture 31-thirdparty-ok.patch 11 | export initialcommit=$FIXTURE_HASH_BEFORE 12 | export finalcommit=$FIXTURE_HASH_AFTER 13 | 14 | ci_run thirdparty_check/thirdparty_check.sh 15 | assert_success 16 | assert_output --partial "INFO: Checking for third party modifications from $initialcommit to $finalcommit" 17 | assert_output --partial "INFO: Detected third party modification in lib/amd/src/mustache.js" 18 | assert_output --partial "INFO: OK lib/thirdpartylibs.xml modified" 19 | refute_output --partial "WARN:" 20 | } 21 | 22 | @test "thirdparty_check: thirdpartyfile modified without update" { 23 | git_apply_fixture 31-thirdparty-error.patch 24 | export initialcommit=$FIXTURE_HASH_BEFORE 25 | export finalcommit=$FIXTURE_HASH_AFTER 26 | 27 | ci_run thirdparty_check/thirdparty_check.sh 28 | assert_success # TODO, this should be fixed! 29 | assert_output --partial "INFO: Checking for third party modifications from $initialcommit to $finalcommit" 30 | assert_output --partial "INFO: Detected third party modification in lib/amd/src/mustache.js" 31 | assert_output --partial "WARN: modification to third party library (lib/amd/src/mustache.js) without update to lib/thirdpartylibs.xml or lib/amd/src/readme_moodle.txt" 32 | } 33 | 34 | @test "thirdparty_check: lib/requirejs.php edgecase" { 35 | # Test case for lib/requirejs.php which isn't in folder lib/requirejs/ 36 | git_apply_fixture 31-thirdparty-edgecase.patch 37 | export initialcommit=$FIXTURE_HASH_BEFORE 38 | export finalcommit=$FIXTURE_HASH_AFTER 39 | 40 | ci_run thirdparty_check/thirdparty_check.sh 41 | assert_success 42 | refute_output --partial "WARN:" 43 | assert_output "INFO: Checking for third party modifications from $initialcommit to $finalcommit" 44 | } 45 | -------------------------------------------------------------------------------- /verify_commit_messages/check_amos.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | require_once(__DIR__.'/../phplib/clilib.php'); 18 | require_once(__DIR__.'/amoslib.php'); 19 | 20 | list($options, $unrecognized) = cli_get_params( 21 | array('help' => false, 'commitid' => '', 'filesmodified' => ''), 22 | array('h' => 'help', 'c' => 'commitid', 'f' => 'filesmodified')); 23 | 24 | if ($unrecognized) { 25 | $unrecognized = implode("\n ", $unrecognized); 26 | cli_error("Unrecognised options:\n{$unrecognized}\n Please use --help option."); 27 | } 28 | 29 | if ($options['help']) { 30 | $help = 31 | "Checks a git commit against amos comamnds 32 | 33 | Options: 34 | -h, --help Print out this help 35 | -c, --commitid git commit hash 36 | -f, --filesmodified files modified by commit (comma seperated) 37 | "; 38 | echo $help; 39 | exit(0); 40 | } 41 | 42 | if (empty($options['commitid'])) { 43 | cli_error('--commitid missing. Use --help to get more info.'); 44 | } 45 | 46 | if (empty($options['filesmodified'])) { 47 | cli_error('--filesmodified missing. Use --help to get more info.'); 48 | } 49 | 50 | $COMMIT = $options['commitid']; 51 | 52 | $message = file_get_contents("php://stdin"); 53 | $returncode = amos_script_parser::validate_commit_message($message, $options['filesmodified']); 54 | exit($returncode); 55 | -------------------------------------------------------------------------------- /tests/1-illegal_whitespace.bats: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bats 2 | 3 | load libs/shared_setup 4 | 5 | setup () { 6 | create_git_branch MOODLE_31_STABLE v3.1.1 7 | # Restore workspace if not first test. 8 | first_test || restore_workspace 9 | } 10 | 11 | teardown () { 12 | # Store workspace if not last test. 13 | last_test || store_workspace 14 | } 15 | 16 | @test "illegal_whitespace: first run OK" { 17 | # On first run, there are no results to compare to so should always 18 | # pass. 19 | ci_run illegal_whitespace/illegal_whitespace.sh 20 | 21 | assert_success 22 | assert_output --partial "current count: 959" 23 | # The 'no previously recorded value' number is 999999 24 | assert_output --partial "previous count: 999999" 25 | assert_output --partial "best count: 999999" 26 | assert_output --partial "got best results ever, yay!" 27 | } 28 | 29 | @test "illegal_whitespace: normal state OK" { 30 | # On second run, should still pass with same results 31 | ci_run illegal_whitespace/illegal_whitespace.sh 32 | 33 | assert_success 34 | assert_output --partial "current count: 959" 35 | assert_output --partial "previous count: 959" 36 | assert_output --partial "best count: 959" 37 | assert_output --partial "continue in best results ever" 38 | } 39 | 40 | @test "illegal_whitespace: failure reported when whitespace error detected" { 41 | # Lets introduce a whitespace error and ensure it fails 42 | git_apply_fixture 31-whitespace-error.patch 43 | 44 | ci_run illegal_whitespace/illegal_whitespace.sh 45 | assert_failure 46 | assert_output --partial "current count: 961" 47 | assert_output --partial "previous count: 959" 48 | assert_output --partial "best count: 959" 49 | assert_output --partial "worse results than previous counter" 50 | } 51 | 52 | @test "illegal_whitespace: Whitespace in path of gitdir" { 53 | tmpdir=`mktemp -d` 54 | uit="$tmpdir/example space" 55 | mkdir -p "${uit}" 56 | export gitdir="${uit}" 57 | export gitbranch="master" 58 | ci_run illegal_whitespace/illegal_whitespace.sh 59 | assert_success 60 | } 61 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | os: linux 4 | dist: xenial 5 | 6 | addons: 7 | apt: 8 | packages: 9 | - bc 10 | 11 | cache: 12 | directories: 13 | - $HOME/cachedir 14 | 15 | services: 16 | - mysql 17 | 18 | php: 19 | - 7.3 20 | 21 | env: 22 | - TEST_SUITE="0-*" 23 | - TEST_SUITE="1-*" 24 | - TEST_SUITE="2-*" 25 | - TEST_SUITE="3-*" 26 | 27 | before_install: 28 | - sudo apt update && sudo apt install libgnutls-openssl27 libgnutls30 29 | 30 | install: 31 | - git clone --depth 1 https://github.com/bats-core/bats-core.git $HOME/bats-core 32 | - nvm install 8.9 33 | - nvm use 8.9 34 | - travis_retry composer install 35 | - npm install 36 | - echo -e "[server]\ninnodb_flush_log_at_trx_commit=0" | sudo tee -a /etc/mysql/my.cnf # General speed bump. 37 | # Move MySQL data to tmpfs (see core travis). Without that we get random timeouts here and there. 38 | - sudo mkdir /mnt/ramdisk 39 | - sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk 40 | - sudo service mysql stop 41 | - sudo mv /var/lib/mysql /mnt/ramdisk 42 | - sudo ln -s /mnt/ramdisk/mysql /var/lib/mysql 43 | - sudo service mysql restart 44 | 45 | before_script: 46 | - 'git config --global user.email "travis@localhost"' 47 | - 'git config --global user.name "Travis CI"' 48 | - 'git config --global core.abbrev 10' 49 | - "export LOCAL_CI_TESTS_CACHEDIR=$HOME/cachedir && mkdir -p $LOCAL_CI_TESTS_CACHEDIR" 50 | - "export LOCAL_CI_TESTS_GITDIR=$HOME/gitdir && git clone https://github.com/moodle/moodle $LOCAL_CI_TESTS_GITDIR" 51 | - "git clone -q --depth 1 https://github.com/moodlehq/moodle-local_codechecker $HOME/moodle-local_codechecker" 52 | - "export LOCAL_CI_TESTS_PHPCS_DIR=$HOME/moodle-local_codechecker/moodle/" 53 | - "export LOCAL_CI_TESTS_DBLIBRARY=native" 54 | - "export LOCAL_CI_TESTS_DBTYPE=mysqli" 55 | - "export LOCAL_CI_TESTS_DBHOST=localhost" 56 | - "export LOCAL_CI_TESTS_DBUSER=travis" 57 | - "export LOCAL_CI_TESTS_DBPASS=" 58 | - "unset _JAVA_OPTIONS" # stderr output on each java execution breaks our json expectations. See travis-ci/travis-ci#8408 59 | 60 | script: 61 | - $HOME/bats-core/bin/bats --timing tests/$TEST_SUITE 62 | -------------------------------------------------------------------------------- /tests/1-mustache_lint_plugins.bats: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bats 2 | 3 | load libs/shared_setup 4 | 5 | setup () { 6 | create_git_branch MOODLE_39_STABLE v3.9.1 7 | } 8 | 9 | @test "mustache_lint: Mustache files with Ionic3 syntax cause linting failure" { 10 | # Set up. 11 | git_apply_fixture 39-mustache_lint_plugins-templates.patch 12 | export GIT_PREVIOUS_COMMIT=$FIXTURE_HASH_BEFORE 13 | export GIT_COMMIT=$FIXTURE_HASH_AFTER 14 | 15 | ci_run mustache_lint/mustache_lint.sh 16 | 17 | # Assert result. 18 | assert_failure 19 | assert_output --partial "Running mustache lint from $GIT_PREVIOUS_COMMIT to $GIT_COMMIT" 20 | assert_output --partial "local/test/templates/linting_ok.mustache - OK: Mustache rendered html succesfully" 21 | assert_output --partial "local/test/templates/local/mobile/view.mustache - WARNING: HTML Validation info" 22 | assert_output --partial "local/test/templates/mobile_view.mustache - WARNING: HTML Validation error" 23 | assert_output --partial "Mustache lint problems found" 24 | } 25 | 26 | @test "mustache_lint: Mustache files can be excluded from linting" { 27 | # Set up. 28 | git_apply_fixture 39-mustache_lint_plugins-templates.patch 29 | export GIT_PREVIOUS_COMMIT=$FIXTURE_HASH_BEFORE 30 | git_apply_fixture 39-mustache_lint_plugins-ignores.patch 31 | export GIT_COMMIT=$FIXTURE_HASH_AFTER 32 | 33 | ci_run mustache_lint/mustache_lint.sh 34 | 35 | # Assert result 36 | assert_success 37 | assert_output --partial "Running mustache lint from $GIT_PREVIOUS_COMMIT to $GIT_COMMIT" 38 | assert_output --partial "local/test/templates/linting_ok.mustache - OK: Mustache rendered html succesfully" 39 | assert_output --partial "local/test/templates/mobile_view.mustache - OK: Mustache rendered html succesfully" 40 | assert_output --partial "local/test/templates/local/mobile/view.mustache - OK: Mustache rendered html succesfully" 41 | assert_output --partial "local/test/templates/mobile_view.mustache - INFO: HTML validation skipped" 42 | assert_output --partial "local/test/templates/local/mobile/view.mustache - INFO: HTML validation skipped" 43 | assert_output --partial "No mustache problems found" 44 | } 45 | -------------------------------------------------------------------------------- /tests/fixtures/31-mustache_lint-mustache-syntax-error.patch: -------------------------------------------------------------------------------- 1 | From 9034289ac1a8606321699bffb15b766fa51e2ff7 Mon Sep 17 00:00:00 2001 2 | From: Dan Poltawski