1- name : Tests
1+ name : Test
22
33on :
44 push :
5- branches : [ main, develop ]
5+ branches : [main, develop]
66 pull_request :
7- branches : [ main ]
8- schedule :
9- - cron : ' 0 2 * * *'
7+ branches : [main, develop]
108
119jobs :
1210 test :
1311 runs-on : ubuntu-latest
1412 strategy :
1513 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@v4
23- with :
24- python-version : ${{ matrix.python-version }}
25-
26- - name : Install dependencies
27- run : |
28- python -m pip install --upgrade pip
29- pip install -r requirements.txt
30- pip install pytest pytest-cov
31-
32- - name : Test package import
33- run : |
34- python -c "import brightdata; print('Import successful')"
35-
36- - name : Run tests
37- run : |
38- python -m pytest tests/ -v --cov=brightdata --cov-report=xml
39-
40- - name : Upload coverage to Codecov
41- if : matrix.python-version == '3.8'
42- uses : codecov/codecov-action@v3
43- with :
44- file : ./coverage.xml
14+ python-version : ["3.9", "3.10", "3.11", "3.12"]
4515
46- test-pypi-package :
47- runs-on : ubuntu-latest
48- if : github.event_name == 'schedule'
49- strategy :
50- matrix :
51- python-version : ['3.8', '3.11']
52-
5316 steps :
54- - uses : actions/checkout@v4
55-
56- - name : Set up Python ${{ matrix.python-version }}
57- uses : actions/setup-python@v4
58- with :
59- python-version : ${{ matrix.python-version }}
60-
61- - name : Install PyPI package
62- run : |
63- python -m pip install --upgrade pip
64- pip install brightdata-sdk
65- pip install pytest
66-
67- - name : Test PyPI package import
68- run : |
69- python -c "import brightdata; print('PyPI package import successful')"
70- python -c "from brightdata import bdclient; print('bdclient import successful')"
71-
72- - name : Test PyPI package basic functionality
73- run : |
74- python -c "
75- import sys
76- from brightdata import bdclient, __version__
77- print(f'PyPI package version: {__version__}')
78-
79- # Test that validation works (accept any validation error as success)
80- try:
81- client = bdclient(api_token='test_token_too_short')
82- print('WARNING: No validation error - this might indicate an issue')
83- except Exception as e:
84- print(f'Validation error caught: {str(e)[:100]}...')
85- print('PyPI package validation working correctly')
86-
87- # Test basic client creation with disabled auto-zone creation
88- try:
89- client = bdclient(api_token='test_token_123456789', auto_create_zones=False)
90- print('Client creation successful')
91-
92- # Test that basic methods exist
93- methods = ['scrape', 'search', 'download_content']
94- for method in methods:
95- if hasattr(client, method):
96- print(f'Method {method} exists')
97- else:
98- print(f'Method {method} missing (might be version difference)')
99-
100- except Exception as e:
101- print(f'ERROR: Client creation failed: {e}')
102- sys.exit(1)
103-
104- print('PyPI package basic functionality test completed')
105- "
106-
107- - name : Test PyPI package compatibility
108- run : |
109- python -c "
110- print('Running PyPI package compatibility tests...')
111-
112- # Test import compatibility
113- try:
114- from brightdata import bdclient, __version__
115- from brightdata.exceptions import ValidationError
116- print('Core imports working')
117- except ImportError as e:
118- print(f'ERROR: Import failed: {e}')
119- exit(1)
120-
121- # Test that client requires token
122- try:
123- client = bdclient() # Should fail without token
124- print('WARNING: Client created without token - unexpected')
125- except Exception:
126- print('Token requirement validated')
127-
128- print('PyPI package compatibility tests completed')
129- "
17+ - uses : actions/checkout@v4
18+
19+ - name : Set up Python ${{ matrix.python-version }}
20+ uses : actions/setup-python@v5
21+ with :
22+ python-version : ${{ matrix.python-version }}
23+
24+ - name : Install dependencies
25+ run : |
26+ python -m pip install --upgrade pip
27+ pip install -e ".[dev]"
28+
29+ - name : Lint with Ruff
30+ run : |
31+ ruff check src/ tests/
32+
33+ - name : Format check with Black
34+ run : |
35+ black --check src/ tests/
36+
37+ - name : Type check with mypy (non-blocking)
38+ run : |
39+ mypy src/ --ignore-missing-imports || echo "⚠️ mypy found type issues (non-blocking)"
40+ continue-on-error : true
41+
42+ - name : Test with pytest
43+ run : |
44+ pytest tests/ -v --cov=src --cov-report=xml --cov-report=term
45+
46+ - name : Upload coverage
47+ uses : codecov/codecov-action@v3
48+ with :
49+ file : ./coverage.xml
50+ fail_ci_if_error : false
0 commit comments