[fix] fix ci (#1636)

main
Epiphany 2025-02-27 15:13:38 +08:00 committed by GitHub
parent 41fa84a9a9
commit d620552c2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 91 additions and 129 deletions

View File

@ -25,152 +25,114 @@ concurrency:
jobs:
build_cpu:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
python-version: [3.7]
include:
- torch: 1.8.1
torchvision: 0.9.1
python-version: ['3.9']
torch: ['2.0.0']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Check out repo
uses: actions/checkout@v3
- name: Setup conda env
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniconda-version: "latest"
use-only-tar-bz2: true
activate-environment: test
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: python -m pip install pip --upgrade
- name: Upgrade wheel
run: python -m pip install wheel --upgrade
- name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
- name: Build MMEngine from source
run: pip install -e . -v
- name: Install unit tests dependencies
- name: Update pip
run: |
pip install -r requirements/tests.txt
pip install openmim
mim install mmcv
- name: Run unittests and generate coverage report
python -m pip install --upgrade pip wheel
- name: Install dependencies
run: |
coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist
coverage xml
coverage report -m
# Upload coverage report for python3.7 && pytorch1.8.1 cpu
- name: Upload coverage to Codecov
apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6
python -m pip install torch==${{matrix.torch}}
python -m pip install -e . -v
python -m pip install -r requirements/tests.txt
python -m pip install openmim
mim install mmcv coverage
- name: Run unit tests with coverage
run: coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
build_cu102:
build_gpu:
runs-on: ubuntu-22.04
container:
image: pytorch/pytorch:1.8.1-cuda10.2-cudnn7-devel
defaults:
run:
shell: bash -l {0}
env:
MKL_THREADING_LAYER: GNU
strategy:
matrix:
python-version: [3.7]
python-version: ['3.9','3.10']
torch: ['2.0.0','2.3.1','2.5.1']
cuda: ['cu118']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Check out repo
uses: actions/checkout@v3
- name: Setup conda env
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniconda-version: "latest"
use-only-tar-bz2: true
activate-environment: test
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade
- name: Fetch GPG keys
- name: Update pip
run: |
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
- name: Install system dependencies
run: apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6
- name: Build MMEngine from source
run: pip install -e . -v
- name: Install unit tests dependencies
python -m pip install --upgrade pip wheel
- name: Install dependencies
run: |
pip install -r requirements/tests.txt
pip install openmim
mim install mmcv
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist
coverage xml
coverage report -m
apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6
python -m pip install torch==${{matrix.torch}} --index-url https://download.pytorch.org/whl/${{matrix.cuda}}
python -m pip install -e . -v
python -m pip install -r requirements/tests.txt
python -m pip install openmim
mim install mmcv coverage
- name: Run unit tests with coverage
run: coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
build_cu117:
runs-on: ubuntu-22.04
container:
image: pytorch/pytorch:2.0.0-cuda11.7-cudnn8-devel
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install pip --upgrade
- name: Fetch GPG keys
run: |
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
- name: Install system dependencies
run: apt-get update && apt-get install -y git ffmpeg libturbojpeg
- name: Build MMEngine from source
run: pip install -e . -v
- name: Install unit tests dependencies
run: |
pip install -r requirements/tests.txt
pip install openmim
mim install mmcv
# Distributed related unit test may randomly error in PyTorch 1.13.0
- name: Run unittests and generate coverage report
run: |
coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist/
coverage xml
coverage report -m
build_windows:
runs-on: windows-2022
strategy:
matrix:
python-version: [3.7]
platform: [cpu, cu111]
torch: [1.8.1]
torchvision: [0.9.1]
include:
- python-version: 3.8
platform: cu118
torch: 2.1.0
torchvision: 0.16.0
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
# Windows CI could fail If we call `pip install pip --upgrade` directly.
run: python -m pip install pip --upgrade
- name: Install PyTorch
run: pip install torch==${{matrix.torch}}+${{matrix.platform}} torchvision==${{matrix.torchvision}}+${{matrix.platform}} -f https://download.pytorch.org/whl/${{matrix.platform}}/torch_stable.html
- name: Build MMEngine from source
run: pip install -e . -v
- name: Install unit tests dependencies
run: |
pip install -r requirements/tests.txt
pip install openmim
mim install mmcv
- name: Run CPU unittests
run: pytest tests/ --ignore tests/test_dist
if: ${{ matrix.platform == 'cpu' }}
- name: Run GPU unittests
# Skip testing distributed related unit tests since the memory of windows CI is limited
run: pytest tests/ --ignore tests/test_dist --ignore tests/test_optim/test_optimizer/test_optimizer_wrapper.py --ignore tests/test_model/test_wrappers/test_model_wrapper.py --ignore tests/test_hooks/test_sync_buffers_hook.py
if: ${{ matrix.platform == 'cu111' }} || ${{ matrix.platform == 'cu118' }}
# build_windows:
# runs-on: windows-2022
# strategy:
# matrix:
# python-version: [3.9]
# platform: [cpu, cu111]
# torch: [1.8.1]
# torchvision: [0.9.1]
# include:
# - python-version: 3.8
# platform: cu118
# torch: 2.1.0
# torchvision: 0.16.0
# steps:
# - uses: actions/checkout@v3
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# - name: Upgrade pip
# # Windows CI could fail If we call `pip install pip --upgrade` directly.
# run: python -m pip install pip wheel --upgrade
# - name: Install PyTorch
# run: pip install torch==${{matrix.torch}}+${{matrix.platform}} torchvision==${{matrix.torchvision}}+${{matrix.platform}} -f https://download.pytorch.org/whl/${{matrix.platform}}/torch_stable.html
# - name: Build MMEngine from source
# run: pip install -e . -v
# - name: Install unit tests dependencies
# run: |
# pip install -r requirements/tests.txt
# pip install openmim
# mim install mmcv
# - name: Run CPU unittests
# run: pytest tests/ --ignore tests/test_dist
# if: ${{ matrix.platform == 'cpu' }}
# - name: Run GPU unittests
# # Skip testing distributed related unit tests since the memory of windows CI is limited
# run: pytest tests/ --ignore tests/test_dist --ignore tests/test_optim/test_optimizer/test_optimizer_wrapper.py --ignore tests/test_model/test_wrappers/test_model_wrapper.py --ignore tests/test_hooks/test_sync_buffers_hook.py
# if: ${{ matrix.platform == 'cu111' }} || ${{ matrix.platform == 'cu118' }}