Skip to content

Commit 0d99e7c

Browse files
[ci] add unittest (#2390)
* Fix extract_role_pred to properly strip whitespace and use explicit None checks * update * fix lint * update * update * update * update * update * update * update * update * update * Update test_base_task.py * Update test_base_task.py
1 parent 480c6ca commit 0d99e7c

20 files changed

+3414
-572
lines changed

.github/workflows/pr-stage-check.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
matrix:
2121
python-version: ['3.10']
2222
include:
23-
- torch: 2.5.1
23+
- torch: 2.9.0
2424
steps:
2525
- name: Free disk space
2626
uses: jlumbroso/free-disk-space@main
@@ -62,10 +62,10 @@ jobs:
6262
run: |
6363
python run.py --models hf_opt_125m --datasets siqa_gen winograd_ppl --dry-run
6464
65-
build_cu117:
65+
build_cu131:
6666
runs-on: ubuntu-latest
6767
container:
68-
image: nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu22.04
68+
image: nvidia/cuda:13.1.1-cudnn-runtime-ubuntu24.04
6969
strategy:
7070
matrix:
7171
python-version: ['3.10']

.github/workflows/unit-test.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: unit_test
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- 'README.md'
7+
- 'README_zh-CN.md'
8+
- 'docs/**'
9+
- 'configs/**'
10+
- 'tools/**'
11+
workflow_dispatch:
12+
schedule:
13+
- cron: '56 22 * * *'
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
env:
20+
CONDA_ENV: unit_test
21+
CONDA_PATH: /mnt/shared-storage-user/opencompass-shared/qa-llm-cicd/miniconda3
22+
COMPASS_DATA_CACHE: /mnt/shared-storage-user/auto-eval-pipeline/opencompass/llmeval/compass_data_cache
23+
KUBEBRAIN_CLUSTER_ENTRY: https://h.pjlab.org.cn
24+
KUBEBRAIN_NAMESPACE: ailab-opencompass
25+
JOB_NAME: unit-test-${{ github.run_id }}-${{ github.run_attempt }}
26+
27+
jobs:
28+
unit_test:
29+
runs-on: yidian_cu12_ut
30+
timeout-minutes: 45
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v2
34+
- name: Prepare - Install opencompass
35+
run: |
36+
. ${{env.CONDA_PATH}}/bin/activate
37+
conda activate ${{env.CONDA_ENV}}
38+
python3 -m pip uninstall opencompass -y
39+
python3 -m pip install .[full]
40+
conda info --envs
41+
pip list
42+
lmdeploy check_env
43+
- name: Run test
44+
run: |
45+
. ${{env.CONDA_PATH}}/bin/activate
46+
conda activate ${{env.CONDA_ENV}}
47+
pip list
48+
coverage run --include="**/opencompass/**/*.py" -m pytest tests -s -vv
49+
coverage report -m
50+
- name: Uninstall opencompass
51+
if: always()
52+
run: |
53+
. ${{env.CONDA_PATH}}/bin/activate
54+
conda activate ${{env.CONDA_ENV}}
55+
python3 -m pip uninstall opencompass -y
56+
conda info --envs

.pre-commit-config-zh-cn.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
exclude: |
22
(?x)^(
33
tests/data/|
4-
tests/dataset/|
4+
tests/datasets/|
55
opencompass/models/internal/|
66
opencompass/utils/internal/|
77
opencompass/openicl/icl_evaluator/hf_metrics/|

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
exclude: |
22
(?x)^(
33
tests/data/|
4-
tests/dataset/|
4+
tests/datasets/|
55
opencompass/models/internal/|
66
opencompass/utils/internal/|
77
opencompass/openicl/icl_evaluator/hf_metrics/|
@@ -16,7 +16,7 @@ exclude: |
1616
docs/zh_cn/advanced_guides/compassbench_intro.md |
1717
docs/zh_cn/advanced_guides/compassbench_v2_0.md |
1818
opencompass/utils/datasets.py |
19-
opencompass/utils/datasets_info.py
19+
opencompass/utils/datasets_info.py
2020
)
2121
repos:
2222
- repo: https://github.com/PyCQA/flake8

0 commit comments

Comments
 (0)