language: generic

sudo: false
dist: trusty

branches:
  only:
  - master
  - "/\\d+\\.\\d+\\.?d*\\-*[a-z]*/"

addons:
  homebrew:
    packages:
    - lldb
    - gdb
env:
  global:
    secure: CVHlDL4GG6uDjvz9TceVjoeCSjO7KUPmcW1xHkLtUpdqVHdI0z7WhlULeZdugeqaaK9My37E5TvaJgVpW2fhCNguKJfVVWUE0khLB76dinWrio1BPaTxPKqI63tYFArHVqiLQMK2ZI7ZvnrUK+rlaNOkAMpczrZDXANZfVP73ksTGG4+252mWdUY0jRXJr+he4+uKI6l3Z6bd/GbIRfEIi4gfibZNLDLWvlbpyW3/jLy8yOSXuA5Ed0Oods/WGB/q+jQzJxFV9loWeEafvMpz6cjmgJ0ST3l5FA/ZzGzAtgH+fpXDAcUIFXrKciDF2YaFYhDvWF9d94swZYNXvWfAS/4cGMjgABX03nIcXZVz9iWfmi7/I5PE0O7xCjA2XOF7d1124h5y6oMbK+jV/+IzvmM4bQ295ixY84/G9okoV4Q6mSukVQ3zCK9saF2BC+oNP3SEkH+Sd5ZrsgFXDPK27RHV84Nj1xLiZ4F810v1nsw7afBUs8APts9uAMuyIhg6/4ir9S/OQ83Ox/3YlaL01+EzAliGkMmMZLvvISxgPk6TMsJxpN4ixirSuWOygRDpfMGwX2dYUw1v8qwfCkvEqMoKkfGhNY+YoCGlO0y3lslU4iaQElRwtrr8jCP3sS5f+9RvbPRvzKryI89MuqnqBq8w0JqYKPYy2OkCYLfzZg=

matrix:
  include:
  - name: "Python 3.9 - osx"
    env: PYTHON_VERSION=3.9
    os: osx
  - name: "Python 3.9 - linux"
    env: PYTHON_VERSION=3.9
    os: linux
  - name: "Python 3.7 - osx"
    env: PYTHON_VERSION=3.7
    os: osx
  - name: "Python 3.7 - linux"
    env: PYTHON_VERSION=3.7
    os: linux
  - name: "Python 3.8 - osx"
    env: PYTHON_VERSION=3.8
    os: osx
  - name: "Python 3.8 - linux"
    env: PYTHON_VERSION=3.8
    os: linux
  - name: "Lint"
    env: PYTHON_VERSION=3.7
    os: linux
    script:
    - pip install black==19.10b0
    - black . --diff --check
    - mypy cadquery

before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
      OS=Linux ;
  else
      OS=MacOSX ;
  fi ;
  wget https://repo.anaconda.com/miniconda/Miniconda3-latest-$OS-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda;
- export PATH="$HOME/miniconda/bin:$HOME/miniconda/lib:$PATH";
- conda config --set always_yes yes --set changeps1 no;
- conda env create -f environment.yml
- source ~/miniconda/bin/activate cadquery
- conda install -c conda-forge -c defaults -c cadquery python=$PYTHON_VERSION mypy
- pip install git+https://github.com/CadQuery/OCP-stubs.git@7.5.1

install:
- python setup.py install

before_script:
- ulimit -c unlimited -S
- sudo rm -f /cores/core.*

script:
- pytest -v --cov

after_success:
- codecov

after_failure:
- ls /cores/core.*
- lldb --core `ls /cores/core.*` --batch --one-line "bt"
