Use nodeenv via tox to do javascript testing

The OpenStack CI systems like things that run in virtualenvs. This moves
the first stab at running javascript unittests from custom in-tree scripts
to being based on tox and nodeenv. Additionally, it publishes the dist
dir from the tree to docs-draft, because the dist contents should be the
compiled, minified and fully-functional web code, and it should be directly
verifiable on a passing commit.

Change-Id: Id48ee2524d846b5e08ca94f485f8d67abbd3681a
This commit is contained in:
Monty Taylor 2014-01-19 09:26:58 -08:00 committed by Michael Krotscheck
parent da1465db09
commit c7403353b1
6 changed files with 82 additions and 23 deletions
modules
jenkins/files/slave_scripts
openstack_project/files

@ -0,0 +1,38 @@
#!/bin/bash -xe
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
command=$1
org=$2
project=$3
source /usr/local/jenkins/slave_scripts/functions.sh
check_variable_org_project "$org" "$project" "$0"
rm -f dist/*.tar.gz
venv=grunt
VDISPLAY=99
DIMENSIONS='1280x1024x24'
set +e
/usr/bin/Xvfb :${VDISPLAY} -screen 0 ${DIMENSIONS} 2>&1 > /dev/null &
DISPLAY=:${VDISPLAY} tox -e$venv $command
result=$?
pkill Xvfb 2>&1 > /dev/null
set -e
exit $result

@ -0,0 +1,33 @@
- job-template:
name: 'gate-{name}-js-unittests'
wrappers:
- timeout:
timeout: 40
fail: true
- timestamps
builders:
- gerrit-git-prep
- js-build:
command: 'test'
envlist: 'grunt'
github-org: '{github-org}'
project: '{name}'
- assert-no-extra-files
publishers:
- console-log
- coverage-log
- scp:
site: 'static.openstack.org'
files:
- target: 'logs/$LOG_PATH'
source: 'reports/**'
keep-hierarchy: true
copy-after-failure: true
- target: 'docs-draft/$LOG_PATH'
source: 'dist/**'
keep-hierarchy: true
copy-after-failure: true
node: '{node}'

@ -131,6 +131,11 @@
builders:
- shell: "/usr/local/jenkins/slave_scripts/run-selenium.sh {github-org} {project}"
- builder:
name: js-build
builders:
- shell: "/usr/local/jenkins/slave_scripts/run-jsbuild.sh {command} {github-org} {project}"
- builder:
name: python26
builders:

@ -1063,6 +1063,7 @@
tarball-site: tarballs.openstack.org
jobs:
- gate-{name}-js-unittests
- 'storyboard-webclient-release-{branch-designator}':
branch-designator: 'master'
- 'storyboard-webclient-release-{branch-designator}':

@ -1,23 +1,3 @@
- job:
name: gate-storyboard-webclient-unittests
node: bare-precise
builders:
- gerrit-git-prep
- shell: |
./bin/bootstrap.sh
./bin/build.sh
publishers:
- console-log
- coverage-log
- scp:
site: 'static.openstack.org'
files:
- target: 'logs/$LOG_PATH'
source: 'reports/**'
keep-hierarchy: true
copy-after-failure: true
- job-template:
name: 'storyboard-webclient-release-{branch-designator}'
node: bare-precise
@ -50,4 +30,4 @@
copy-after-failure: true
- tarball:
project: '{name}'
site: '{tarball-site}'
site: '{tarball-site}'

@ -381,6 +381,8 @@ jobs:
branch: stable/grizzly
- name: ^gate-.*-docs$
success-pattern: http://docs-draft.openstack.org/{build.parameters[LOG_PATH]}/doc/build/html/
- name: gate-storyboard-webclient-js-unittests
success-pattern: http://docs-draft.openstack.org/{build.parameters[LOG_PATH]}/dist/
- name: infra-publications-publish
branch: ^(?!master).*$
- name: ^gate-.*-requirements$
@ -2634,9 +2636,9 @@ projects:
- name: openstack-infra/storyboard-webclient
check:
- gate-storyboard-webclient-unittests
- gate-storyboard-webclient-js-unittests
gate:
- gate-storyboard-webclient-unittests
- gate-storyboard-webclient-js-unittests
post:
- storyboard-webclient-release-branch
release: