Skip to content

Add Test Suite for Sitelen Pona Writing App #49

Add Test Suite for Sitelen Pona Writing App

Add Test Suite for Sitelen Pona Writing App #49

name: Writing App Tests
on:
push:
paths:
- 'writing-app/**'
- '.github/workflows/writing-app-tests.yml'
pull_request:
paths:
- 'writing-app/**'
- '.github/workflows/writing-app-tests.yml'
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./writing-app
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies with `pip`
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest # Ensure pytest is installed
pip list # Debugging step to check installed packages
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1 ffmpeg libsm6 libxext6
- name: Start Streamlit App (Run in Background)
env:
STREAMLIT_BROWSER_GATHER_USAGE_STATS: false
STREAMLIT_SERVER_ADDRESS: localhost
STREAMLIT_SERVER_PORT: 8501
STREAMLIT_SERVER_HEADLESS: true
PYTHONPATH: ${{ github.workspace }}/writing-app
run: |
streamlit run app.py &
sleep 3 # Allow time for Streamlit to initialize
- name: Create models directory
run: mkdir -p models
- name: Run tests with Debug Logging
run: |
cd ${{ github.workspace }}/writing-app
PYTHONPATH=${{ github.workspace }}/writing-app pytest tests/test_app.py -v --log-cli-level=INFO --rootdir=${{ github.workspace }}/writing-app