-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (67 loc) · 1.95 KB
/
unit_tests.yml
File metadata and controls
84 lines (67 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Unit tests
defaults:
run:
shell: bash -le {0}
on:
repository_dispatch:
workflow_dispatch:
env:
CUDA_DEVICE_ORDER: PCI_BUS_ID
jobs:
list-test-files:
runs-on: ubuntu-24.04
if: github.event.inputs.m4-only != 'true'
outputs:
test-files: ${{ steps.files.outputs.test-files }}
steps:
- name: Checkout Codes
uses: actions/checkout@v6
- name: List files
id: files
run: |
dir="tests"
json_array="["
for file in "$dir"/*; do
[ -f "$file" ] || continue
filename=$(basename "$file")
if [[ "$filename" == test_*.py ]]; then
json_array+="\"$filename\","
fi
done
json_array="${json_array%,}]"
echo "$json_array"
echo "test-files=$json_array" >> "$GITHUB_OUTPUT"
test:
runs-on: [ self-hosted ]
needs:
- list-test-files
container:
image: 10.0.13.31:5000/nvidia/cuda:130-ubuntu22.04_1021
volumes:
- /monster/ci/pyenv:/opt/pyenv
- /monster/ci/models:/monster/data/model
- /monster/ci/huggingface:/github/home/.cache/huggingface
strategy:
fail-fast: false
matrix:
test_script: ${{ fromJSON(needs.list-test-files.outputs.test-files) }}
steps:
- uses: actions/checkout@v6
- name: Print Env
run: |
env_name="logbar_unit_test_py314_${{ matrix.test_script }}"
echo "env name: $env_name"
if [ -d "$(pyenv root)/versions/$env_name" ]; then
echo "env exists, skip"
else
echo "creating venv..."
pyenv virtualenv 3.14 "$env_name"
fi
pyenv local $env_name
pyenv activate $env_name
- name: install requirements
run: pip install -U parameterized pytest pytest-xdist
- name: install
run: pip install .
- name: test
run: pytest -n 8 -v tests/${{ matrix.test_script }}