|
| 1 | +name: Test AI |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + - release/** |
| 7 | + - sentry-sdk-2.0 |
| 8 | + pull_request: |
| 9 | +# Cancel in progress workflows on pull_requests. |
| 10 | +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 13 | + cancel-in-progress: true |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | +env: |
| 17 | + BUILD_CACHE_KEY: ${{ github.sha }} |
| 18 | + CACHED_BUILD_PATHS: | |
| 19 | + ${{ github.workspace }}/dist-serverless |
| 20 | +jobs: |
| 21 | + test-ai-latest: |
| 22 | + name: AI (latest) |
| 23 | + timeout-minutes: 30 |
| 24 | + runs-on: ${{ matrix.os }} |
| 25 | + strategy: |
| 26 | + fail-fast: false |
| 27 | + matrix: |
| 28 | + python-version: ["3.7","3.9","3.11","3.12"] |
| 29 | + # python3.6 reached EOL and is no longer being supported on |
| 30 | + # new versions of hosted runners on Github Actions |
| 31 | + # ubuntu-20.04 is the last version that supported python3.6 |
| 32 | + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 |
| 33 | + os: [ubuntu-20.04] |
| 34 | + steps: |
| 35 | + |
| 36 | + - uses: actions/setup-python@v5 |
| 37 | + with: |
| 38 | + python-version: ${{ matrix.python-version }} |
| 39 | + - name: Setup Test Env |
| 40 | + run: | |
| 41 | + pip install coverage tox |
| 42 | + - name: Erase coverage |
| 43 | + run: | |
| 44 | + coverage erase |
| 45 | + - name: Test anthropic latest |
| 46 | + run: | |
| 47 | + set -x # print commands that are executed |
| 48 | + ./scripts/runtox.sh "py${{ matrix.python-version }}-anthropic-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch |
| 49 | + - name: Test cohere latest |
| 50 | + run: | |
| 51 | + set -x # print commands that are executed |
| 52 | + ./scripts/runtox.sh "py${{ matrix.python-version }}-cohere-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch |
| 53 | + - name: Test langchain latest |
| 54 | + run: | |
| 55 | + set -x # print commands that are executed |
| 56 | + ./scripts/runtox.sh "py${{ matrix.python-version }}-langchain-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch |
| 57 | + - name: Test openai latest |
| 58 | + run: | |
| 59 | + set -x # print commands that are executed |
| 60 | + ./scripts/runtox.sh "py${{ matrix.python-version }}-openai-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch |
| 61 | + - name: Test huggingface_hub latest |
| 62 | + run: | |
| 63 | + set -x # print commands that are executed |
| 64 | + ./scripts/runtox.sh "py${{ matrix.python-version }}-huggingface_hub-latest" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch |
| 65 | + - name: Generate coverage XML |
| 66 | + run: | |
| 67 | + coverage combine .coverage* |
| 68 | + coverage xml -i |
| 69 | + - uses: codecov/codecov-action@v4 |
| 70 | + with: |
| 71 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 72 | + files: coverage.xml |
| 73 | + test-ai-pinned: |
| 74 | + name: AI (pinned) |
| 75 | + timeout-minutes: 30 |
| 76 | + runs-on: ${{ matrix.os }} |
| 77 | + strategy: |
| 78 | + fail-fast: false |
| 79 | + matrix: |
| 80 | + python-version: ["3.7","3.9","3.11","3.12"] |
| 81 | + # python3.6 reached EOL and is no longer being supported on |
| 82 | + # new versions of hosted runners on Github Actions |
| 83 | + # ubuntu-20.04 is the last version that supported python3.6 |
| 84 | + # see https://github.com/actions/setup-python/issues/544#issuecomment-1332535877 |
| 85 | + os: [ubuntu-20.04] |
| 86 | + steps: |
| 87 | + |
| 88 | + - uses: actions/setup-python@v5 |
| 89 | + with: |
| 90 | + python-version: ${{ matrix.python-version }} |
| 91 | + - name: Setup Test Env |
| 92 | + run: | |
| 93 | + pip install coverage tox |
| 94 | + - name: Erase coverage |
| 95 | + run: | |
| 96 | + coverage erase |
| 97 | + - name: Test anthropic pinned |
| 98 | + run: | |
| 99 | + set -x # print commands that are executed |
| 100 | + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-anthropic" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch |
| 101 | + - name: Test cohere pinned |
| 102 | + run: | |
| 103 | + set -x # print commands that are executed |
| 104 | + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-cohere" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch |
| 105 | + - name: Test langchain pinned |
| 106 | + run: | |
| 107 | + set -x # print commands that are executed |
| 108 | + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-langchain" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch |
| 109 | + - name: Test openai pinned |
| 110 | + run: | |
| 111 | + set -x # print commands that are executed |
| 112 | + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-openai" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch |
| 113 | + - name: Test huggingface_hub pinned |
| 114 | + run: | |
| 115 | + set -x # print commands that are executed |
| 116 | + ./scripts/runtox.sh --exclude-latest "py${{ matrix.python-version }}-huggingface_hub" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch |
| 117 | + - name: Generate coverage XML |
| 118 | + run: | |
| 119 | + coverage combine .coverage* |
| 120 | + coverage xml -i |
| 121 | + - uses: codecov/codecov-action@v4 |
| 122 | + with: |
| 123 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 124 | + files: coverage.xml |
| 125 | + check_required_tests: |
| 126 | + name: All AI tests passed |
| 127 | + needs: test-ai-pinned |
| 128 | + # Always run this, even if a dependent job failed |
| 129 | + if: always() |
| 130 | + runs-on: ubuntu-20.04 |
| 131 | + steps: |
| 132 | + - name: Check for failures |
| 133 | + if: contains(needs.test-ai-pinned.result, 'failure') || contains(needs.test-ai-pinned.result, 'skipped') |
| 134 | + run: | |
| 135 | + echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 |
0 commit comments