jobs:
- job: Linux_CI
  displayName: 'Linux CI'
  pool:
    vmImage: 'Ubuntu 16.04'
  strategy:
    matrix: 
      Py27:
        python: 'python2.7'
        make_venv: 'python2.7 -m virtualenv venv'
        venv_pkg: 'python-virtualenv'
      Py36:
        python: 'python3.6'
        make_venv: 'python3.6 -m venv venv'
        venv_pkg: 'python3.6-venv'
      Py37:
        python: 'python3.7'
        make_venv: 'python3.7 -m venv venv'
        venv_pkg: 'python3.7-venv'
      Py38:
        python: 'python3.8'
        make_venv: 'python3.8 -m venv venv'
        venv_pkg: 'python3.8-venv'
    maxParallel: 4

  variables: {'PYTHONUNBUFFERED': '1'}

  steps:
  - checkout: self
    submodules: recursive

  - script: |
      sudo add-apt-repository -y ppa:deadsnakes/ppa
      sudo apt-get update
      sudo apt-get install -y build-essential
      sudo apt-get install -y $PYTHON ${PYTHON}-dev lib${PYTHON}-dev
      sudo apt-get install -y libgtk-3-dev libjpeg-dev libtiff-dev \
              libsdl2-dev libgstreamer-plugins-base1.0-dev libnotify-dev \
              libsm-dev libwebkit2gtk-4.0-dev libxtst-dev \
              libgl1-mesa-dev libglu1-mesa-dev $VENV_PKG 
    displayName: 'Install deb package requirements'

  - script: |
      $PYTHON --version 
      $MAKE_VENV
      source venv/bin/activate
      python -m pip install -U pip setuptools wheel 
      python -m pip install -r requirements.txt
    displayName: 'Install Python dependencies'

  - script: |
      source venv/bin/activate
      python build.py --jobs=4 build_wx
    displayName: 'build wxWidgets'

  - script: |
      source venv/bin/activate
      python build.py dox etg --nodoc sip
    displayName: 'generate code'

  - script: |
      source venv/bin/activate
      python build.py --jobs=4 build_py
    displayName: 'build wxPython'

  - script: |
      source venv/bin/activate
      python build.py bdist_wheel
      python build.py install
      python -c "import wx; print(wx.version());"
    displayName: 'build wheel and test install'
