Continuous integration/grunt

grunt is a task based command line tool for Node.js, just like ant for java or rake for ruby. The Wikimedia continuous integration team is going to use that to trigger linting tests.

Grunt is usually installed using the node package management (npm) system. That will get the source file from an upstream repository and happily copy everything on your server. Since we do not trust upstream authors, we are maintaining our own copy of grunt and its required dependencies in a Gerrit hosted repository: integration/gruntjs.git

Initializing Wikimedia copy
We are updating grunt upstream by just squashing all changes from upstream in our repository then update the node-modules locally add the resulting update to our git repository.

Setup a local repository with upstream and wikimedia repository:

mkdir ~/project/integration/gruntjs cd ~/project/integration/gruntjs git remote add upstream https://github.com/gruntjs/grunt.git git remote add gerrit ssh://gerrit.wikimedia.org:29418/integration/gruntjs.git git remote update git checkout -b wikimedia/master -t gerrit/master git checkout -b upstream/master -t upstream/master

The master branches from each remote do not relate to each other. The wikimedia one has been created as an orphan branch and is used as a receptacle for a squashed merge of upstream changes. To update the Wikimedia copy:

git checkout wikimedia/master git merge --squash upstream/master git commit --amend
 * 1) Get yourself to the Wikimedia copy
 * 1) Get all upstream changes:
 * 1) Write a nice commit summary:

For example: gruntjs 0.3.17 (a70f61c) From upstream:     https://github.com/gruntjs/grunt.git

Now you want to remove the existing node_modules and do a clean install:

rm -fR node_modules npm install
 * 1) Edit .gitignore and remove the  `node_modules` entry
 * 1) Install all grunt dependencies locally

The node_modules has been updated so you will then git add it as well as the .gitinore file and commit the result using a commit message such as node modules for gruntjs 0.3.17.

Send the update to Gerrit for review:

git push gerrit wikimedia/master:refs/for/master

Updating MediaWiki copy
We simply delete everything but our .gitreview file:

git rm -r *

We then get the upstream devel version:

git checkout remotes/github/devel -- *

Then update the node modules:

npm install

You will want to remove the `node_modules` entry from the `.gitignore` list. Then git add the fresh node_modules directory and commit :-)

Commit the result, making sure to specifiy upstream version or sha1.

git-review