Krinkle has submitted this change and it was merged.

Change subject: QUnit: Add macro for QUnit and create jobs for test/mediawiki
......................................................................


QUnit: Add macro for QUnit and create jobs for test/mediawiki

Change-Id: Ic2cef3d4c8d1d6c6c47a68f0934ac666ff0751b2
---
M job-templates.yaml
M macro.yaml
M test-mediawiki.yaml
3 files changed, 44 insertions(+), 0 deletions(-)

Approvals:
  Krinkle: Verified; Looks good to me, approved



diff --git a/job-templates.yaml b/job-templates.yaml
index da04058..3ad5fb1 100644
--- a/job-templates.yaml
+++ b/job-templates.yaml
@@ -10,6 +10,17 @@
     builders:
      - php-lint
 
+# Generic job to run the QUnit builder
+- job-template:
+    name: '{name}-qunit'
+
+    defaults: use-zuul
+    triggers:
+     - zuul
+
+    builders:
+     - qunit
+
 # PHP CodeSniffer on everything under the workspace
 - job-template:
     name: '{name}-phpcs'
diff --git a/macro.yaml b/macro.yaml
index 2d5941d..b6da94a 100644
--- a/macro.yaml
+++ b/macro.yaml
@@ -62,6 +62,38 @@
      - jshint-in:
         dir: '$WORKSPACE'
 
+- builder:
+    name: qunit
+    builders:
+     - shell: |
+        # Unique id for the code to be tested
+        TEST_ID=`echo "$ZUUL_PROJECT/$ZUUL_COMMIT" | tr '/' '-'`
+        # Install MediaWiki
+        php $WORKSPACE/maintenance/install.php \
+        --confpath $WORKSPACE \
+        --dbtype sqlite \
+        --dbpath $WORKSPACE \
+        --dbname my_wiki \
+        --scriptpath /$TEST_ID \
+        --server http://localhost:9412 \
+        --pass testpass \
+        TestWiki \
+        WikiAdmin
+        # Custom settings
+        echo '$wgShowExceptionDetails = true; $wgEnableJavaScriptTest = true;' 
>> $WORKSPACE/LocalSettings.php
+        # The location is free or we free it now
+        test ! -e /srv/localhost/qunit/$TEST_ID || rm 
/srv/localhost/qunit/$TEST_ID;
+        # Set up symlink in the document root
+        ln -s $WORKSPACE /srv/localhost/qunit/$TEST_ID
+        # Run QUnit tests via PhantomJS
+        /var/lib/jenkins/bin/wmfgrunt qunit 
--qunit-url="http://localhost:9412/$TEST_ID/index.php?title=Special:JavaScriptTest/qunit";
+        gqec=$?
+        # Clean up
+        rm /srv/localhost/qunit/$TEST_ID
+        # Re-use exit code of grunt-qunit command
+        exit $gqec
+
+
 # Has to be named something other than 'checkstyle' or python will
 # go into infinite recursion when generating the jobs.
 # JSHint considers all errors to be "high" priority except those
diff --git a/test-mediawiki.yaml b/test-mediawiki.yaml
index acfeacd..82aeee9 100644
--- a/test-mediawiki.yaml
+++ b/test-mediawiki.yaml
@@ -18,3 +18,4 @@
     jobs:
      - 'test-mediawiki-dumpenv'
      - '{name}-phpcs-HEAD'
+     - '{name}-qunit'

-- 
To view, visit https://gerrit.wikimedia.org/r/52162
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic2cef3d4c8d1d6c6c47a68f0934ac666ff0751b2
Gerrit-PatchSet: 7
Gerrit-Project: integration/jenkins-job-builder-config
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to