From 5ae7ee8dd87139e270f3876e67be189465244c59 Mon Sep 17 00:00:00 2001 From: Ruslan Kabalin Date: Wed, 1 May 2019 14:39:52 +0100 Subject: [PATCH 1/8] MDLSITE-5739 mustache_lint: Use v.Nu validator v18.11.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cb37326f..92456574 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,6 @@ "description": "Tools for CI with Moodle", "private": true, "dependencies": { - "vnu-jar": "^17.3.0" + "vnu-jar": "18.11.5" } } From 1f3f3e8fec82e7c4656d9d945211f5461212d3f9 Mon Sep 17 00:00:00 2001 From: Ruslan Kabalin Date: Wed, 1 May 2019 14:45:59 +0100 Subject: [PATCH 2/8] MDLSITE-5739 mustache_lint: Add lang attribute to wrapper. Validator v18.11.5 complains about it (info notice), and in fact, having lang attribute seems a good practice these days: https://www.w3.org/International/questions/qa-html-language-declarations#quickanswer --- mustache_lint/mustache_lint.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mustache_lint/mustache_lint.php b/mustache_lint/mustache_lint.php index a1ac17c1..8a93afc7 100644 --- a/mustache_lint/mustache_lint.php +++ b/mustache_lint/mustache_lint.php @@ -198,7 +198,7 @@ function check_html_validation($content) { if (strpos($content, '') === false) { // Primative detection if we have full html body, if not, wrap it. // (This isn't bulletproof, obviously). - $wrappedcontent = "Validate\n{$content}\n"; + $wrappedcontent = "Validate\n{$content}\n"; } else { $wrappedcontent = $content; } From 847197d1b192232eedc73d80414a5a40380053be Mon Sep 17 00:00:00 2001 From: Ruslan Kabalin Date: Wed, 1 May 2019 15:25:56 +0100 Subject: [PATCH 3/8] MDLSITE-5739 mustache_lint: Fix full html page test. --- tests/fixtures/31-mustache_lint-full-html-body.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fixtures/31-mustache_lint-full-html-body.patch b/tests/fixtures/31-mustache_lint-full-html-body.patch index f0320188..f1ebbd96 100644 --- a/tests/fixtures/31-mustache_lint-full-html-body.patch +++ b/tests/fixtures/31-mustache_lint-full-html-body.patch @@ -25,7 +25,7 @@ index 0000000..386ffb0 + } +}} + -+ ++ + +Test page + From fff179e90d99833e6f5b395f19aed9cc6d50a560 Mon Sep 17 00:00:00 2001 From: Ruslan Kabalin Date: Wed, 1 May 2019 15:21:19 +0100 Subject: [PATCH 4/8] travis: Run tests on trusty and xenial --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index aa1af3e6..80208ace 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,15 @@ cache: php: - 7.1 +matrix: + include: + - dist: xenial + env: TEST_SUITE="0-*" + - dist: xenial + env: TEST_SUITE="1-*" + - dist: xenial + env: TEST_SUITE="2-*" + env: - TEST_SUITE="0-*" - TEST_SUITE="1-*" From 1e7dfcd8d209d600878ab77e67aa42db37ac5862 Mon Sep 17 00:00:00 2001 From: Ruslan Kabalin Date: Wed, 1 May 2019 21:57:05 +0100 Subject: [PATCH 5/8] travis: Add dummy var to destinguish distro on build status page. Also enables mysql (for Xenial needs to be explicitly specified) --- .travis.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 80208ace..0ee0d883 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,22 +12,25 @@ cache: directories: - $HOME/cachedir +services: + - mysql + php: - 7.1 matrix: include: - dist: xenial - env: TEST_SUITE="0-*" + env: TEST_SUITE="0-*" DIST="xenial" - dist: xenial - env: TEST_SUITE="1-*" + env: TEST_SUITE="1-*" DIST="xenial" - dist: xenial - env: TEST_SUITE="2-*" + env: TEST_SUITE="2-*" DIST="xenial" env: - - TEST_SUITE="0-*" - - TEST_SUITE="1-*" - - TEST_SUITE="2-*" + - TEST_SUITE="0-*" DIST="trusty" + - TEST_SUITE="1-*" DIST="trusty" + - TEST_SUITE="2-*" DIST="trusty" install: - git clone --depth 1 https://github.com/sstephenson/bats.git $HOME/bats From 2ae4e56d65b95fb0434daf99d69e30e7463dc49d Mon Sep 17 00:00:00 2001 From: Ruslan Kabalin Date: Thu, 2 May 2019 13:16:31 +0100 Subject: [PATCH 6/8] mustache_lint: Improve version comparison in shell script. --- mustache_lint/mustache_lint.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mustache_lint/mustache_lint.sh b/mustache_lint/mustache_lint.sh index c2472a9f..fdabfd40 100755 --- a/mustache_lint/mustache_lint.sh +++ b/mustache_lint/mustache_lint.sh @@ -24,10 +24,12 @@ mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" validator=${validator:-"https://html5.validator.nu"} if [ -f "$mydir/../node_modules/vnu-jar/build/dist/vnu.jar" ] then - if java -version 2>&1 >/dev/null | grep -q "java version" + if java -version 2>&1 >/dev/null | grep -Eq "(java|openjdk) version" then - javaversion=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}') - if [[ "$javaversion" > "1.8" ]] + # Extract major and minor digits of version and compare it as float + # numbers. Not error proof, but sufficient to ensure it is >= 1.8 + javaversion=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed 's/^\([0-9]*\.[0-9]*\).*$/\1/') + if [ $( echo "${javaversion} >= 1.8" | bc ) == 1 ] then echo "NPM installed validator found." validator="$( cd $mydir/../node_modules/ && pwd)/vnu-jar/build/dist/vnu.jar" From dfefd3cfa0be6b98bcec7051094f23ba4c25c455 Mon Sep 17 00:00:00 2001 From: Ruslan Kabalin Date: Wed, 15 May 2019 13:37:31 +0100 Subject: [PATCH 7/8] Add package-lock.json How to upgrade vnu-jar: 1. Identify latest stable release at https://www.npmjs.com/package/vnu-jar 2. Amend version at package.json 3. Run npm upgrade 4. Commit changes. --- package-lock.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..15fe628c --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "moodle-local_ci", + "version": "0.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "vnu-jar": { + "version": "18.11.5", + "resolved": "https://registry.npmjs.org/vnu-jar/-/vnu-jar-18.11.5.tgz", + "integrity": "sha512-XxTYLOUgQYdvIlAgX1BtxZiQ97/OKuBaEojqZdjMnjI+OXDkSyQGNGpzUQIQygeRrFVdQ1/eAVfiRE/iIlV0fg==" + } + } +} From 28b43e896ec3f1fca621c29ac2f41bd32f8189fa Mon Sep 17 00:00:00 2001 From: Ruslan Kabalin Date: Thu, 25 Jul 2019 23:36:51 +0100 Subject: [PATCH 8/8] travis: Run against xenial (openjdk11) --- .travis.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0ee0d883..cdca5e93 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +dist: xenial + language: php sudo: false @@ -6,7 +8,6 @@ addons: apt: packages: - bc - - openjdk-8-jre-headless cache: directories: @@ -18,19 +19,10 @@ services: php: - 7.1 -matrix: - include: - - dist: xenial - env: TEST_SUITE="0-*" DIST="xenial" - - dist: xenial - env: TEST_SUITE="1-*" DIST="xenial" - - dist: xenial - env: TEST_SUITE="2-*" DIST="xenial" - env: - - TEST_SUITE="0-*" DIST="trusty" - - TEST_SUITE="1-*" DIST="trusty" - - TEST_SUITE="2-*" DIST="trusty" + - TEST_SUITE="0-*" + - TEST_SUITE="1-*" + - TEST_SUITE="2-*" install: - git clone --depth 1 https://github.com/sstephenson/bats.git $HOME/bats