From 5d6102de6c4440c43ccf2e9932bc02481ea34295 Mon Sep 17 00:00:00 2001 From: "Bruno P. Kinoshita" Date: Fri, 16 Nov 2018 10:57:17 +1300 Subject: [PATCH] Remove unnecessary scripts, and add other adjustments for build speed --- .travis.yml | 45 +++++++++++++++++++++------------------ .travis/after_script.sh | 4 ---- .travis/before_install.sh | 36 ------------------------------- .travis/install.sh | 37 ++++++++++++++++++++------------ 4 files changed, 47 insertions(+), 75 deletions(-) delete mode 100755 .travis/before_install.sh diff --git a/.travis.yml b/.travis.yml index de3b1ced19b..93eba47c69a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,43 +26,46 @@ --- language: python -sudo: required -dist: trusty +cache: pip +virtualenv: + # we need system packages in Travis-CI's virtualenv in order to access pygtk, installed via apt-get + system_site_packages: true +dist: xenial +addons: + apt: + # instruct travis-ci to always run apt-get before each build + update: true stages: - unit-test - test env: -- CHUNK="1/4" -- CHUNK="2/4" -- CHUNK="3/4" -- CHUNK="4/4" + global: + - PATH="${TRAVIS_BUILD_DIR}/bin:$PATH" + # Only run the generic tests on Travis CI. + - CYLC_TEST_RUN_PLATFORM=false + # Custom diff command to ignore Xlib errors (xvfb has not RANDR extension). + - CYLC_TEST_DIFF_CMD="diff -I Xlib -u" + matrix: + - CHUNK="1/4" + - CHUNK="2/4" + - CHUNK="3/4" + - CHUNK="4/4" -before_install: .travis/before_install.sh -install: .travis/install.sh +# this is the default test stage, which is used for functional-tests +install: .travis/install.sh functional-tests docs script: -- source ~/.bashrc -# Custom diff command to ignore Xlib errors (xvfb has not RANDR extension). -- export CYLC_TEST_DIFF_CMD='diff -I Xlib -u' -# Only run the generic tests on Travis CI. -- export CYLC_TEST_RUN_PLATFORM=false # Run tests with virtual frame buffer for X support. - xvfb-run -a cylc test-battery --chunk $CHUNK --state=save -j 5 || (echo -e "\n\nRerunning Failed Tests...\n\n"; cylc test-battery --state=failed -j 5) - - after_script: .travis/after_script.sh jobs: include: - stage: unit-test - before_install: .travis/before_install.sh install: - - .travis/install.sh - # these dependencies are necessary only for the unit tests - - source ~/.bashrc - - pip install pycodestyle pytest mock + - .travis/install.sh unit-tests script: - - source ~/.bashrc - pycodestyle --ignore=E402,W503,W504 lib/cylc lib/Jinja2Filters/*.py lib/parsec/*.py $(grep -l '#!.*\' bin/*) - PYTHONPATH=$(pwd -P)/lib/ pytest lib/cylc/ + after_script: true diff --git a/.travis/after_script.sh b/.travis/after_script.sh index 36e362ca40d..4f3f846a626 100755 --- a/.travis/after_script.sh +++ b/.travis/after_script.sh @@ -16,13 +16,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -set -x - # Travis-CI after_script # Check output (more useful if you narrow down what tests get run) -source ~/.bashrc - find $HOME/cylc-run -name '*.err' -type f -exec echo '==== {} ====' \; -exec cat '{}' \; find /tmp/${USER}/cylctb-* -type f -exec echo '==== {} ====' \; -exec cat '{}' \; diff --git a/.travis/before_install.sh b/.travis/before_install.sh deleted file mode 100755 index a13a52cd5bc..00000000000 --- a/.travis/before_install.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -# THIS FILE IS PART OF THE CYLC SUITE ENGINE. -# Copyright (C) 2008-2018 NIWA & British Crown (Met Office) & Contributors. -# -# 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 . - -set -x - -# Travis-CI before_install - -# Clear bashrc - the default does nothing if not in an interactive shell. -# SSH connections use the ~/.bashrc file for their environment, so we'll be -# loading our python environment here. - -echo > ~/.bashrc - -# Setup virtualenv (using system packages for pygtk as pip won't install it) - -virtualenv --system-site-packages $HOME/virtualenv/cylc -echo "source $HOME/virtualenv/cylc/bin/activate" >> ~/.bashrc - -# Make sure Cylc is in PATH when running jobs - -echo "export PATH=$PWD/bin:\$PATH" >> ~/.bashrc diff --git a/.travis/install.sh b/.travis/install.sh index 38069526348..593118418f9 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -16,25 +16,34 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -set -x +set -eu +set -o xtrace +shopt -s extglob # Travis-CI install -source ~/.bashrc +args=("$@") -# Setup local SSH for Cylc jobs +# pygtk via apt-get, necessary for both unit and functional tests +sudo apt-get install graphviz libgraphviz-dev python-gtk2-dev heirloom-mailx +# install dependencies required for running unit tests +if grep 'unit-tests' <<< "${args[@]}"; then + pip install EmPy pyopenssl pycodestyle pytest mock +# install dependencies required for running functional tests +elif grep 'functional-tests' <<< "${args[@]}"; then + # pygraphviz needs special treatment to avoid an error from "from . import release" + pip install EmPy pyopenssl pygraphviz \ + --install-option="--include-path=/usr/include/graphviz" \ + --install-option="--library-path=/usr/lib/graphviz/" +fi + +# install dependencies required for building documentation, only when instructed to do so +if grep 'docs' <<< "${args[@]}$"; then + sudo apt-get install texlive-latex-base +fi + +# configure local SSH for Cylc jobs ssh-keygen -t rsa -f ~/.ssh/id_rsa -N "" -q cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys ssh-keyscan -t rsa localhost >> ~/.ssh/known_hosts - -# Install dependencies - -sudo apt-get update -qq -sudo apt-get install build-essential texlive-latex-base -sudo apt-get install at python-pip python-dev graphviz libgraphviz-dev python-gtk2-dev heirloom-mailx - -# Pygraphviz needs special treatment to avoid an error from "from . import release" - -pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/" -pip install EmPy pyopenssl