Skip to content

Commit d620552

Browse files
[fix] fix ci (#1636)
1 parent 41fa84a commit d620552

File tree

1 file changed

+91
-129
lines changed

1 file changed

+91
-129
lines changed

.github/workflows/pr_stage_test.yml

Lines changed: 91 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -25,152 +25,114 @@ concurrency:
2525
jobs:
2626
build_cpu:
2727
runs-on: ubuntu-22.04
28+
defaults:
29+
run:
30+
shell: bash -l {0}
2831
strategy:
2932
matrix:
30-
python-version: [3.7]
31-
include:
32-
- torch: 1.8.1
33-
torchvision: 0.9.1
33+
python-version: ['3.9']
34+
torch: ['2.0.0']
3435
steps:
35-
- uses: actions/checkout@v3
36-
- name: Set up Python ${{ matrix.python-version }}
37-
uses: actions/setup-python@v4
36+
- name: Check out repo
37+
uses: actions/checkout@v3
38+
- name: Setup conda env
39+
uses: conda-incubator/setup-miniconda@v2
3840
with:
41+
auto-update-conda: true
42+
miniconda-version: "latest"
43+
use-only-tar-bz2: true
44+
activate-environment: test
3945
python-version: ${{ matrix.python-version }}
40-
- name: Upgrade pip
41-
run: python -m pip install pip --upgrade
42-
- name: Upgrade wheel
43-
run: python -m pip install wheel --upgrade
44-
- name: Install PyTorch
45-
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
46-
- name: Build MMEngine from source
47-
run: pip install -e . -v
48-
- name: Install unit tests dependencies
46+
- name: Update pip
4947
run: |
50-
pip install -r requirements/tests.txt
51-
pip install openmim
52-
mim install mmcv
53-
- name: Run unittests and generate coverage report
48+
python -m pip install --upgrade pip wheel
49+
- name: Install dependencies
5450
run: |
55-
coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist
56-
coverage xml
57-
coverage report -m
58-
# Upload coverage report for python3.7 && pytorch1.8.1 cpu
59-
- name: Upload coverage to Codecov
51+
apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6
52+
python -m pip install torch==${{matrix.torch}}
53+
python -m pip install -e . -v
54+
python -m pip install -r requirements/tests.txt
55+
python -m pip install openmim
56+
mim install mmcv coverage
57+
- name: Run unit tests with coverage
58+
run: coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist
59+
- name: Upload Coverage to Codecov
6060
uses: codecov/codecov-action@v3
61-
with:
62-
file: ./coverage.xml
63-
flags: unittests
64-
env_vars: OS,PYTHON
65-
name: codecov-umbrella
66-
fail_ci_if_error: false
6761

68-
build_cu102:
62+
build_gpu:
6963
runs-on: ubuntu-22.04
70-
container:
71-
image: pytorch/pytorch:1.8.1-cuda10.2-cudnn7-devel
64+
defaults:
65+
run:
66+
shell: bash -l {0}
7267
env:
7368
MKL_THREADING_LAYER: GNU
7469
strategy:
7570
matrix:
76-
python-version: [3.7]
71+
python-version: ['3.9','3.10']
72+
torch: ['2.0.0','2.3.1','2.5.1']
73+
cuda: ['cu118']
7774
steps:
78-
- uses: actions/checkout@v3
79-
- name: Set up Python ${{ matrix.python-version }}
80-
uses: actions/setup-python@v4
75+
- name: Check out repo
76+
uses: actions/checkout@v3
77+
- name: Setup conda env
78+
uses: conda-incubator/setup-miniconda@v2
8179
with:
80+
auto-update-conda: true
81+
miniconda-version: "latest"
82+
use-only-tar-bz2: true
83+
activate-environment: test
8284
python-version: ${{ matrix.python-version }}
83-
- name: Upgrade pip
84-
run: pip install pip --upgrade
85-
- name: Fetch GPG keys
86-
run: |
87-
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
88-
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
89-
- name: Install system dependencies
90-
run: apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6
91-
- name: Build MMEngine from source
92-
run: pip install -e . -v
93-
- name: Install unit tests dependencies
94-
run: |
95-
pip install -r requirements/tests.txt
96-
pip install openmim
97-
mim install mmcv
98-
- name: Run unittests and generate coverage report
85+
- name: Update pip
9986
run: |
100-
coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist
101-
coverage xml
102-
coverage report -m
103-
104-
build_cu117:
105-
runs-on: ubuntu-22.04
106-
container:
107-
image: pytorch/pytorch:2.0.0-cuda11.7-cudnn8-devel
108-
strategy:
109-
matrix:
110-
python-version: [3.9]
111-
steps:
112-
- uses: actions/checkout@v3
113-
- name: Set up Python ${{ matrix.python-version }}
114-
uses: actions/setup-python@v4
115-
with:
116-
python-version: ${{ matrix.python-version }}
117-
- name: Upgrade pip
118-
run: pip install pip --upgrade
119-
- name: Fetch GPG keys
87+
python -m pip install --upgrade pip wheel
88+
- name: Install dependencies
12089
run: |
121-
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
122-
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
123-
- name: Install system dependencies
124-
run: apt-get update && apt-get install -y git ffmpeg libturbojpeg
125-
- name: Build MMEngine from source
126-
run: pip install -e . -v
127-
- name: Install unit tests dependencies
128-
run: |
129-
pip install -r requirements/tests.txt
130-
pip install openmim
131-
mim install mmcv
132-
# Distributed related unit test may randomly error in PyTorch 1.13.0
133-
- name: Run unittests and generate coverage report
134-
run: |
135-
coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist/
136-
coverage xml
137-
coverage report -m
90+
apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6
91+
python -m pip install torch==${{matrix.torch}} --index-url https://download.pytorch.org/whl/${{matrix.cuda}}
92+
python -m pip install -e . -v
93+
python -m pip install -r requirements/tests.txt
94+
python -m pip install openmim
95+
mim install mmcv coverage
96+
- name: Run unit tests with coverage
97+
run: coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist
98+
- name: Upload Coverage to Codecov
99+
uses: codecov/codecov-action@v3
138100

139-
build_windows:
140-
runs-on: windows-2022
141-
strategy:
142-
matrix:
143-
python-version: [3.7]
144-
platform: [cpu, cu111]
145-
torch: [1.8.1]
146-
torchvision: [0.9.1]
147-
include:
148-
- python-version: 3.8
149-
platform: cu118
150-
torch: 2.1.0
151-
torchvision: 0.16.0
152-
steps:
153-
- uses: actions/checkout@v3
154-
- name: Set up Python ${{ matrix.python-version }}
155-
uses: actions/setup-python@v4
156-
with:
157-
python-version: ${{ matrix.python-version }}
158-
- name: Upgrade pip
159-
# Windows CI could fail If we call `pip install pip --upgrade` directly.
160-
run: python -m pip install pip --upgrade
161-
- name: Install PyTorch
162-
run: pip install torch==${{matrix.torch}}+${{matrix.platform}} torchvision==${{matrix.torchvision}}+${{matrix.platform}} -f https://download.pytorch.org/whl/${{matrix.platform}}/torch_stable.html
163-
- name: Build MMEngine from source
164-
run: pip install -e . -v
165-
- name: Install unit tests dependencies
166-
run: |
167-
pip install -r requirements/tests.txt
168-
pip install openmim
169-
mim install mmcv
170-
- name: Run CPU unittests
171-
run: pytest tests/ --ignore tests/test_dist
172-
if: ${{ matrix.platform == 'cpu' }}
173-
- name: Run GPU unittests
174-
# Skip testing distributed related unit tests since the memory of windows CI is limited
175-
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
176-
if: ${{ matrix.platform == 'cu111' }} || ${{ matrix.platform == 'cu118' }}
101+
# build_windows:
102+
# runs-on: windows-2022
103+
# strategy:
104+
# matrix:
105+
# python-version: [3.9]
106+
# platform: [cpu, cu111]
107+
# torch: [1.8.1]
108+
# torchvision: [0.9.1]
109+
# include:
110+
# - python-version: 3.8
111+
# platform: cu118
112+
# torch: 2.1.0
113+
# torchvision: 0.16.0
114+
# steps:
115+
# - uses: actions/checkout@v3
116+
# - name: Set up Python ${{ matrix.python-version }}
117+
# uses: actions/setup-python@v4
118+
# with:
119+
# python-version: ${{ matrix.python-version }}
120+
# - name: Upgrade pip
121+
# # Windows CI could fail If we call `pip install pip --upgrade` directly.
122+
# run: python -m pip install pip wheel --upgrade
123+
# - name: Install PyTorch
124+
# run: pip install torch==${{matrix.torch}}+${{matrix.platform}} torchvision==${{matrix.torchvision}}+${{matrix.platform}} -f https://download.pytorch.org/whl/${{matrix.platform}}/torch_stable.html
125+
# - name: Build MMEngine from source
126+
# run: pip install -e . -v
127+
# - name: Install unit tests dependencies
128+
# run: |
129+
# pip install -r requirements/tests.txt
130+
# pip install openmim
131+
# mim install mmcv
132+
# - name: Run CPU unittests
133+
# run: pytest tests/ --ignore tests/test_dist
134+
# if: ${{ matrix.platform == 'cpu' }}
135+
# - name: Run GPU unittests
136+
# # Skip testing distributed related unit tests since the memory of windows CI is limited
137+
# 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
138+
# if: ${{ matrix.platform == 'cu111' }} || ${{ matrix.platform == 'cu118' }}

0 commit comments

Comments
 (0)