4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

travis-ciでOS XとLinuxの環境でMinicondaを使ってPythonのテストをする

Posted at

Travisは長らくlanguage: pythonOSXのビルドが壊れているので、language: cで戦わなければならない。

https://github.com/chezou/fastFM/blob/travis-conda/.travis.yml に実際のymlがあるが、
だいたいこんな感じで書く。

envでPythonのバージョンをベタベタっと書いていく感じ。

.travis.yml
language: c

env:
    - TRAVIS_PYTHON_VERSION="2.7"
    - TRAVIS_PYTHON_VERSION="3.5"

os:
    - linux
    - osx

before_install:
    - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; fi
    - # install some brew package
    - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq;  fi
    - # install some apt package
    - if [[ "$TRAVIS_PYTHON_VERSION" =~ "^2" ]]; then
        if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
          wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
        else
          wget https://repo.continuum.io/miniconda/Miniconda-latest-MacOSX-x86_64.sh -O miniconda.sh;
        fi
      else
        if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
          wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
        else
          wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
        fi
      fi
    - bash miniconda.sh -b -p $HOME/miniconda
    - export PATH="$HOME/miniconda/bin:$PATH"
    - hash -r
    - conda config --set always_yes yes --set changeps1 no
    - conda update -q conda
    # Useful for debugging any issues with conda
    - conda info -a
    - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION # some needed packages
    - source activate test-environment

install:
    - pip install .

script:
    - nosetests

辛いけど、Cythonとか使うコードのテストはMiniconda使わないとCIに20分とかかかるので、しかたない。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?