From 9b7bab3d685c4a3c5559983a9b14b7446959a6c4 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 9 Aug 2016 15:58:22 -0400 Subject: [PATCH] jjb: Add barectf Signed-off-by: Michael Jeanson --- jobs/barectf.yaml | 112 ++++++++++++++++++++++++++++++++++++++ scripts/barectf/build.sh | 51 +++++++++++++++++ scripts/barectf/pylint.sh | 43 +++++++++++++++ 3 files changed, 206 insertions(+) create mode 100644 jobs/barectf.yaml create mode 100755 scripts/barectf/build.sh create mode 100755 scripts/barectf/pylint.sh diff --git a/jobs/barectf.yaml b/jobs/barectf.yaml new file mode 100644 index 0000000..05294ba --- /dev/null +++ b/jobs/barectf.yaml @@ -0,0 +1,112 @@ +- defaults: + name: barectf + description: | + barectf + is a command-line utility which generates C99 code that is able to write + native Common Trace Format (CTF) binary streams. + +

Job is managed by Jenkins Job Builder.

+ + project-type: freestyle + + wrappers: + - workspace-cleanup + - timestamps + - ansicolor: + colormap: xterm + # - credentials-binding: + # - username-password-separated: + # credential-id: barectf_codecov_token + # username: CODECOV_PROJECT_NAME + # password: CODECOV_TOKEN + + scm: + - git: + url: git://github.com/{github_user}/{github_name}.git + browser: githubweb + browser-url: https://github.com/{github_user}/{github_name} + branches: + - origin/{version} + basedir: src/barectf + skip-tag: true + + triggers: + - pollscm: + cron: "@hourly" + + properties: + - build-discarder: + num-to-keep: 2 + - github: + url: https://github.com/{github_user}/{github_name} + + +## Templates +- job-template: + name: barectf_{version}_build + defaults: barectf + + project-type: matrix + node: 'master' # Applies only to matrix flyweight task + axes: + - axis: + type: slave + name: arch + values: '{obj:arch}' + + builders: + - shell: + !include-raw-escape: scripts/barectf/build.sh + + publishers: +# - archive: +# artifacts: 'build/**' +# allow-empty: false + - ircbot: + strategy: new-failure-and-fixed + matrix-notifier: only-parent + channels: + - name: '#lttng' + + +- job-template: + name: barectf_{version}_pylint + defaults: barectf + node: 'x86-64' + + triggers: + - pollscm: + cron: "@daily" + + builders: + - shell: + !include-raw-escape: scripts/barectf/pylint.sh + + publishers: + - archive: + artifacts: 'pep8.out,pylint.out' + - violations: + pep8: + pattern: pep8.out + min: 10 + max: 999 + unstable: 999 + pylint: + pattern: pylint.out + min: 10 + max: 999 + unstable: 999 + + +## Project +- project: + name: barectf + github_user: efficios + github_name: barectf + version: + - master + jobs: + - 'barectf_{version}_build': + arch: !!python/tuple [x86-32, x86-64] + - 'barectf_{version}_pylint' + diff --git a/scripts/barectf/build.sh b/scripts/barectf/build.sh new file mode 100755 index 0000000..5eafb08 --- /dev/null +++ b/scripts/barectf/build.sh @@ -0,0 +1,51 @@ +#!/bin/sh -exu +# +# Copyright (C) 2015 - Michael Jeanson +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Has to be set in the environment +#CODECOV_TOKEN="" + +SRCDIR="src/barectf" + +PYTHON3="python3" +P3_VERSION=$($PYTHON3 -c "import sys;print(sys.version[:3])") +PYENV_HOME=$WORKSPACE/.pyenv/ + +# Delete previously built virtualenv +if [ -d "$PYENV_HOME" ]; then + rm -rf "$PYENV_HOME" +fi + +# Create virtualenv and install necessary packages +virtualenv --system-site-packages -p $PYTHON3 "$PYENV_HOME" + +set +u +. "$PYENV_HOME/bin/activate" +set -u + +# install setuptools first +pip install setuptools + +cd "$SRCDIR" + +# install barectf in virtual environment +./setup.py install + +# test +cd tests +./test.bash + +# EOF diff --git a/scripts/barectf/pylint.sh b/scripts/barectf/pylint.sh new file mode 100755 index 0000000..e142b1c --- /dev/null +++ b/scripts/barectf/pylint.sh @@ -0,0 +1,43 @@ +#!/bin/sh -exu +# +# Copyright (C) 2016 - Michael Jeanson +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +SRCDIR="src/barectf" + +PYTHON3="python3" +P3_VERSION=$($PYTHON3 -c "import sys;print(sys.version[:3])") +PYENV_HOME=$WORKSPACE/.pyenv/ + +# Delete previously built virtualenv +if [ -d "$PYENV_HOME" ]; then + rm -rf "$PYENV_HOME" +fi + +# Create virtualenv and install necessary packages +virtualenv --system-site-packages -p $PYTHON3 "$PYENV_HOME" + +set +u +. "$PYENV_HOME/bin/activate" +set -u + +pip install --quiet pylint +pip install --quiet pep8 + +cd "$SRCDIR" + +pep8 barectf | tee "$WORKSPACE/pep8.out" + +pylint -f parseable --ignore="_version.py" --disable=C0111 barectf | tee "$WORKSPACE/pylint.out" -- 2.34.1