Skip to content

Python scraper based on AI

ci: reduce GitHub Actions costs by ~85% on PRs

Marco Vinciguerra403080ad82c2
diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml
deleted file mode 100644
index 2a3f6b5c..00000000
--- a/.github/workflows/code-quality.yml
+++ /dev/null
@@ -1,41 +0,0 @@
-name: Code Quality Checks
-
-on:
- push:
- paths:
- - 'scrapegraphai/**'
- - '.github/workflows/pylint.yml'
-
-jobs:
- quality:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
-
- - name: Install uv
- uses: astral-sh/setup-uv@v3
-
- - name: Install dependencies
- run: uv sync --frozen
-
- - name: Run Ruff
- run: uv run ruff check scrapegraphai
-
- - name: Run Black
- run: uv run black --check scrapegraphai
-
- - name: Run isort
- run: uv run isort --check-only scrapegraphai
-
- - name: Analysing the code with pylint
- run: uv run poe pylint-ci
-
- - name: Check Pylint score
- run: |
- pylint_score=$(uv run poe pylint-score-ci | grep 'Raw metrics' | awk '{print $4}')
- if (( $(echo "$pylint_score < 8" | bc -l) )); then
- echo "Pylint score is below 8. Blocking commit."
- exit 1
- else
- echo "Pylint score is acceptable."
- fi
diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml
index 1fb9dcdc..e64941d2 100644
--- a/.github/workflows/test-suite.yml
+++ b/.github/workflows/test-suite.yml
@@ -15,8 +15,8 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [ubuntu-latest, macos-latest, windows-latest]
- python-version: ['3.10', '3.11', '3.12']
+ os: ${{ github.event_name == 'pull_request' && fromJSON('["ubuntu-latest"]') || fromJSON('["ubuntu-latest", "macos-latest", "windows-latest"]') }}
+ python-version: ['3.10', '3.12']
steps:
- name: Checkout code
@@ -49,7 +49,7 @@ jobs:
flags: unittests
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}
- if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
+ if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
integration-tests:
name: Integration Tests
@@ -100,6 +100,7 @@ jobs:
benchmark-tests:
name: Performance Benchmarks
runs-on: ubuntu-latest
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
@@ -117,10 +118,6 @@ jobs:
run: |
uv sync
- - name: Install Playwright browsers
- run: |
- uv run playwright install chromium
-
- name: Run performance benchmarks
env:
OPENAI_APIKEY: ${{ secrets.OPENAI_APIKEY }}
@@ -143,6 +140,7 @@ jobs:
code-quality:
name: Code Quality Checks
runs-on: ubuntu-latest
+ if: github.event_name == 'push'
steps:
- name: Checkout code