Skip to content

Commit c4ea0e6

Browse files
[Fix] fix ci (#3251)
* fix ci * fix lint
1 parent 99bae9e commit c4ea0e6

File tree

1 file changed

+94
-68
lines changed

1 file changed

+94
-68
lines changed

.github/workflows/pr_stage_test.yml

Lines changed: 94 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
name: pr_stage_test
22

3-
env:
4-
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
53
on:
64
pull_request:
75
paths-ignore:
@@ -21,83 +19,111 @@ concurrency:
2119
cancel-in-progress: true
2220

2321
jobs:
24-
build_cu102:
22+
build_cu121:
2523
runs-on: ubuntu-22.04
26-
env:
27-
FORCE_CUDA: 1
28-
MMCV_CUDA_ARGS: -gencode=arch=compute_61,code=sm_61
29-
CONTAINER: pytorch/pytorch:1.8.1-cuda10.2-cudnn7-devel
24+
container:
25+
image: nvidia/cuda:12.1.0-cudnn8-devel-ubuntu22.04
3026
strategy:
3127
matrix:
32-
python-version: [3.7]
28+
python-version: ["3.10"]
29+
torch: ["2.5.1"]
3330
steps:
34-
- uses: actions/checkout@v4
35-
- name: Set up Python ${{ matrix.python-version }}
36-
uses: actions/setup-python@v4
37-
with:
38-
python-version: ${{ matrix.python-version }}
39-
- name: Start Docker Container
31+
- uses: actions/checkout@v3
32+
- name: Install basic tools
33+
run: |
34+
apt-get update
35+
apt-get install -y wget build-essential git software-properties-common
36+
37+
# 安装特定版本的 Python
38+
- name: Install Python ${{ matrix.python-version }}
39+
run: |
40+
add-apt-repository ppa:deadsnakes/ppa -y
41+
apt-get update
42+
apt-get install -y python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-distutils
43+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${{ matrix.python-version }} 1
44+
update-alternatives --install /usr/bin/python python /usr/bin/python${{ matrix.python-version }} 1
45+
wget https://bootstrap.pypa.io/get-pip.py
46+
python get-pip.py
47+
48+
# 安装 PyTorch
49+
- name: Install PyTorch
4050
run: |
41-
docker pull $CONTAINER
42-
docker run --name build-container -d -e FORCE_CUDA=1 -e MMCV_CUDA_ARGS="-gencode=arch=compute_61,code=sm_61" -v ${{ github.workspace }}:/workspace $CONTAINER tail -f /dev/null
43-
- name: Install Dependencies
44-
env:
45-
SCRIPT: |
46-
pip install pip wheel --upgrade
47-
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
48-
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
49-
apt-get update && apt-get install -y git ffmpeg libturbojpeg
50-
pip install git+https://github.com/open-mmlab/mmengine.git@main
51-
pip install ninja psutil
52-
pip install -e . -v
53-
pip install -r requirements/test.txt
54-
run: docker exec build-container bash -c "$SCRIPT"
55-
- name: Build
56-
env:
57-
SCRIPT: |
58-
coverage run --branch --source mmcv -m pytest tests/
59-
coverage xml
60-
coverage report -m
61-
run: docker exec build-container bash -c "$SCRIPT"
51+
pip install torch==${{ matrix.torch }} torchvision --index-url https://download.pytorch.org/whl/cu121
52+
- name: Fetch GPG keys
53+
run: |
54+
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
55+
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
56+
- name: Install system dependencies
57+
run: apt-get update && apt-get install -y git ffmpeg libturbojpeg
58+
- name: Install MMEngine from main branch
59+
run: pip install git+https://github.com/open-mmlab/mmengine.git@main
60+
- name: Install ninja to speed the compilation
61+
run: pip install ninja psutil
62+
- name: Build MMEngine from source
63+
run: pip install -e . -v
64+
- name: Install unit tests dependencies
65+
run: |
66+
pip install -r requirements/test.txt
67+
# Distributed related unit test may randomly error in PyTorch 1.13.0
68+
- name: Run unittests and generate coverage report
69+
run: |
70+
coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist/
71+
coverage xml
72+
coverage report -m
6273
63-
build_cu111:
74+
build_cu118:
6475
runs-on: ubuntu-22.04
65-
env:
66-
FORCE_CUDA: 1
67-
MMCV_CUDA_ARGS: -gencode=arch=compute_61,code=sm_61
68-
CONTAINER: pytorch/pytorch:1.8.1-cuda11.1-cudnn8-devel
76+
container:
77+
image: nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
6978
strategy:
7079
matrix:
71-
python-version: [3.7]
80+
python-version: ["3.10"]
81+
torch: ["2.0.0", "2.1.0","2.3.1"]
7282
steps:
73-
- uses: actions/checkout@v4
74-
- name: Set up Python ${{ matrix.python-version }}
75-
uses: actions/setup-python@v4
76-
with:
77-
python-version: ${{ matrix.python-version }}
78-
- name: Start Docker Container
83+
- uses: actions/checkout@v3
84+
- name: Install basic tools
85+
run: |
86+
apt-get update
87+
apt-get install -y wget build-essential git software-properties-common
88+
89+
# 安装特定版本的 Python
90+
- name: Install Python ${{ matrix.python-version }}
91+
run: |
92+
add-apt-repository ppa:deadsnakes/ppa -y
93+
apt-get update
94+
apt-get install -y python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-distutils
95+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${{ matrix.python-version }} 1
96+
update-alternatives --install /usr/bin/python python /usr/bin/python${{ matrix.python-version }} 1
97+
wget https://bootstrap.pypa.io/get-pip.py
98+
python get-pip.py
99+
100+
# 安装 PyTorch
101+
- name: Install PyTorch
102+
run: |
103+
pip install torch==${{ matrix.torch }} torchvision --index-url https://download.pytorch.org/whl/cu118
104+
- name: Fetch GPG keys
79105
run: |
80-
docker pull $CONTAINER
81-
docker run --name build-container -d -e FORCE_CUDA=1 -e MMCV_CUDA_ARGS="-gencode=arch=compute_61,code=sm_61" -v ${{ github.workspace }}:/workspace $CONTAINER tail -f /dev/null
82-
- name: Install Dependencies
83-
env:
84-
SCRIPT: |
85-
pip install pip wheel --upgrade
86-
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
87-
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
88-
apt-get update && apt-get install -y git ffmpeg libturbojpeg
89-
pip install git+https://github.com/open-mmlab/mmengine.git@main
90-
pip install ninja psutil
91-
pip install -e . -v
92-
pip install -r requirements/test.txt
93-
run: docker exec build-container bash -c "$SCRIPT"
94-
- name: Build
95-
env:
96-
SCRIPT: |
97-
coverage run --branch --source mmcv -m pytest tests/
98-
coverage xml
99-
coverage report -m
100-
run: docker exec build-container bash -c "$SCRIPT"
106+
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
107+
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
108+
- name: Install system dependencies
109+
run: apt-get update && apt-get install -y git ffmpeg libturbojpeg
110+
- name: Install MMEngine from main branch
111+
run: pip install git+https://github.com/open-mmlab/mmengine.git@main
112+
- name: Install ninja to speed the compilation
113+
run: pip install ninja psutil
114+
- name: Build MMEngine from source
115+
run: pip install -e . -v
116+
- name: Install unit tests dependencies
117+
run: |
118+
pip install -r requirements/test.txt
119+
pip install numpy==1.24.3
120+
# Distributed related unit test may randomly error in PyTorch 1.13.0
121+
- name: Run unittests and generate coverage report
122+
run: |
123+
coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist/
124+
coverage xml
125+
coverage report -m
126+
101127
build_windows_without_ops:
102128
runs-on: windows-2019
103129
env:

0 commit comments

Comments
 (0)