Giter Club home page Giter Club logo

ci-helpers's Introduction

Important notices

This package is no longer actively developed. Please read on below for service-specific information.

Travis CI

Astropy Project has decided to move away from Travis CI after they dropped support for OSS by removing their free-tier plan. Please see this announcement for more information. We recommend switching to GitHub Actions instead; you can see an example of it on astropy and on package template.

Appveyor

Scripts for appveyor.yml for the AppVeyor service are no longer supported. Please use the Windows build on Travis instead.

For the usage of the deprecated scripts see Appveyor scripts README.

About

This repository contains a set of scripts that are used by the .travis.yml file of Astropy packages for the Travis service.

The idea is to clone these at the last minute when the continuous integration is about to be run. This is better than including this repository as a Git sub-module, because this allows updates to this repository to take effect immediately, and not have to update the Git sub-module every time a change is made.

How to use

Travis (with conda)

Note that you can also set up Python without conda using ci-helpers - see here for more details

Include the following lines at the start of the install section in .travis.yml:

install:
    - git clone --depth 1 git://github.com/astropy/ci-helpers.git
    - source ci-helpers/travis/setup_conda.sh

This does the following:

  • Set up Miniconda.
  • Set up the PATH appropriately.
  • Set up a conda environment named 'test' and switch to it.
  • Set the always_yes config option for conda to true so that you don't need to include --yes.
  • Register the specified channels.
  • export PYTHONIOENCODING=UTF8
  • Supports custom skip tags included in the commit message that are not yet natively provided by Travis. To run only the docs build: [build docs] or [docs only]. The latter requires SETUP_CMD (see below) to be set to build_docs or build_sphinx.

