Skip to content

🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev

ci: fixes

Karim shoairebb0dbfdc392
diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml
index 2ff127e..5156c6c 100644
--- a/.github/workflows/docker-build.yml
+++ b/.github/workflows/docker-build.yml
@@ -7,10 +7,10 @@ on:
- main
workflow_dispatch:
inputs:
- tag:
- description: 'Docker image tag'
- required: true
- default: 'latest'
+ version:
+ description: "Release version to tag the images with, like 'v0.4.12'. Leave it empty to only push 'latest'"
+ required: false
+ default: ''
env:
DOCKERHUB_IMAGE: pyd4vinci/scrapling
@@ -28,17 +28,20 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v6
- - name: Extract release version from PR title
+ # Releases come from the merged PR's title, the same source `release-and-publish.yml` uses, while a manual
+ # run can pass the version itself to republish an image the release build failed to push.
+ - name: Resolve the release version
id: version
- if: ${{ github.event_name == 'pull_request' && github.event.pull_request.merged == true }}
env:
PR_TITLE: ${{ github.event.pull_request.title }}
+ INPUT_VERSION: ${{ inputs.version }}
run: |
- if [[ $PR_TITLE =~ ^v ]]; then
- echo "version=$PR_TITLE" >> "$GITHUB_OUTPUT"
- echo "Release version detected from PR title: $PR_TITLE"
+ VERSION="${INPUT_VERSION:-$PR_TITLE}"
+ if [[ $VERSION =~ ^v[0-9] ]]; then
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
+ echo "Tagging the images with $VERSION"
else
- echo "PR title '$PR_TITLE' is not a version; skipping semver tags."
+ echo "No release version given ('$VERSION'); skipping the version tags."
fi
- name: Set up Docker Buildx
@@ -92,7 +95,7 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
- cache-to: type=gha,mode=min
+ cache-to: type=gha,mode=min,ignore-error=true
build-args: |
BUILDKIT_INLINE_CACHE=1
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 0dd8508..06deb64 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -73,7 +73,7 @@ jobs:
- name: Install all browsers dependencies
run: |
python3 -m pip install --upgrade pip
- python3 -m pip install playwright==1.61.0 patchright==1.61.1
+ python3 -m pip install playwright==1.61.0 patchright==1.61.2
- name: Get Playwright version
id: playwright-version
@@ -84,7 +84,7 @@ jobs:
- name: Retrieve Playwright browsers from cache if any
id: playwright-cache
- uses: actions/cache@v5
+ uses: actions/cache/restore@v5
with:
path: |
~/.cache/ms-playwright
@@ -105,13 +105,13 @@ jobs:
fi
python3 -m playwright install-deps chromium
- # Cache tox environments
- - name: Cache tox environments
- uses: actions/cache@v5
+ - name: Retrieve tox environments from cache if any
+ id: tox-cache
+ uses: actions/cache/restore@v5
with:
path: .tox
# Include python version and os in the cache key
- key: tox-v1-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('/Users/runner/work/Scrapling/pyproject.toml') }}
+ key: tox-v1-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'tox.ini') }}
restore-keys: |
tox-v1-${{ runner.os }}-py${{ matrix.python-version }}-
tox-v1-${{ runner.os }}-
@@ -121,4 +121,21 @@ jobs:
- name: Run tests
env: ${{ matrix.env }}
- run: tox
\ No newline at end of file
+ run: tox
+
+ - name: Save Playwright browsers to cache
+ if: github.ref == 'refs/heads/main' && steps.playwright-cache.outputs.cache-hit != 'true'
+ uses: actions/cache/save@v5
+ with:
+ path: |
+ ~/.cache/ms-playwright
+ ~/Library/Caches/ms-playwright
+ ~/.ms-playwright
+ key: ${{ steps.playwright-cache.outputs.cache-primary-key }}
+
+ - name: Save tox environments to cache
+ if: github.ref == 'refs/heads/main' && steps.tox-cache.outputs.cache-hit != 'true'
+ uses: actions/cache/save@v5
+ with:
+ path: .tox
+ key: ${{ steps.tox-cache.outputs.cache-primary-key }}
\ No newline at end of file
diff --git a/tox.ini b/tox.ini
index 29f7f6b..4ca3fdc 100644
--- a/tox.ini
+++ b/tox.ini
@@ -11,7 +11,7 @@ usedevelop = True
changedir = tests
deps =
playwright==1.61.0
- patchright==1.61.1
+ patchright==1.61.2
-r{toxinidir}/tests/requirements.txt
extras = ai,shell
commands =