Merge branch 'main' into main #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | ||
on: [ push, pull_request ] | ||
# Run linter with github actions for quick feedbacks. | ||
# Run macos tests with github actions. Linux (CPU & GPU) tests currently runs on CircleCI | ||
jobs: | ||
linter: | ||
runs-on: ubuntu-latest | ||
# run on PRs, or commits to facebookresearch (not internal) | ||
if: ${{ github.repository_owner == 'facebookresearch' || github.event_name == 'pull_request' }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
# flake8-bugbear flake8-comprehensions are useful but not available internally | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install flake8==6.0.0 isort==5.12.0 | ||
python -m pip install black==23.1.0 | ||
flake8 --version | ||
- name: Lint | ||
run: | | ||
echo "Running isort" | ||
isort -c --sp . . | ||
echo "Running black" | ||
black -l 100 --check . | ||
echo "Running flake8" | ||
flake8 . | ||
macos_tests: | ||
runs-on: macos-latest | ||
# run on PRs, or commits to facebookresearch (not internal) | ||
if: ${{ github.repository_owner == 'facebookresearch' || github.event_name == 'pull_request' }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
torch: [ "1.13.1", "2.0.1", "2.1.0" ] | ||
include: | ||
- torch: "1.13.1" | ||
torchvision: "0.14.1" | ||
- torch: "2.0.1" | ||
torchvision: "0.15.2" | ||
- torch: "2.1.1" | ||
torchvision: "0.16.1" | ||
exclude: | ||
- python: "3.11" | ||
torch: "1.13.1" | ||
env: | ||
# point datasets to ~/.torch so it's cached by CI | ||
DETECTRON2_DATASETS: ~/.torch/datasets | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
${{ env.pythonLocation }}/lib/python3.10/site-packages | ||
~/.torch | ||
key: ${{ runner.os }}-torch${{ matrix.torch }}-${{ hashFiles('setup.py') }}-20230922 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install -U pip | ||
python -m pip install ninja opencv-python-headless onnx pytest-xdist | ||
python -m pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html | ||
# install from github to get latest; install iopath first since fvcore depends on it | ||
python -m pip install -U 'git+https://github.com/facebookresearch/iopath' | ||
python -m pip install -U 'git+https://github.com/facebookresearch/fvcore' | ||
- name: Build and install | ||
run: | | ||
CC=clang CXX=clang++ python -m pip install -e .[all] | ||
python -m detectron2.utils.collect_env | ||
./datasets/prepare_for_tests.sh | ||
- name: Run unittests | ||
run: python -m pytest -n 4 --durations=15 -sv tests/ |