Skip to content

Daily Package Test #416

Daily Package Test

Daily Package Test #416

Workflow file for this run

name: Daily Package Test
on:
schedule:
# Runs at 08:00 UTC every day
- cron: '0 8 * * *'
workflow_dispatch: # Allow manual triggering
jobs:
test-pypi-package:
name: Test PyPI Package
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Test PyPI package installation and functionality
shell: bash
run: |
# Create a fresh virtual environment
python -m venv test-env
if [[ "$RUNNER_OS" == "Windows" ]]; then
source test-env/Scripts/activate
else
source test-env/bin/activate
fi
# Install from PyPI with retries for network issues
MAX_RETRIES=3
RETRY_COUNT=0
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
echo "Installation attempt $((RETRY_COUNT + 1)) of $MAX_RETRIES"
if pip install safetext pytest pytest-xdist; then
echo "Installation successful"
break
else
RETRY_COUNT=$((RETRY_COUNT + 1))
if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then
echo "Installation failed, retrying in 10 seconds..."
sleep 10
else
echo "Installation failed after $MAX_RETRIES attempts"
exit 1
fi
fi
done
# Run the actual test suite against the PyPI-installed package
cd tests
pytest -v -n auto -m "not slow"
# Quick smoke test to ensure package works
cd ..
python -c "from safetext import SafeText; st = SafeText('en'); print('Package import successful')"
- name: Check for dependency conflicts
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
source test-env/Scripts/activate
else
source test-env/bin/activate
fi
pip check
test-development-install:
name: Test Development Installation
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.10', '3.11', '3.12', '3.13']
fail-fast: false # Continue other jobs even if one fails
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Test development installation
shell: bash
run: |
# Retry logic for uv sync
MAX_RETRIES=3
RETRY_COUNT=0
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
echo "Development installation attempt $((RETRY_COUNT + 1)) of $MAX_RETRIES"
if uv sync --extra dev; then
echo "Development installation successful"
break
else
RETRY_COUNT=$((RETRY_COUNT + 1))
if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then
echo "Development installation failed, retrying in 10 seconds..."
sleep 10
else
echo "Development installation failed after $MAX_RETRIES attempts"
exit 1
fi
fi
done
# Run full test suite including slow tests
if [[ "$RUNNER_OS" == "Windows" ]]; then
source .venv/Scripts/activate
else
source .venv/bin/activate
fi
pytest -v -n auto