|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, develop] |
| 6 | + pull_request: |
| 7 | + branches: [main, develop] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 16 | + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Set up Python ${{ matrix.python-version }} |
| 22 | + uses: actions/setup-python@v5 |
| 23 | + with: |
| 24 | + python-version: ${{ matrix.python-version }} |
| 25 | + |
| 26 | + - name: Install Poetry |
| 27 | + uses: snok/install-poetry@v1 |
| 28 | + with: |
| 29 | + version: latest |
| 30 | + virtualenvs-create: true |
| 31 | + virtualenvs-in-project: true |
| 32 | + |
| 33 | + - name: Load cached venv |
| 34 | + id: cached-poetry-dependencies |
| 35 | + uses: actions/cache@v4 |
| 36 | + with: |
| 37 | + path: .venv |
| 38 | + key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} |
| 39 | + |
| 40 | + - name: Install dependencies |
| 41 | + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' |
| 42 | + run: poetry install --no-interaction --no-root |
| 43 | + |
| 44 | + - name: Install project |
| 45 | + run: poetry install --no-interaction |
| 46 | + |
| 47 | + - name: Run linting |
| 48 | + run: | |
| 49 | + poetry run ruff check src/ tests/ |
| 50 | + poetry run black --check src/ tests/ |
| 51 | +
|
| 52 | + - name: Run type checking |
| 53 | + run: poetry run mypy src/ |
| 54 | + |
| 55 | + - name: Run tests |
| 56 | + run: poetry run pytest --cov=value --cov-report=xml --cov-report=term-missing |
| 57 | + |
| 58 | + - name: Upload coverage to Codecov |
| 59 | + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' |
| 60 | + uses: codecov/codecov-action@v4 |
| 61 | + with: |
| 62 | + files: ./coverage.xml |
| 63 | + fail_ci_if_error: false |
| 64 | + verbose: true |
| 65 | + |
| 66 | + test-extras: |
| 67 | + runs-on: ubuntu-latest |
| 68 | + strategy: |
| 69 | + matrix: |
| 70 | + extra: [genai, langchain, all] |
| 71 | + |
| 72 | + steps: |
| 73 | + - uses: actions/checkout@v4 |
| 74 | + |
| 75 | + - name: Set up Python |
| 76 | + uses: actions/setup-python@v5 |
| 77 | + with: |
| 78 | + python-version: "3.11" |
| 79 | + |
| 80 | + - name: Install Poetry |
| 81 | + uses: snok/install-poetry@v1 |
| 82 | + with: |
| 83 | + version: latest |
| 84 | + virtualenvs-create: true |
| 85 | + virtualenvs-in-project: true |
| 86 | + |
| 87 | + - name: Install with extra [${{ matrix.extra }}] |
| 88 | + run: poetry install --no-interaction --extras ${{ matrix.extra }} |
| 89 | + |
| 90 | + - name: Verify extra imports work |
| 91 | + run: | |
| 92 | + poetry run python -c "from value import auto_instrument, get_supported_libraries; print(get_supported_libraries())" |
| 93 | +
|
| 94 | + build: |
| 95 | + runs-on: ubuntu-latest |
| 96 | + needs: [test] |
| 97 | + |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v4 |
| 100 | + |
| 101 | + - name: Set up Python |
| 102 | + uses: actions/setup-python@v5 |
| 103 | + with: |
| 104 | + python-version: "3.11" |
| 105 | + |
| 106 | + - name: Install Poetry |
| 107 | + uses: snok/install-poetry@v1 |
| 108 | + with: |
| 109 | + version: latest |
| 110 | + |
| 111 | + - name: Build package |
| 112 | + run: poetry build |
| 113 | + |
| 114 | + - name: Check package |
| 115 | + run: | |
| 116 | + pip install twine |
| 117 | + twine check dist/* |
| 118 | +
|
| 119 | + - name: Upload build artifacts |
| 120 | + uses: actions/upload-artifact@v4 |
| 121 | + with: |
| 122 | + name: dist |
| 123 | + path: dist/ |
0 commit comments