Bug 1229588: Add a taskcluster test for eslint. r=dustin

Adds a new lint docker image for linting tools and adds an eslint-gecko task
that uses it to run eslint over the tree.

--HG--
extra : rebase_source : 6e3584ae9ec05ca1c45270f312d96cd026550e17
This commit is contained in:
Dave Townsend 2016-01-06 13:33:30 -08:00
Родитель 535eb88718
Коммит a1a44cb784
6 изменённых файлов: 129 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,24 @@
FROM node:4.2
MAINTAINER Dave Townsend <dtownsend@oxymoronical.com>
RUN useradd -d /home/worker -s /bin/bash -m worker
WORKDIR /home/worker
# install necessary npm packages
RUN npm install -g taskcluster-vcs@2.3.12
RUN npm install -g eslint@1.10.3
RUN npm install -g eslint-plugin-html@1.1.0
RUN npm install -g eslint-plugin-react@3.13.1
# Set variable normally configured at login, by the shells parent process, these
# are taken from GNU su manual
ENV HOME /home/worker
ENV SHELL /bin/bash
ENV USER worker
ENV LOGNAME worker
ENV HOSTNAME taskcluster-worker
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
# Set a default command useful for debugging
CMD ["/bin/bash", "--login"]

Просмотреть файл

@ -105,6 +105,7 @@ flags:
- linux64-st-an
- macosx64
- macosx64-st-an
- eslint-gecko
tests:
- cppunit

Просмотреть файл

@ -176,6 +176,12 @@ builds:
types:
opt:
task: tasks/builds/android_api_11_b2gdroid.yml
eslint-gecko:
platforms:
- lint
types:
opt:
task: tasks/tests/eslint-gecko.yml
tests:
cppunit:

Просмотреть файл

@ -0,0 +1,40 @@
# This is the "base" task which contains the common values all linting tests must
# provide.
---
taskId: {{build_slugid}}
task:
created: '{{now}}'
deadline: '{{#from_now}}24 hours{{/from_now}}'
metadata:
source: http://todo.com/soon
owner: mozilla-taskcluster-maintenance@mozilla.com
tags:
createdForUser: {{owner}}
workerType: b2gtest
provisionerId: aws-provisioner-v1
schedulerId: task-graph-scheduler
routes:
- 'index.gecko.v1.{{project}}.revision.linux.{{head_rev}}.{{build_name}}.{{build_type}}'
- 'index.gecko.v1.{{project}}.latest.linux.{{build_name}}.{{build_type}}'
scopes:
# Nearly all of our build tasks use tc-vcs so just include the scope across
# the board.
- 'docker-worker:cache:tc-vcs'
payload:
# Thirty minutes should be enough for lint checks
maxRunTime: 1800
cache:
tc-vcs: '/home/worker/.tc-vcs'
extra:
build_product: '{{build_product}}'
build_name: '{{build_name}}'
build_type: '{{build_type}}'
index:
rank: {{pushlog_id}}

Просмотреть файл

@ -0,0 +1,35 @@
---
$inherits:
from: 'tasks/lint.yml'
task:
metadata:
name: '[TC] - ESLint'
description: 'ESLint test'
payload:
image:
type: 'task-image'
path: 'public/image.tar'
taskId: '{{#task_id_for_image}}lint{{/task_id_for_image}}'
command:
- bash
- -cx
- >
tc-vcs checkout ./gecko {{base_repository}} {{head_repository}} {{head_rev}} {{head_ref}} &&
cd gecko &&
npm link testing/eslint-plugin-mozilla &&
eslint --plugin html --ext [.js,.jsm,.jsx,.xml,.html] -f tools/lint/eslint-formatter .
extra:
locations:
build: null
tests: null
treeherder:
machine:
platform: lint
groupSymbol: tc
symbol: ES
treeherderEnv:
- production
- staging

Просмотреть файл

@ -0,0 +1,23 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const path = require("path")
module.exports = function(results) {
for (let file of results) {
let filePath = path.relative(".", file.filePath);
for (let message of file.messages) {
let status = message.message;
if ("ruleId" in message) {
status = `${status} (${message.ruleId})`;
}
let severity = message.severity == 1 ? "TEST-UNEXPECTED-WARNING"
: "TEST-UNEXPECTED-ERROR";
console.log(`${severity} | ${filePath}:${message.line}:${message.column} | ${status}`);
}
}
};