Skip to content

Commit c8c7e7e

Browse files
authored
Merge pull request #51 from ScrapeGraphAI/fix/ci-cd
Fix/ci cd
2 parents 733b669 + 7725918 commit c8c7e7e

14 files changed

+52
-3277
lines changed

.github/workflows/python-publish.yml

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,53 @@ on:
88
types: [published]
99

1010
jobs:
11-
deploy:
11+
test:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Cache pip dependencies
26+
uses: actions/cache@v3
27+
with:
28+
path: ~/.cache/pip
29+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
30+
restore-keys: |
31+
${{ runner.os }}-pip-${{ matrix.python-version }}-
32+
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install pytest pytest-asyncio responses
37+
cd scrapegraph-py
38+
pip install -e .
39+
40+
- name: Run tests with coverage
41+
run: |
42+
cd scrapegraph-py
43+
python -m pytest tests/ -v --cov=scrapegraph_py --cov-report=xml --cov-report=term-missing
44+
45+
- name: Run real API tests (if API key available)
46+
run: |
47+
cd scrapegraph-py
48+
if [ -n "$SGAI_API_KEY" ]; then
49+
python -m pytest tests/test_real_apis.py -v --tb=short
50+
else
51+
echo "SGAI_API_KEY not set, skipping real API tests"
52+
fi
53+
env:
54+
SGAI_API_KEY: ${{ secrets.SGAI_API_KEY }}
1255

56+
deploy:
57+
needs: test
1358
runs-on: ubuntu-latest
1459

1560
steps:
@@ -21,12 +66,13 @@ jobs:
2166
- name: Install dependencies
2267
run: |
2368
python -m pip install --upgrade pip
24-
pip install setuptools wheel twine
69+
pip install setuptools wheel twine build
2570
- name: Build and publish
2671
env:
2772
TWINE_USERNAME: mvincig11
2873
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2974
run: |
3075
git fetch --all --tags
31-
python setup.py sdist bdist_wheel
76+
cd scrapegraph-py
77+
python -m build
3278
twine upload dist/*

0 commit comments

Comments
 (0)