Remove cattrs (#2446) #3598
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
| # Continuous integration | |
| name: CI | |
| on: | |
| pull_request: | |
| types: [opened, reopened, synchronize] | |
| paths: | |
| - "sleap/**" | |
| - "tests/**" | |
| - ".github/workflows/ci.yml" | |
| - "pyproject.toml" | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| paths: | |
| - "sleap/**" | |
| - "tests/**" | |
| - ".github/workflows/ci.yml" | |
| - "pyproject.toml" | |
| jobs: | |
| # Lint with ruff | |
| lint: | |
| # This job runs: | |
| # | |
| # 1. Linting and formatting checks with ruff | |
| # | |
| # Note: This uses Google-style docstring convention | |
| # Ref: https://google.github.io/styleguide/pyguide.html | |
| name: Lint | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Setup UV | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| uv sync --extra dev --extra nn-cpu | |
| - name: Run ruff checks | |
| run: | | |
| uv run ruff check sleap tests | |
| - name: Run ruff format check | |
| run: | | |
| uv run ruff format --check sleap tests | |
| # Tests with pytest | |
| tests: | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: ["ubuntu", "windows", "mac"] | |
| # os: ["ubuntu", "windows", "mac", "self-hosted-gpu"] | |
| include: | |
| - os: ubuntu | |
| runs-on: ubuntu-latest | |
| - os: windows | |
| runs-on: windows-latest | |
| - os: mac | |
| runs-on: macos-latest | |
| # - os: self-hosted-gpu | |
| # runs-on: [self-hosted, puma, gpu, 2xgpu] | |
| name: Tests (${{ matrix.os }}) | |
| runs-on: ${{ matrix.runs-on }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Setup UV | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| python-version: "3.13" | |
| - name: Install dependencies | |
| run: | | |
| uv sync --extra dev --extra nn-cpu | |
| # uv pip install PySide6==6.7.3 # exit code 139 | |
| # uv pip install PySide6==6.8.1.1 # exit code 139 | |
| # uv pip install PySide6==6.8.3 # exit code 139 | |
| # uv pip install PySide6==6.9.1 # exit code 139 | |
| - name: Print environment info | |
| run: | | |
| uv run python --version | |
| uv pip freeze | |
| - name: Install graphics dependencies on Ubuntu | |
| if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| xvfb \ | |
| libxkbcommon-x11-0 \ | |
| libxcb1 \ | |
| libxcb-util1 \ | |
| libxcb-cursor0 \ | |
| libxcb-icccm4 \ | |
| libxcb-image0 \ | |
| libxcb-keysyms1 \ | |
| libxcb-render0 \ | |
| libxcb-render-util0 \ | |
| libxcb-shm0 \ | |
| libxcb-xfixes0 \ | |
| libxcb-randr0 \ | |
| libxcb-shape0 \ | |
| libxcb-xinerama0 \ | |
| libx11-xcb1 \ | |
| libxext6 \ | |
| libxi6 \ | |
| libxrender1 \ | |
| libxrandr2 \ | |
| libfontconfig1 \ | |
| libdbus-1-3 \ | |
| libfreetype6 \ | |
| libegl1 \ | |
| libgl1 | |
| - name: Test with pytest (with coverage) | |
| env: | |
| PYTHONFAULTHANDLER: "1" | |
| OMP_NUM_THREADS: "1" | |
| MKL_NUM_THREADS: "1" | |
| OPENBLAS_NUM_THREADS: "1" | |
| NUMEXPR_NUM_THREADS: "1" | |
| QT_OPENGL: "software" | |
| # MPLBACKEND: "Agg" | |
| shell: bash | |
| run: | | |
| # Run pytest and capture the exit code | |
| set +e # Don't exit immediately on non-zero return | |
| uv run pytest --cov=sleap --cov-report=xml --durations=-1 tests/ -v | |
| EXIT_CODE=$? | |
| set -e # Re-enable exit on error | |
| # Check the exit code | |
| if [ "$EXIT_CODE" = "0" ]; then | |
| # Tests passed normally | |
| echo "Tests passed successfully" | |
| exit 0 | |
| elif [ "$EXIT_CODE" = "139" ]; then | |
| # Exit code 139 is a segfault - we're temporarily allowing this | |
| # TODO: Remove this workaround once the segfault issues are resolved | |
| echo "Warning: Tests completed with exit code 139 (segfault) - treating as pass for now" | |
| exit 0 | |
| else | |
| # Any other non-zero exit code is a failure | |
| echo "Tests failed with exit code $EXIT_CODE" | |
| exit $EXIT_CODE | |
| fi | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| fail_ci_if_error: true | |
| verbose: false | |
| token: ${{ secrets.CODECOV_TOKEN }} |