Skip to content

E2E Tests

E2E Tests #346

Workflow file for this run

name: E2E Tests
on:
push:
branches: [ master, main, develop ]
paths:
- 'num2words2/**'
- 'tests/**'
- '.github/workflows/e2e-tests.yml'
pull_request:
branches: [ master, main ]
paths:
- 'num2words2/**'
- 'tests/**'
schedule:
# Run daily at 2 AM UTC
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
test_limit:
description: 'Number of tests to run (empty for all)'
required: false
default: ''
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.15']
include:
# Test on PyPy as well
- os: ubuntu-latest
python-version: 'pypy-3.10'
- os: ubuntu-latest
python-version: 'pypy-3.11'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
pip install -e .
- name: Quick E2E Test (PR/Push)
if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch'
env:
PYTHONPATH: ${{ github.workspace }}${{ runner.os == 'Windows' && ';' || ':' }}${{ env.PYTHONPATH }}
run: |
python tests/test_e2e_with_sentence_function.py
continue-on-error: ${{ matrix.python-version == 'pypy-3.10' || matrix.python-version == 'pypy-3.11' }}
- name: Full E2E Test (Scheduled)
if: github.event_name == 'schedule'
env:
PYTHONPATH: ${{ github.workspace }}${{ runner.os == 'Windows' && ';' || ':' }}${{ env.PYTHONPATH }}
run: |
python tests/test_e2e_with_sentence_function.py
continue-on-error: ${{ matrix.python-version == 'pypy-3.10' || matrix.python-version == 'pypy-3.11' }}
- name: Custom E2E Test (Manual)
if: github.event_name == 'workflow_dispatch'
env:
PYTHONPATH: ${{ github.workspace }}${{ runner.os == 'Windows' && ';' || ':' }}${{ env.PYTHONPATH }}
run: |
python tests/test_e2e_with_sentence_function.py
continue-on-error: ${{ matrix.python-version == 'pypy-3.10' || matrix.python-version == 'pypy-3.11' }}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-results-${{ matrix.os }}-${{ matrix.python-version }}
path: |
*.log
test-results/
retention-days: 30
summary:
needs: test
runs-on: ubuntu-latest
if: always()
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Create summary
run: |
echo "# E2E Test Results Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Test Configuration" >> $GITHUB_STEP_SUMMARY
echo "- Trigger: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
echo "- Branch: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
echo "- Commit: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Results by Platform and Python Version" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| OS | Python | Status |" >> $GITHUB_STEP_SUMMARY
echo "|---|---|---|" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Results will be updated as jobs complete." >> $GITHUB_STEP_SUMMARY