name: CI-mpi

on:
  # Trigger the workflow on push or pull request,
  # but only for the master branch
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  build:
    name: pytest-mpi
    runs-on: ubuntu-16.04

    env:
      DEVITO_ARCH: "gcc-7"
      DEVITO_LANGUAGE: "openmp"
      DEVITO_BACKEND: "core"
      CC: "gcc-7"
      CXX: "g++-7"
      PYTHON_VERSION: "3.7"

    steps:
    - name: Checkout devito
      uses: actions/checkout@v1

    - name: Set up Python 3.7
      uses: actions/setup-python@v1
      with:
        python-version: 3.7

    - name: Install MPI
      run : |
        sudo apt-get install -y mpich libmpich-dev

    - name: Install dependencies
      run: |
        pip install --upgrade pip
        pip install -e .[extras]
        ipcluster start --profile=mpi -n 4 --daemon

    - name: Test with pytest
      run: |
        pytest --cov --cov-config=.coveragerc --cov-report=xml -m parallel tests/

    - name: Test mpi notebook
      run : |
        # Currently not tested due to issue #859
        # py.test --nbval examples/mpi
        ipcluster stop --profile=mpi

    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v1.0.6
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        name: pytest-mpi

name: CI-mpi

on:
  # Trigger the workflow on push or pull request,
  # but only for the master branch
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  build:
    name: pytest-mpi
    runs-on: self-hosted

    env:
      DEVITO_ARCH: "gcc-7"
      DEVITO_LANGUAGE: "openmp"
      DEVITO_BACKEND: "core"
      CC: "gcc-7"
      CXX: "g++-7"

    steps:
    - name: Checkout devito
      uses: actions/checkout@v1

    - name: Install dependencies
      run: |
        pip3 install --upgrade pip
        pip3 install -e .[extras]

    - name: Test with pytest
      run: |
        pytest --cov --cov-config=.coveragerc --cov-report=xml -m parallel tests/

    - name: Test mpi notebook
      run : |
        # Currently not tested due to issue #859
        # ipcluster start --profile=mpi -n 4 --daemon
        # py.test --nbval examples/mpi
        # ipcluster stop --profile=mpi

    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v1.0.6
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        name: pytest-mpi

Update CI-mpi to use self-hosted runners.
workflows: Update CI-mpi to use self-hosted runners.
