name: Integration Test

on:
  pull_request:
    branches: [ main ]

  workflow_dispatch:

jobs:
  build:

    runs-on: ubuntu-18.04
    strategy:
      fail-fast: false
      matrix:
        python-version: [ 3.8 ]

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        sudo add-apt-repository -y ppa:jonathonf/ffmpeg-4
        sudo apt install -y -qq pkg-config libavfilter-dev libavdevice-dev
    - name: Install packages
      run: |
        python -m pip install --quiet --upgrade pip
        python -m pip install --quiet --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
        python -m pip install --quiet pytest requests cmake ninja deep-phonemizer sentencepiece
        python setup.py install
      env:
        BUILD_FFMPEG: true
    - name: Run integration test
      run: |
        cd test && pytest integration_tests -v --use-tmp-hub-dir
