refractor away LazyImport #47
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Unit Tests | |
| defaults: | |
| run: | |
| shell: bash -le {0} | |
| on: | |
| push: | |
| 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: 128 | |
| UV_TORCH_BACKEND: cu128 | |
| TORCH_VERSION: 2.8.0 | |
| PYTHON_VERSION: 3.12 # use 312, no need to recompile libs like flash_attn... | |
| UV_PYTHON: python3.12 | |
| 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:128-ubuntu22.04_0206 | |
| 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: | | |
| pip install pip pytest regex setuptools build wheel -U | |
| 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 | |