|
| 1 | +# This workflow comes from https://github.com/ofek/hatch-mypyc |
| 2 | +# https://github.com/ofek/hatch-mypyc/blob/5a198c0ba8660494d02716cfc9d79ce4adfb1442/.github/workflows/test.yml |
| 3 | +name: Test / dspy |
| 4 | + |
| 5 | +on: |
| 6 | + schedule: |
| 7 | + - cron: "0 0 * * *" |
| 8 | + pull_request: |
| 9 | + paths: |
| 10 | + - "integrations/dspy/**" |
| 11 | + - "!integrations/dspy/*.md" |
| 12 | + - ".github/workflows/dspy.yml" |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: dspy-${{ github.head_ref }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +env: |
| 19 | + PYTHONUNBUFFERED: "1" |
| 20 | + FORCE_COLOR: "1" |
| 21 | + |
| 22 | +defaults: |
| 23 | + run: |
| 24 | + working-directory: integrations/dspy |
| 25 | + |
| 26 | +jobs: |
| 27 | + run: |
| 28 | + name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} |
| 29 | + runs-on: ${{ matrix.os }} |
| 30 | + strategy: |
| 31 | + fail-fast: false |
| 32 | + matrix: |
| 33 | + os: [ubuntu-latest] |
| 34 | + python-version: ["3.10", "3.13"] |
| 35 | + |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v6 |
| 38 | + |
| 39 | + - name: Set up Python ${{ matrix.python-version }} |
| 40 | + uses: actions/setup-python@v6 |
| 41 | + with: |
| 42 | + python-version: ${{ matrix.python-version }} |
| 43 | + |
| 44 | + - name: Install Hatch |
| 45 | + run: pip install hatch "virtualenv<21.0.0" |
| 46 | + |
| 47 | + - name: Lint |
| 48 | + if: matrix.python-version == '3.10' && runner.os == 'Linux' |
| 49 | + run: hatch run fmt-check && hatch run test:types |
| 50 | + |
| 51 | + - name: Run tests |
| 52 | + run: hatch run test:cov-retry |
| 53 | + |
| 54 | + - name: Run unit tests with lowest direct dependencies |
| 55 | + run: | |
| 56 | + hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt |
| 57 | + hatch -e test env run -- uv pip install -r requirements_lowest_direct.txt |
| 58 | + hatch run test:unit |
| 59 | +
|
| 60 | + - name: Nightly - run unit tests with Haystack main branch |
| 61 | + if: github.event_name == 'schedule' |
| 62 | + run: | |
| 63 | + hatch env prune |
| 64 | + hatch -e test env run -- uv pip install git+https://github.com/deepset-ai/haystack.git@main |
| 65 | + hatch run test:unit |
| 66 | +
|
| 67 | + notify-slack-on-failure: |
| 68 | + needs: run |
| 69 | + if: failure() && github.event_name == 'schedule' |
| 70 | + runs-on: ubuntu-slim |
| 71 | + steps: |
| 72 | + - uses: deepset-ai/notify-slack-action@v1 |
| 73 | + with: |
| 74 | + slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_NOTIFICATIONS }} |
0 commit comments