Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 49 additions & 3 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,53 @@ on:
types: [published]

jobs:
deploy:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-asyncio responses
cd scrapegraph-py
pip install -e .

- name: Run tests with coverage
run: |
cd scrapegraph-py
python -m pytest tests/ -v --cov=scrapegraph_py --cov-report=xml --cov-report=term-missing

- name: Run real API tests (if API key available)
run: |
cd scrapegraph-py
if [ -n "$SGAI_API_KEY" ]; then
python -m pytest tests/test_real_apis.py -v --tb=short
else
echo "SGAI_API_KEY not set, skipping real API tests"
fi
env:
SGAI_API_KEY: ${{ secrets.SGAI_API_KEY }}

deploy:
needs: test
runs-on: ubuntu-latest

steps:
Expand All @@ -21,12 +66,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install setuptools wheel twine build
- name: Build and publish
env:
TWINE_USERNAME: mvincig11
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
git fetch --all --tags
python setup.py sdist bdist_wheel
cd scrapegraph-py
python -m build
twine upload dist/*
Loading
Loading