https://github.com/tensorly/tensorly
Raw File
Tip revision: db1eb97a113d2dfe213e4053969f0aeef2884a9e authored by Aaron Meyer on 25 September 2022, 18:01:17 UTC
Merge pull request #450 from tensorly/fix-docs
Tip revision: db1eb97
test.yml
name: Test TensorLy

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        BACKEND: ['numpy', 'pytorch', 'tensorflow', 'jax', 'mxnet']
        python-version: ['3.10']
        include:
          - BACKEND: 'numpy'
            python-version: '3.7'
          - BACKEND: 'numpy'
            python-version: '3.9'
          - BACKEND: 'numpy'
            python-version: '3.9'
            TENSORLY_TENALG_BACKEND: ['einsum']

    steps:
    - uses: actions/checkout@v3
    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}
  
    - name: Install dependencies and backend ${{matrix.BACKEND}}
      run: |
        python -m pip install --upgrade pip
        python -m pip install -r requirements.txt
        python -m pip install -r doc/requirements_doc.txt
        echo "Installing dependencies for BACKEND=${{matrix.BACKEND}}"
        if [[ "${{matrix.BACKEND}}" == "numpy" ]]; then
          echo "Installing sparse";
          pip install sparse;
        elif [[ "${{matrix.BACKEND}}" == "pytorch" ]]; then
          echo "Installing PyTorch";
          pip install torch torchvision;
        elif [[ "${{matrix.BACKEND}}" == "tensorflow" ]]; then
          echo "Installing TensorFlow";
          pip install tensorflow;
        elif [[ "${{matrix.BACKEND}}" == "mxnet" ]]; then
          echo "Installing MXNet";
          sudo apt install gfortran;
          echo "Reverting to older version of numpy 1.23.1 until MXNet fixed bool issue" 
          python -m pip uninstall numpy -y;
          python -m pip install numpy==1.23.1;
          pip install mxnet;
        elif [[ "${{matrix.BACKEND}}" == "jax" ]]; then
          echo "Installing JAX";
          pip install jax jaxlib;
        fi

    - name: Install package
      run: |
        python -m pip install -e .

    - name: Test with backend ${{matrix.BACKEND}} pytest and coverage
      run: |
        TENSORLY_BACKEND=${{matrix.BACKEND}} pytest -vv --cov tensorly --cov-report xml --durations=10 tensorly
    
    - name: Check coverage with CodeCov
      uses: codecov/codecov-action@v3
      with:
        file: ./coverage.xml
        verbose: true
back to top