ci: fixes

This commit is contained in:
Karim shoair
2026-07-27 12:34:46 +03:00
parent fc96fcc386
commit ebb0dbfdc3
3 changed files with 39 additions and 19 deletions
+14 -11
View File
@@ -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
+24 -7
View File
@@ -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
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 }}
+1 -1
View File
@@ -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 =