Skip to content

Merge pull request #46 from jeremymanning/main #17

Merge pull request #46 from jeremymanning/main

Merge pull request #46 from jeremymanning/main #17

Workflow file for this run

name: Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/miniconda3/envs
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt', '**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
pip install "numpy<2" scipy transformers matplotlib seaborn pandas tqdm
pip install cleantext plotly scikit-learn wordcloud nltk
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install -e .
- name: Create test data
run: |
cd tests
python create_test_data.py
cd ..
- name: Run visualization tests
run: |
pytest tests/test_visualization.py -v --tb=short
- name: Run CLI tests
run: |
pytest tests/test_cli.py -v --tb=short
- name: Run model training tests
run: |
pytest tests/test_model_training.py -v --tb=short
- name: Test figure generation (single)
run: |
python code/generate_figures.py --figure 1a --data tests/data/test_model_results.pkl --output tests/output_single
- name: Test figure generation (all)
run: |
python code/generate_figures.py --data tests/data/test_model_results.pkl --output tests/output_all
timeout-minutes: 5
- name: Upload test artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-${{ matrix.python-version }}
path: |
tests/output_*
tests/data/*.csv
- name: Check generated files
run: python tests/check_outputs.py