Skip to content

Merge pull request #29 from Modelgrader/refactor/repository-implement… #4

Merge pull request #29 from Modelgrader/refactor/repository-implement…

Merge pull request #29 from Modelgrader/refactor/repository-implement… #4

Workflow file for this run

name: Run Tests on PR
on:
pull_request:
branches: [ "*" ]
push:
branches: [ main, dev ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Set up environment variables
run: |
echo "PORT=8000" >> $GITHUB_ENV
echo "FRONTEND_URL=http://localhost:3000" >> $GITHUB_ENV
echo "TOKEN_LIFETIME_SECOND=3600" >> $GITHUB_ENV
echo "DATABASE_NAME=test_db.sqlite3" >> $GITHUB_ENV
echo "DATABASE_USER=test_user" >> $GITHUB_ENV
echo "DATABASE_PASSWORD=test_password" >> $GITHUB_ENV
echo "DATABASE_HOST=localhost" >> $GITHUB_ENV
echo "DATABASE_PORT=5432" >> $GITHUB_ENV
echo "SECRET_KEY=test-secret-key-for-github-actions" >> $GITHUB_ENV
echo "DEBUG=True" >> $GITHUB_ENV
- name: Run all tests
run: |
python run_all_tests.py --verbose
- name: Run tests with coverage
run: |
pip install coverage
python run_all_tests.py --coverage --verbose
- name: Test individual services
run: |
echo "Testing Account Service..."
python run_all_tests.py --services account --verbose
echo "Testing Problem Service..."
python run_all_tests.py --services problem --verbose
echo "Testing Auth Service..."
python run_all_tests.py --services auth --verbose
echo "Testing Collection Service..."
python run_all_tests.py --services collection --verbose
echo "Testing Group Service..."
python run_all_tests.py --services group --verbose
echo "Testing Submission Service..."
python run_all_tests.py --services submission --verbose
echo "Testing Topic Service..."
python run_all_tests.py --services topic --verbose