mosec 0.9.0

Model Serving made Efficient in the Cloud.
name: lint and test

on:
  pull_request:
    paths:
      - '.github/workflows/check.yml'
      - 'mosec/**'
      - 'src/**'
      - 'tests/**'
      - 'examples/**'
      - 'setup.py'
      - 'pyproject.toml'
      - 'Cargo.lock'
      - 'Cargo.toml'
      - 'requirements/**'
  push:
    branches:
      - main
    paths:
      - '.github/workflows/check.yml'
      - 'mosec/**'
      - 'src/**'
      - 'tests/**'
      - 'examples/**'
      - 'setup.py'
      - 'pyproject.toml'
      - 'Cargo.lock'
      - 'Cargo.toml'
      - 'requirements/**'
  merge_group:

concurrency:
  group: ${{ github.ref }}-${{ github.workflow }}
  cancel-in-progress: true

jobs:
  lint:
    runs-on: ubuntu-latest
    timeout-minutes: 5
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-python@v5
        with:
          python-version: 3.8
      - name: Install dependencies
        run: make install
      - name: install node for pyright
        uses: actions/setup-node@v4
        with:
          node-version: 18
      - name: install pyright
        run: npm install -g pyright
      - name: Lint
        run: make lint semantic_lint

  test:
    runs-on: ${{ matrix.os }}
    timeout-minutes: 20
    strategy:
      max-parallel: 18
      matrix:
        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
        os: [ubuntu-latest , macos-13, macos-14]
        exclude:
          - python-version: "3.8"
            os: "macos-14"
          - python-version: "3.9"
            os: "macos-14"

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
          allow-prereleases: true
      - name: Set up Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: nightly
      - name: Install components
        run: |
          python -m pip install --upgrade pip
          rustup component add clippy
      - name: Test unit
        # ignore the mixin test for Python 3.13 since some of the dependencies are not ready
        if: ${{ startsWith(matrix.python-version, '3.13')}}
        run: |
          make test_unit
      - name: Test
        if: ${{ !startsWith(matrix.python-version, '3.13')}}
        run: |
          make test
      - name: Test shm in Linux
        # ignore the shm test for Python 3.12 since pyarrow doesn't have py3.12 wheel with version < 12
        if: ${{ startsWith(matrix.os, 'ubuntu') && !startsWith(matrix.python-version, '3.12') && !startsWith(matrix.python-version, '3.13') }}
        run: |
          docker run --rm -d --name redis -p 6379:6379 redis
          make test_shm
          docker stop redis