add main #4
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: CI | |
| on: | |
| push: | |
| branches: [ main, main-dev, develop, refactor/* ] | |
| pull_request: | |
| branches: [ main, main-dev, develop ] | |
| workflow_dispatch: | |
| jobs: | |
| # 安装和测试 | |
| test: | |
| name: Install and Test (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.8', '3.9', '3.10', '3.11'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . | |
| pip install pytest pytest-benchmark | |
| - name: Verify installation | |
| run: | | |
| python -c "import numpy, pandas, yaml; print('✓ Core packages OK')" | |
| python -c "from bench import BenchmarkRunner; print('✓ Framework OK')" | |
| python -c "from datasets import DATASETS; print(f'✓ {len(DATASETS)} datasets available')" | |
| - name: Run tests | |
| run: | | |
| pytest tests/ -v -m "not slow" | |
| # 代码质量检查 | |
| lint: | |
| name: Code Quality Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install linting tools | |
| run: | | |
| pip install flake8 black | |
| - name: Check code formatting | |
| run: | | |
| black --check bench/ datasets/ tests/ || true | |
| - name: Lint with flake8 | |
| run: | | |
| flake8 bench/ datasets/ tests/ --count --max-line-length=127 --statistics || true | |
| # Docker构建测试 | |
| docker: | |
| name: Docker Build Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: false | |
| - name: Build Docker image | |
| run: | | |
| docker build -t sage-db-bench:test . | |
| - name: Test Docker image | |
| run: | | |
| docker run --rm sage-db-bench:test python -c "from bench import BenchmarkRunner; print('✓ Docker OK')" |