|
| 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 | + name: Test Python ${{ matrix.python-version }} |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
| 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 | + cache: 'pip' |
| 26 | + |
| 27 | + - name: Install dependencies |
| 28 | + run: | |
| 29 | + python -m pip install --upgrade pip |
| 30 | + pip install -e ".[dev]" |
| 31 | +
|
| 32 | + - name: Lint with ruff |
| 33 | + run: | |
| 34 | + ruff check haystack_brightdata/ |
| 35 | +
|
| 36 | + - name: Check formatting with black |
| 37 | + run: | |
| 38 | + black --check haystack_brightdata/ |
| 39 | +
|
| 40 | + - name: Type check with mypy |
| 41 | + run: | |
| 42 | + mypy haystack_brightdata/ --ignore-missing-imports |
| 43 | + continue-on-error: true # Don't fail on type errors initially |
| 44 | + |
| 45 | + - name: Test with pytest |
| 46 | + run: | |
| 47 | + pytest tests/ -v --tb=short |
| 48 | + env: |
| 49 | + BRIGHT_DATA_API_KEY: ${{ secrets.BRIGHT_DATA_API_KEY }} |
| 50 | + |
| 51 | + lint: |
| 52 | + name: Lint and Format Check |
| 53 | + runs-on: ubuntu-latest |
| 54 | + |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + |
| 58 | + - name: Set up Python |
| 59 | + uses: actions/setup-python@v5 |
| 60 | + with: |
| 61 | + python-version: "3.11" |
| 62 | + cache: 'pip' |
| 63 | + |
| 64 | + - name: Install dependencies |
| 65 | + run: | |
| 66 | + python -m pip install --upgrade pip |
| 67 | + pip install ruff black |
| 68 | +
|
| 69 | + - name: Run ruff |
| 70 | + run: | |
| 71 | + ruff check haystack_brightdata/ --output-format=github |
| 72 | +
|
| 73 | + - name: Run black |
| 74 | + run: | |
| 75 | + black --check --diff haystack_brightdata/ |
| 76 | +
|
| 77 | + build: |
| 78 | + name: Build Package |
| 79 | + runs-on: ubuntu-latest |
| 80 | + needs: [test, lint] |
| 81 | + |
| 82 | + steps: |
| 83 | + - uses: actions/checkout@v4 |
| 84 | + |
| 85 | + - name: Set up Python |
| 86 | + uses: actions/setup-python@v5 |
| 87 | + with: |
| 88 | + python-version: "3.11" |
| 89 | + |
| 90 | + - name: Install build dependencies |
| 91 | + run: | |
| 92 | + python -m pip install --upgrade pip |
| 93 | + pip install build twine |
| 94 | +
|
| 95 | + - name: Build package |
| 96 | + run: | |
| 97 | + python -m build |
| 98 | +
|
| 99 | + - name: Check package |
| 100 | + run: | |
| 101 | + twine check dist/* |
| 102 | +
|
| 103 | + - name: Upload artifacts |
| 104 | + uses: actions/upload-artifact@v4 |
| 105 | + with: |
| 106 | + name: dist-packages |
| 107 | + path: dist/ |
| 108 | + retention-days: 7 |
0 commit comments