-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (170 loc) · 5.82 KB
/
unit_tests.yml
File metadata and controls
204 lines (170 loc) · 5.82 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# SPDX-FileCopyrightText: 2026 ModelCloud.ai
# SPDX-FileCopyrightText: 2026 qubitium@modelcloud.ai
# SPDX-License-Identifier: Apache-2.0
# Contact: qubitium@modelcloud.ai, x.com/qubitium
name: Unit Tests
defaults:
run:
shell: bash -le {0}
on:
repository_dispatch:
workflow_dispatch:
inputs:
ref:
description: 'GitHub ref: Branch, Tag or Commit SHA'
required: false
default: ''
env:
ref: ${{ github.event.inputs.ref || github.ref }}
CUDA_VERSION: 130
UV_TORCH_BACKEND: cu130
TORCH_VERSION: 2.11.0
PYTHON_VERSION: 3.14
UV_PYTHON: python3.14
concurrency:
group: ${{ github.ref }}-workflow-unit-tests
cancel-in-progress: true
jobs:
list-test-files:
runs-on: ubuntu-24.04
outputs:
test-files: ${{ steps.files.outputs.test-files }}
steps:
- name: Checkout Codes
uses: actions/checkout@v6
with:
submodules: recursive
ref: ${{ env.ref }}
- name: List files
id: files
run: |
script="
import json
import os
import re
IGNORED_TEST_FILES = '${IGNORED_TEST_FILES}'
all_tests = [f.removesuffix('.py') for f in os.listdir('tests/') if f.startswith('test_') and f.endswith('.py') and f.strip().removesuffix('py') not in f'{IGNORED_TEST_FILES}']
print(f'{json.dumps(all_tests)}')
"
test_files=$(python3 -c "$script")
IFS='|' read -r test_files <<< "$test_files"
echo "test-files=$test_files" >> "$GITHUB_OUTPUT"
echo "Test files: $test_files"
test:
needs:
- list-test-files
runs-on: [ self-hosted, xeon5 ]
container:
image: 10.0.13.31:5000/nvidia/cuda:130-ubuntu24.04_0415
options: --device /dev/dri --ipc=host --runtime=nvidia --gpus all
volumes:
- /monster/ci/env/entrypoint.sh:/entrypoint.sh
- /monster/ci/env/entrypoint.sh:/etc/profile.d/01-entrypoint.sh
- /dev/dri/by-path:/dev/dri/by-path
- /monster/ci/models:/monster/data/model
- /monster/ci/dataset:/monster/data/model/dataset
- /monster/ci/huggingface:/github/home/.cache/huggingface
- /monster/ci/uv:/opt/uv
- /monster/ci/env:/opt/env
- /monster/ci/dist:/opt/dist
strategy:
fail-fast: false
matrix:
test_script: ${{ fromJSON(needs.list-test-files.outputs.test-files) }}
steps:
- name: Checkout Codes
uses: actions/checkout@v6
with:
submodules: recursive
ref: ${{ env.ref }}
- name: Print env
run: |
echo PATH=$PATH
echo UV_INSTALL_DIR=$UV_INSTALL_DIR
echo UV_PYTHON_BIN_DIR=$UV_PYTHON_BIN_DIR
echo UV_PYTHON_INSTALL_DIR=$UV_PYTHON_INSTALL_DIR
echo UV_PYTHON_CACHE_DIR=$UV_PYTHON_CACHE_DIR
echo UV_CACHE_DIR=$UV_CACHE_DIR
echo VENV_ROOT=$VENV_ROOT
- name: Activate uv env
run: |
env_name="cu${{ env.CUDA_VERSION }}_torch${{ env.TORCH_VERSION }}_py${{ env.PYTHON_VERSION }}_test_${{ matrix.test_script }}"
/opt/uv/setup_uv_venv.sh $env_name
- name: Setup uv env
run: |
python -V
which python
which pip || true
echo "setting env... cuda=${{ env.CUDA_VERSION }} torch=${{ env.TORCH_VERSION }} python=${{ env.PYTHON_VERSION }}"
bash /opt/env/init_compiler_no_env.sh ${{ env.CUDA_VERSION }} ${{ env.TORCH_VERSION }} ${{ env.PYTHON_VERSION }}
python .github/scripts/install_deps.py ${{ matrix.test_script }}
- name: Print uv env
run: |
echo "::group::uv python list"
uv python list
ls -ahl /opt/uv/venvs
echo "::endgroup::"
which python
which pip || true
python -V
echo "::group::uv python list"
uv python list
echo "::endgroup::"
echo "== nvcc =="
nvcc --version
echo "::group::pip list"
uv pip list
echo "::endgroup::"
echo "== torch =="
uv pip show torch || true
echo "::group::project files"
ls -ahl
echo "::endgroup::"
echo "== torch =="
uv pip show torch
- name: Install
run: |
uv pip install pip pytest regex setuptools build wheel -U
uv pip install -r requirements.txt
uv pip install -v .
- name: Test ${{ matrix.test_script }}
run: |
mkdir -p artifacts
pytest --durations=0 tests/${{ matrix.test_script }}.py --junitxml=artifacts/${{ runner.os }}-${{ matrix.test_script }}.xml
prepare-setuptools:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.parser.outputs.versions || '[]' }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Generate version matrix
id: parser
run: |
python -m pip install --upgrade requests packaging
versions=$(python .github/scripts/ci_loop_versions.py setuptools ">=77.0.1,<83")
echo "versions=$versions" >> "$GITHUB_OUTPUT"
check-setuptools:
needs: prepare-setuptools
if: needs.prepare-setuptools.outputs.versions != '[]'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.prepare-setuptools.outputs.versions) }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.14"
cache: pip
- name: Install package with selected setuptools
run: |
python -m pip install --upgrade pip
python -m pip install . "setuptools==${{ matrix.version }}"
- name: Show versions
run: |
python --version
python -m pip show setuptools