|
|
|
name: Python tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ main ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ main ]
|
|
|
|
|
|
|
|
env:
|
|
|
|
OMP_NUM_THREADS: 2
|
|
|
|
MKL_NUM_THREADS: 2
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
name: Run tests on ${{ matrix.os }} with Python ${{ matrix.python }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macOS-latest]
|
|
|
|
python: ['3.9']
|
|
|
|
torch: ['1.10.0']
|
|
|
|
torchvision: ['0.11.1']
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ matrix.python }}
|
|
|
|
uses: actions/setup-python@v1
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python }}
|
|
|
|
- name: Install testing dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install pytest pytest-timeout pytest-xdist pytest-forked expecttest
|
|
|
|
- name: Install torch on mac
|
|
|
|
if: startsWith(matrix.os, 'macOS')
|
|
|
|
run: pip install --no-cache-dir torch==${{ matrix.torch }} torchvision==${{ matrix.torchvision }}
|
|
|
|
- name: Install torch on ubuntu
|
|
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
|
|
run: |
|
|
|
|
pip install --no-cache-dir torch==${{ matrix.torch }}+cpu torchvision==${{ matrix.torchvision }}+cpu -f https://download.pytorch.org/whl/torch_stable.html
|
|
|
|
sudo apt update
|
|
|
|
sudo apt install -y google-perftools
|
|
|
|
- name: Install requirements
|
|
|
|
run: |
|
|
|
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
|
|
pip install --no-cache-dir git+https://github.com/mapillary/inplace_abn.git@v1.1.0
|
|
|
|
- name: Run tests
|
|
|
|
env:
|
|
|
|
LD_PRELOAD: /usr/lib/x86_64-linux-gnu/libtcmalloc.so.4
|
|
|
|
run: |
|
|
|
|
export PYTHONDONTWRITEBYTECODE=1
|
|
|
|
pytest -vv --forked --durations=0 ./tests
|