Skip to content

feat: move Redis family to clientless validation #586

feat: move Redis family to clientless validation

feat: move Redis family to clientless validation #586

Workflow file for this run

name: Tests And Linting
on:
push:
branches:
- main
pull_request:
concurrency:
group: test-${{ github.head_ref }}
cancel-in-progress: true
env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
jobs:
test:
name: Python ${{ matrix.python-version }} - ${{ matrix.cdist-group }}/3
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
cdist-group: [1, 2, 3]
steps:
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Intall dependencies
run: uv sync --frozen --all-extras
# Pre-pull docker images with retry to absorb transient registry failures
# (MCR WAF blocks on mcr.microsoft.com, Docker Hub anonymous rate limits)
# before pytest starts spawning fixture subprocesses. Pull in parallel
# (-P 6) - sequential pulls of ~30 images cost 10+ min on a runner.
- name: Pre-pull docker images
run: |
set -u
images=(
"mcr.microsoft.com/azure-storage/azurite"
"mcr.microsoft.com/mssql/server:2022-latest"
"dolthub/dolt-sql-server:latest"
"postgres:11" "postgres:12" "postgres:13" "postgres:14"
"postgres:15" "postgres:16" "postgres:17" "postgres:18"
"pgvector/pgvector:pg15"
"paradedb/paradedb:0.21.5-pg16"
"google/alloydbomni:16"
"mysql:5.6" "mysql:5.7" "mysql:8"
"mariadb:11.3"
"gvenzl/oracle-free:23-slim-faststart"
"gvenzl/oracle-xe:18-slim-faststart"
"redis:latest"
"valkey/valkey:latest"
"mongo:latest"
"cockroachdb/cockroach:latest"
"software.yugabyte.com/yugabytedb/yugabyte:latest"
"quay.io/minio/minio"
"minio/mc:latest"
"rustfs/rustfs:latest"
"rustfs/rc:latest"
"gcr.io/cloud-spanner-emulator/emulator:latest"
"ghcr.io/goccy/bigquery-emulator:latest"
"gizmodata/gizmosql:latest"
)
printf '%s\n' "${images[@]}" | xargs -n1 -P6 -I{} bash -c '
image="$1"
for attempt in 1 2 3 4 5; do
if docker pull --quiet "$image"; then
exit 0
fi
[ "$attempt" -lt 5 ] && sleep $((attempt * attempt * 5))
done
echo "::warning::Failed to pull $image after 5 attempts"
' _ {}
- if: matrix.python-version == '3.12'
name: Run tests with coverage tracking
run: uv run pytest --cdist-group=${{ matrix.cdist-group }}/3 -k "not elasticsearch"
- if: matrix.python-version != '3.12'
name: Run tests without tracking coverage
run: uv run pytest --cdist-group=${{ matrix.cdist-group }}/3 -k "not elasticsearch"
- if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v7
with:
name: coverage-xml
path: coverage.xml
- if: matrix.python-version == '3.12'
name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: litestar-org/pytest-databases
# run elasticsearch in a separate step. it's too slow
test_elasticsearch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: 3.9
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Intall dependencies
run: uv sync --frozen --all-extras
- name: Pre-pull docker images
run: |
set -u
for image in "elasticsearch:7.17.19" "elasticsearch:8.13.0"; do
for attempt in 1 2 3 4 5; do
if docker pull --quiet "$image"; then
break
fi
[ "$attempt" -eq 5 ] && echo "::warning::Failed to pull $image" || sleep $((attempt * attempt * 5))
done
done
- name: Run tests with coverage tracking
run: uv run pytest -k elasticsearch
# sonar:
# needs:
# - test
# - test_elasticsearch
# if: github.event.pull_request.head.repo.fork == false && github.repository_owner == 'litestar-org'
# runs-on: ubuntu-latest
# steps:
# - name: Check out repository
# uses: actions/checkout@v7
# with:
# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
# - name: Download Artifacts
# uses: actions/download-artifact@v4
# with:
# name: coverage-xml
# - name: Fix coverage file for sonarcloud
# run: sed -i "s/home\/runner\/work\/pytest-databases\/pytest-databases/github\/workspace/g" coverage.xml
# - name: SonarCloud Scan
# uses: sonarsource/sonarcloud-github-action@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}