Following this, various dependencies are installed depending on the following environment variables

  • MAIN_CMD: if this starts with pycodestyle, flake, or pylint then the only package that gets installed is the pycodestyle, flake, or pylint package. Please note that the former name of the pycodestyle package is pep8, and ci-helpers still accepts it, too.

  • SETUP_CMD: this can be set to various values:

    • egg_info: no dependencies are installed once the conda environment has been created and any other environment variables are ignored.

    • build_docs or build_sphinx: the Sphinx and matplotlib packages are installed in addition to other packages that might be requested via other environment variables.

    • test: runs the test suite after the dependencies are installed.

    In addition, if SETUP_CMD contains the following flags, extra dependencies are installed:

    • --coverage: the coverage, coveralls, and codecov packages are installed
    • -cov: the pytest-cov, coveralls, and codecov packages are installed
    • --parallel or --numprocesses: the pytest-xdist package is installed
    • --open-files: the psutil package is installed
  • MAMBA: if set to True, conda packages will be installed with mamba <https://github.com/mamba-org/mamba>_, which is both faster than conda and gives more readable errors in cases where there are conflicts.

  • NUMPY_VERSION: if set to dev or development, the latest developer version of Numpy is installed along with Cython. If set to a version number, that version is installed. If set to stable, install the latest stable version of Numpy. If set to prerelease, the pre-release version of Numpy gets installed if there is any, otherwise the build exits and passes on Travis without running the tests. We try to avoid downloading and installing mkl, so unless mkl is specified as a dependency in CONDA_DEPENDENCIES, nomkl is used. On Windows the is only MKL, so while the nomkl package exists it does nothing, mkl is always needed to be installed.

  • ASTROPY_VERSION: if set to dev or development, the latest developer version of Astropy is installed, along with Cython and jinja2, which are compile-time dependencies. If set to a version number, that version is installed. If set to stable, install the latest stable version of Astropy. If set to prerelease, the pre-release version of Astropy gets installed if there is any, otherwise the build exits and passes on Travis without running the tests. If set to lts the latest long term support (LTS) version is installed (more info about LTS can be found here.

  • SUNPY_VERSION: if set to dev or development, the latest developer version of Sunpy is installed. If set to a version number, that version is installed. If set to stable, install the latest stable version of Sunpy. If set to prerelease, the pre-release version of Sunpy gets installed if there is any, otherwise the build exits and passes on Travis without running the tests.

  • MINICONDA_VERSION: This sets the version of Miniconda that will be installed. Use this to override a pinned version if necessary.

  • CONDA_DEPENDENCIES: this should be a space-separated string of package names that will be installed with conda. Version numbers of these dependencies can be overridden/specified with the PACKAGENAME_VERSION environment variables.

  • PIP_DEPENDENCIES: this should be a space-separated string of package names that will be installed with pip.

  • CONDA_DEPENDENCIES_FLAGS: additional flags to pass to conda when installing CONDA_DEPENDENCIES

  • PIP_DEPENDENCIES_FLAGS: additional flags to pass to pip when installing PIP_DEPENDENCIES

  • CONDA_CHANNELS: this should be a space-separated string of conda channel names. We don't add any channel by default.

  • CONDA_ENVIRONMENT: this is a path to a file that should be used with conda env create -f $CONDA_ENVIRONMENT. This is applied to set up the test environment before the conda and pip dependencies (which otherwise act additively with this option).

  • DEBUG: if True this turns on the shell debug mode in the install scripts, and provides information on the current conda install and switches off the -q conda flag for verbose output.

  • SETUP_XVFB: if True this makes sure e.g., interactive matplotlib backends work by starting up a X virtual framebuffer.

  • MPLBACKEND: If not specified it is set to Agg as the default backend.

  • PACKAGENAME_VERSION: PACKAGENAME is the name of the package to specify the version for (e.g. MATPLOTLIB_VERSION). Due to shell limitations, all hyphens in the conda package name should be changed to underscores in PACKAGENAME_VERSION (e.g. for scikit-image it should be SCIKIT_IMAGE_VERSION). If specified it will override any version number limitations listed in CONDA_DEPENDENCIES.

  • CONDA_CHANNEL_PRIORITY: can be set to strict, flexible or disabled, and affects the channel_priority conda setting (as discussed here. The default is disabled.

  • EVENT_TYPE: this should be a space-separated string of event types. If given, the build will run only if the TRAVIS_EVENT_TYPE matches with any of the listed ones. Otherwise the build exits and passes on Travis without running the tests. This is a way to control builds to run only on pushes to main, or for Travis cron jobs. Valid event types are: push, pull_request, api or cron.

  • PIP_FALLBACK: the default behaviour is to fall back to try to pip install a package if installing it with conda fails for any reason. Set this variable to false to opt out of this.

  • RETRY_ERRORS: a space-separated string of error names. If not set, this will default to RETRY_ERRORS="CondaHTTPError". When package installation via conda fails, the respective command's output (stdout and stderr) is searched for the strings in RETRY_ERRORS. If any of these is found, the installation will be automatically retried.

  • RETRY_MAX: an integer specifying the maximum number of automatic retries. If not set, this will default to RETRY_MAX=3. Setting RETRY_MAX to zero will disable automatic retries.

  • RETRY_DELAY: a positive integer specifying the number of seconds to wait before retrying. If not set, this will default to RETRY_DELAY=2.

  • MACOSX_DEPLOYMENT_TARGET (OSX only): If left blank, the minimum OSX target version for LLVM/Clang builds will be set to 10.9. If set to "clang_default", determining the minimum OSX target version is left to LLVM/Clang. If set to any different value, that value will be used.

The idea behind the MAIN_CMD and SETUP_CMD environment variables is that the script section of the .travis.yml file can be set to:

script:
    - $MAIN_CMD $SETUP_CMD

The typical usage will then be to set MAIN_CMD to default to python setup.py and then set SETUP_CMD='test', and this then allows special builds that have MAIN_CMD='pycodestyle' and SETUP_CMD=''.

Packages can also choose to not use the MAIN_CMD variable and instead to set the script section to:

script:
    - python setup.py $SETUP_CMD

and simply adjust SETUP_CMD as needed.

Following the set-up, if additional packages need to be installed, the CONDA_INSTALL environment variable should be used to make sure that the Python and Numpy versions stay fixed to those requested, e.g.

- $CONDA_INSTALL another_package

Setting up Python without conda on Travis

We also provide a script to set up Python on MacOS X and Windows without making use of conda. To use this include the following lines at the start of the install section in .travis.yml:

install:
    - git clone --depth 1 git://github.com/astropy/ci-helpers.git
    - source ci-helpers/travis/setup_python.sh

You will need to set the PYTHON_VERSION environment variable to the major.minor version of Python that you want to have installed (e.g. 3.8)

The script does nothing on Linux, so it is safe to call as above without special casing the operating system. On Linux, you should instead use language: python provide the Python version with python: ....

The script also sets up a virtual environment using venv and upgrades pip to the latest version, but does not install any other packages. This is deliberate as we want to keep this script as minimal as possible.

pip pinnings

We also provide a file called pip_pinnings.txt which contains any version pins we currently recommend. This file is in the pip requirements format. Often this file will be empty if no pinnings are recommended. This file is suitable for use with any tools that understand pip requirements files, including for example tox-pypi-filter.

Utils

A directory to collect all kinds of useful scripts to be used during various CI runs.

  • import_submodules.py - utility script to make it possible to test importing submodules when optional dependencies, including pytest, are missing.

Details

The scripts include:

  • travis/setup_dependencies_common.sh - set up conda packages on Linux and MacOS X
  • travis/setup_conda.sh - set up conda on MacOS X or Linux, users should use this directly rather than the OS specific ones below
  • travis/setup_conda_linux.sh - set up conda on Linux
  • travis/setup_conda_osx.sh - set up conda on MacOS X
  • travis/setup_python.sh - set up Python on MacOS X and Windows without conda

This repository can be cloned directly from the .travis.yml file when about to run tests and does not need to be included as a Git sub-module in repositories.

ci-helpers's People

Contributors

astrofrog avatar bsipocz avatar cadair avatar danryanirish avatar djhoese avatar dpshelio avatar drdavella avatar embray avatar eteq avatar gitter-badger avatar kain88-de avatar larrybradley avatar larsoner avatar matteobachetti avatar mwcraig avatar nabobalis avatar njzjz avatar pllim avatar qulogic avatar rth avatar weaverba137 avatar zemanj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ci-helpers's Issues

Add mpl setup as an opt-in

Comment from @cdeil:
"Many packages need this. Move this to ci-helpers and make it opt-in, i.e. execute these commands if the user sets something like SETUP_DISPLAY_FOR_MATPLOTLIB?"

This refers to the setup needed for mpl:

# Make sure that interactive matplotlib backends work
export DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;

What do you think @astrofrog? Would this work for both the linux an osx builds? For the latter I saw packages prefer to use pyqt rather than pyside, but do we want hardwire such things?

Add option to remove ``-q`` flag for conda

In some cases, people might want to not have conda builds be quiet, so maybe we can add an env variable (or simply re-use $DEBUG) to indicate that we want verbose output from conda.

Make sure version pinning works for numpy and astropy when in CONDA_DEPENDENCIES

They are not designed to be listed in CONDA_DEPENDENCIES and if one of the string versions were used in e.g. ASTROPY_VERSION, the version pinning fails the build.

This issue came up with Chandra-MARX/marxs#62, here is a travis log snippet:

++++CONDA_DEPENDENCIES='numpy scipy astropy cffi sphinx matplotlib'

++++[[ True == True ]]

++++cat /home/travis/miniconda/envs/test/conda-meta/pinned

numpy stable*

scipy

astropy stable*

cffi

sphinx

matplotlib

++++echo numpy scipy astropy cffi sphinx matplotlib

numpy scipy astropy cffi sphinx matplotlib

++++[[ stable == dev* ]]

++++[[ stable == stable ]]

++++conda install numpy

Fetching package metadata: ..........

Solving package specifications: .

Error:  Packages missing in current linux-64 channels: 

  - numpy stable*

  - astropy stable*

coverage travis job is broken

For example: https://travis-ci.org/astropy/astropy/jobs/106803692

usage: coveralls [-h] [--verbose] [--dryrun] [--gcov FILE]
                 [--gcov-options GCOV_OPTS] [-r DIR] [-b DIR] [-e DIR|FILE]
                 [-i DIR|FILE] [-E REGEXP] [-x EXT] [-y FILE] [-n] [-t TOKEN]
                 [--encodings ENCODINGS [ENCODINGS ...]] [--dump [FILE]]
                 [--follow-symlinks]

coveralls: error: unrecognized arguments: --merge=c-coveralls.json --rcfile=astropy/tests/coveragerc

It seems that the coveralls command here is the one from the cpp-coveralls package (ahah, good joke : https://github.com/eddyxu/cpp-coveralls/blob/master/setup.py#L47), not the one from coveralls.

And the reason why it breaks now is probably #60 ? Comparing with a succesful job, cpp-coveralls was installed before coverage/coveralls.

Travis failing on sphinx stage and astropy lts python3.5

@bsipocz and @pllim
I still have a couple of tests failing due to conda ci issues:
https://travis-ci.org/LCOGT/banzai/jobs/139364978

https://travis-ci.org/LCOGT/banzai/jobs/139364982

Fetching package metadata .............
Solving package specifications: ....
The following specifications were found to be in conflict:

  • astropy 1.0* -> numpy 1.10_|1.6_|1.7_|1.8_|1.9*
  • astropy 1.0* -> python 2.6_|2.7_|3.3_|3.4_
  • python 3.5*
    Use "conda info " to see the dependencies for each package.

The other builds pass: https://travis-ci.org/LCOGT/banzai/builds/139364970

Thanks for your help.

Force dependency reinstall?

I was testing a setup using old numpy (1.7), and with the following dependencies. Since the latest conda version of scipy for this numpy is 0.13, it had been moved to be installed with pip to get a recent version. However as scikit-image was also a dependency, scipy was installed via the conda steps and PIP_DEPENDENCIES had no effect whatsoever. As a workaround I've moved scikit-image and cython to the PIP_DEPENDENCIES, too, but wonder whether ci-helpers could be cleaver.

       - PIP_DEPENDENCIES='scipy'
       - CONDA_DEPENDENCIES='Cython scikit-image matplotlib'

pep8 is now pycodestyle

The pep8 package has been renamed to pycodestyle, so we should make sure we take that into account in the future (probably not urgent)

AppVeyor 3.5 failure

I realized that the python 3.5 appveyor build seems to fail with "Error code 1" (see for example here)

There was a new msvc_runtime build on conda (yesterday or tonight) and it seems likely that this is somehow connected. But I cannot reproduce it locally - maybe because I'm using mkl 11.3.3 and some other packages that aren't installed in AppVeyor - so I can't investigate it.

Appveyor fail?

Just ran into this issue

git clone git://github.com/astropy/ci-helpers.git
Cloning into 'ci-helpers'...
powershell ci-helpers/appveyor/install-miniconda.ps1
Installing miniconda latest for -x64 bit architecture to C:\conda
Downloading Miniconda-latest-Windows-x86_64.exe from https://repo.continuum.io/miniconda/Miniconda-latest-Windows-x86_64.exe
Exception calling "DownloadFile" with "2" argument(s): "The request was 
aborted: Could not create SSL/TLS secure channel."
At C:\projects\qtawesome\ci-helpers\appveyor\install-miniconda.ps1:45 char:8
+        $webclient.DownloadFile($url, $filepath)
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException

Installing C:\projects\qtawesome\Miniconda-latest-Windows-x86_64.exe to C:\conda
C:\projects\qtawesome\Miniconda-latest-Windows-x86_64.exe /InstallationType=AllUsers /S /AddToPath=1 /RegisterPython=1 /D=C:\conda
Start-Process : This command cannot be run due to the error: The system cannot 
find the file specified.
At C:\projects\qtawesome\ci-helpers\appveyor\install-miniconda.ps1:65 char:5
+     Start-Process -FilePath $filepath -ArgumentList $args -Wait -Pass ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOp 
   erationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.C 
   ommands.StartProcessCommand

Failed to install Python in C:\conda
Command exited with code 1

Is this an appveyor thing?

Issue if e.g. 'stable' is used in global environment variables

If I write e.g.

NUMPY_VERSION=stable

in the global environment variables, the pinned file will contain:

numpy stable*

The conda command then crashes later because it can't find that version. I think this is not really a big issue because really writing

NUMPY_VERSION=stable

is redundant as long as numpy is in the CONDA_DEPENDENCIES, but we should probably still fix this in the long run.

Appveyor downloads unexistent miniconda

Astropy's appveyor has been failing for a few days. It seems that the miniconda file it tries to download doesn't exists any more and while the same url perfectly works for the other packages, it's consistently broken for astropy and when trying download manually. I'm not sure why it's still working for the other packages, we don't use the cache in the template, but I guess it will brake there, too sometimes soon.

Build started
git clone -q --branch=master https://github.com/astropy/astropy.git C:\projects\astropy
git checkout -qf 5d3b7103f5805a22befba6a7ff3cd52b178c9611
Running Install scripts
git clone git://github.com/astropy/ci-helpers.git
Cloning into 'ci-helpers'...
powershell ci-helpers/appveyor/install-miniconda.ps1
Installing miniconda latest for -x64 bit architecture to C:\conda
Downloading Miniconda-latest-Windows-x86_64.exe from https://repo.continuum.io/miniconda/Miniconda-latest-Windows-x86_64.exe
Exception calling "DownloadFile" with "2" argument(s): "The remote server 
returned an error: (404) Not Found."
At C:\projects\astropy\ci-helpers\appveyor\install-miniconda.ps1:47 char:8
+        $webclient.DownloadFile($url, $filepath)
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException
 
Installing C:\projects\astropy\Miniconda-latest-Windows-x86_64.exe to C:\conda
C:\projects\astropy\Miniconda-latest-Windows-x86_64.exe /InstallationType=AllUsers /S /AddToPath=1 /RegisterPython=1 /D=C:\conda
Start-Process : This command cannot be run due to the error: The system cannot 
find the file specified.
At C:\projects\astropy\ci-helpers\appveyor\install-miniconda.ps1:67 char:5
+     Start-Process -FilePath $filepath -ArgumentList $args -Wait -Pass ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOp 
   erationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.C 
   ommands.StartProcessCommand
 
Failed to install Python in C:\conda
Command exited with code 1

Improved testing

We should make sure that the tests in this repository cover all possibilities, since this package is going to have to be very robust. I started adding more tests in #7 but we need to make sure all routes are covered, and that we do the same for AppVeyor.

Travis builds can't find libgfortran even though it is installed.

Lately I have been seeing Travis builds failing because:

E   ImportError: libgfortran.so.1: cannot open shared object file: No such file or directory

For example: https://travis-ci.org/weaverba137/pydl/jobs/115556329

My .travis.yml file includes:

- CONDA_DEPENDENCIES='libgfortran scipy matplotlib'

and the output of source ci-helpers/travis/setup_conda_$TRAVIS_OS_NAME.sh appears to show that libgfortran is installed.

Any help would be appreciated.

Circle ci support

First of all thanks for the work on this.

I managed to (in a kinda hacky way) use the ci-helpers within circle ci for different versions of python (up to 4 different, and one per container)

Since every command in circle ci is its own shell, the path needs to be updated on every command (a bit annoying...!).

Also I had to use Travis names for the env variables which is fine, but we could perhaps expand on something like this¿
https://github.com/spyder-ide/qtpy/blob/master/circle.yml

Cheers

Specifying CONDA_DEPENDENCIES vs environment variables

The new system of specifying package versions via environment variables works nicely. However, there is a small difference in behavior between specifying them via environment variables and via the CONDA_DEPENDENCIES, i.e.

MATPLOTLIB_VERSION=1.3

vs

CONDA_DEPENDENCIES='matplotlib=1.3'

The first case results in the pinned file containing

matplotlib 1.3*

and the second:

matplotlib ==1.3

I think that the second case should also be changed to mean 1.3*, because that's normally how it works if we do conda install matplotlib=1.3 (1.3.1 could be installed)

Installing wrong version of packages

This was first reported in astropy/astropy#5094 (comment), the install process erroneously picked up the wrong numpy version (1.9.0b1) from the astropy-ci-extras conda channel rather than a stable released version (e.g. 1.9.3) from the default conda channel.

There are several issues with this, first we should never pick up a beta release unless asked for it with NUMPY_VERSION=prerelease. Also we should always pick up the latest available version of a given package.

As a side feature request: would be nice to find a way to specify the priority order of conda channels for cases when a package is available in several ones.

NUMPY_VERSION=prerelease Travis test errors out.

I needed to run a test against Numpy 1.12.0rc2. I tried running a Travis test with NUMPY_VERSION=prerelease, but the test exited prematurely (resulting in a Travis error rather than a failure). When I ran the test by hand, I found that the prerelease version was trying to load MKL libraries and failing. When I look at the setup_dependencies_common.sh file, I can see that nomkl is preinstalled for NUMPY_VERSION=dev* but not NUMPY_VERSION=pre*.

If this is intentional, how can I work around this problem?

Getting nagged to upgrade pip

I got nagged by both Travis CI and Appveyor to upgrade to pip 8.1.2. Here is an example message from Appveyor:

You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

On Travis, I am able to get rid of that message by doing:

install:
    - git clone git://github.com/astropy/ci-helpers.git
    - source ci-helpers/travis/setup_conda_$TRAVIS_OS_NAME.sh

    - pip install --upgrade pip

But this does not work on Appveyor:

install:
    - "git clone git://github.com/astropy/ci-helpers.git"
    - "powershell ci-helpers/appveyor/install-miniconda.ps1"
    - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
    - "activate test"

    - "python -m pip install --upgrade pip"

I see that it updates pip but then it still complains about the old version:

Successfully installed astropy-1.2.dev15418
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%
activate test
Deactivating environment "C:\conda"...
Activating environment "C:\conda\envs\test"...
python -m pip install --upgrade pip
Collecting pip
  Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB)
Installing collected packages: pip
  Found existing installation: pip 8.1.1
    Uninstalling pip-8.1.1:
      Successfully uninstalled pip-8.1.1
Successfully installed pip-8.1.2

Moving the upgrade command to before git clone git://github.com/astropy/ci-helpers.git also does not work.

Why am I getting these messages? Does ci-helpers set the pip version to 8.1.1 for some reason? Should there be extra command in ci-helpers to automatically upgrade pip?

Introduce fall-back onto pip if conda doesn't have recent version

Based on recent discussion in #97 #98 and on gitter, we will need an option to fall back on altrnative ways of installing a package is the version available on conda is too old.

E.g. if a build asks for 'stable' astropy version (currently we have v1.2rc1), then it's not OK to install v0.3 or v0.4 or even v1.0.3 from conda, but should go instead pip install v1.1.2

Show commands executed in setup scripts

Is it possible to change the setup so that the executed commands appear in the travis-ci log?

Currently only

$ source ci-helpers/travis/setup_conda_$TRAVIS_OS_NAME.sh

is displayed and then the output from the commands in that script, but not the commands themselves.
Example: https://travis-ci.org/astropy/ci-helpers/jobs/92443363#L268

This makes the logs very hard to read and makes it difficult to debug issues if one of those commands fails or doesn't do what one expects. It's cost me a few hours over the past year and it's always frustrating when issues happen at that stage.

On the other hand, the travis-ci part of the build log is usually very easy to read because the commands are printed and even highlighted / grouped in the build log.

I'm not familiar much with shell scripting, but there should be a flag / option to run these scripts so that commands are echoed before they are executed, no?

ASTROPY_VERSION=stable not recognized in AppVeyor?

I have the following setup in my appveyor.yml:

  global:
      PYTHON: "C:\\conda"
      MINICONDA_VERSION: "latest"
      CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci-helpers\\appveyor\\windows_sdk.cmd"
      PYTHON_ARCH: "64" # needs to be set for CMD_IN_ENV to succeed. If a mix
                        # of 32 bit and 64 bit builds are needed, move this
                        # to the matrix section.
      CONDA_DEPENDENCIES: "scipy matplotlib"
      NUMPY_VERSION: "1.9.1"
      ASTROPY_VERSION: "stable"

AppVeyor exits with

(...)
Fetching package metadata: ...... 
Error: No packages found in current win-64 channels matching: astropy stable*

You can search for this package on anaconda.org with

    anaconda search -t conda astropy stable*

You may need to install the anaconda-client command line client with

    conda install anaconda-client


SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%
(...)

Need to uninstall astropy from conda if re-installing stable with pip

If using ASTROPY_VERSION=stable, I think we should uninstall astropy from conda in the following block:

if [[ $ASTROPY_VERSION == stable ]]; then
    old_astropy=$(python -c "from distutils.version import LooseVersion;\
                  import astropy; import os;\
                  print(LooseVersion(astropy.__version__) <\
                  LooseVersion(os.environ['LATEST_ASTROPY_STABLE']))")

    if [[ $old_astropy == True ]]; then
        $PIP_INSTALL --upgrade --no-deps --ignore-installed astropy==$LATEST_ASTROPY_STABLE
    fi
fi

Otherwise, under some circumstances, the conda version takes precedence over pip.

Remove default channels (astropy, openastronomy, astropy-ci-extras)

At the moment four channels are used unless the user sets CONDA_CHANNELS. These are defaults, astropy-ci-extras, astropy, and openastronomy.

Recently we saw a few problems when a package is available in both astropy and openastronomy and still somehow the build ends in conflicts, e.g. https://travis-ci.org/radio-astro-tools/spectral-cube/jobs/147998479#L526

So I propose to remove openastronomy from the default channels (as we tend to host all of dependencies of the affiliates in astropy). Should any package needs something from that channel they can specify it in CONDA_CHANNELS.

Thoughs @astrofrog, @mwcraig?

Cython and jinja2 should not always be installed

I think that we might want to have a flag that indicates whether to install Cython and jinja2. Jinja2 is only required by the astropy core package, and Cython only by a small fraction of affiliated packages (+core).

Add environment name to ci-helper script?

This would allow to better integrate with other CI services like circle ci where the limit of containers is 4, hence a matrix consisting of more options would need to run several test on the same machine (create several different environments).

source ci-helpers/travis/setup_conda.sh "ENV-NAME"

Pinning packages version number to aviod upgrade

We had the issue that we coundn't fix the mpl version number to 1.5.0 in the photutils docs builds (astropy/photutils#318) as it always got upgraded.

The upgrade is due to https://github.com/astropy/ci-helpers/blob/master/travis/setup_dependencies_common.sh#L106 where mpl isn't inheriting the fixed version number.

We can have temporary workarounds like #41, or introduce version number enviroment variables (like we have for astropy and numpy alread) for all the packages that get installed as an instrastructural dependency (like sphinx and matplotlib).

However it may be the best to pin the version numbers of all the packages that are listed with a required version number in CONDA_DEPENDENCIES. I have a half baked hack for this, and will open a PR once I manage to get it work.

cc: @larrybradley @astrofrog

Testing affiliated packages that require scipy in Python 3.5

This issue was originally reported on astropy/package-template#165, but it was recommended to move it here.

I'd like to be able to run Travis tests in Python 3.5, but currently there is a package compatibility issue in anaconda that prevents the installation of scipy, which my package requires.

Below is a snippet of the Travis log for a recent build, showing the incompatibility report. You can also view the full log.

The following specifications were found to be in conflict:
  - matplotlib -> numpy 1.9*
  - matplotlib -> python 2.6*|2.7*|3.3*|3.4*
  - numpy 1.9* -> python 2.6*|2.7*|3.3*|3.4*
  - pip (target=pip-8.1.1-py35_1.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*
  - py (target=py-1.4.31-py35_0.tar.bz2) -> python 2.6*|2.7*|3.2*|3.3*|3.4*|3.5*
  - pytest (target=pytest-2.9.1-py35_0.tar.bz2) -> python 2.6*|2.7*|3.2*|3.3*|3.4*|3.5*
  - python 3.5*
  - scipy 0.14* -> numpy 1.9*
  - scipy 0.14* -> python 2.6*|2.7*|3.3*|3.4*
  - setuptools (target=setuptools-20.7.0-py35_0.tar.bz2) -> python 2.6*|2.7*|3.2*|3.3*|3.4*|3.5*
  - wheel (target=wheel-0.29.0-py35_0.tar.bz2) -> python 2.7*|3.3*|3.4*|3.5*
Use "conda info <package>" to see the dependencies for each package.

Avoid double download and install for dependencies

Ideally we want to install packages in a strict order.

  1. numpy
  2. astropy
  3. dependencies

However it seems that due to the existence of the version pin file, all the dependencies are picked up during the first step. This is suboptimal for several of our typical builds (e.g. when older astropy is required, or when the build is aborted as no numpy prerelease is available, etc.).

E.g. here is a build were only numpy needed to be installed, and then the build aborted as there is no prerelease. Then in reality everything gets installed before exiting.
https://travis-ci.org/astropy/astroquery/jobs/150718956#L685

This is an LTS astropy build, yet 1.2.1 is installed first and then downgraded:
https://travis-ci.org/astropy/astroquery/jobs/150718941#L544

It's not yet clear what is an optimal workaround. To ignore the pin file, we could use e.g. --no-pin. Maybe adding it to the first, the numpy builds would be enough. Then most of the astropy version checking can be added to the pin file, too.

@astrofrog - Do you have a better idea or preference?

Docmentation Build Fail

Hi, I don't know if I have missed something, but this is rather annoying:

https://travis-ci.org/sunpy/sunpy/jobs/139200223#L606

# All requested packages already installed.
# packages in environment at /home/travis/miniconda/envs/test:
#
astropy                   1.2                 np111py27_0  
numpy                     1.11.0          py27_blas_openblas_200  [blas_openblas]  conda-forge
python                    2.7.11                        0  
Due to a matplotlib issue (#5836), the version for the
            sphinx builds needs to be !=1.5.1. This may override the version
            number specified in 
Fetching package metadata ............
Solving package specifications: ....
The following specifications were found to be in conflict:
  - matplotlib !=1.5.1
  - python 2.7*
Use "conda info <package>" to see the dependencies for each package.

it seemed to be working fine before...

Multiple packages in PIP_DEPENDENCIES gives error on appveyor

It seems there is a bug with PIP_DEPENDENCIES on appveyor.

Invalid requirement: 'keyring aplpy pyregion'
Traceback (most recent call last):
  File "C:\conda\envs\test\lib\site-packages\pip\req\req_install.py", line 78, in __init__
    req = Requirement(req)
  File "C:\conda\envs\test\lib\site-packages\pip\_vendor\packaging\requirements.py", line 96, in __init__
    requirement_string[e.loc:e.loc + 8]))
InvalidRequirement: Invalid requirement, parse error at "'aplpy py'"
SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%
activate test
prepending C:\\conda\\envs\\test and C:\\conda\\envs\\test\\Library\\

https://ci.appveyor.com/project/Astropy/astroquery/build/1.0.24/job/to6reykyqnk5esxa#L142

Add option of skipping/running a subset of builds

Based on this conversation astropy/astropy#4556 (comment) (copied below), we may add an option of either skip (or run) a subset of the travis builds when there is a string pattern in the commit message.

I'm not sure which approach is better, given that many times even [ci skip] is not used optimally. However before implementing anything, we need to decide whether this is needed, and which approach (run or skip) to go with (or can do both).

mhvk commented 12 hours ago
Agreed that we should not build both! Indeed, in principle, I think it would be nice to reduce the tests run for PRs to a smaller subset, and only run a full suite before actual merging. But not sure that is possible (and easy).

bsipocz commented 11 hours ago
I think it shouldn't be too difficult to add an env variable to ci-helpers that makes sure that the tests are only run when the commit message contains a certain keyword (e.g. Merge pull request (as that is included in all PR merge, or something like [full tests] or [full suite], etc).

I'm cc-ing for brainstorming whoever may be interested in this for astropy and other packages.
@astrofrog @mhvk @eteq @cdeil @Cadair

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.