draft #104
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
pull_request: | |
branches: [ main ] | |
push: | |
branches: [ main ] | |
env: | |
PYTHON_VERSION: "3.11" | |
jobs: | |
# ============================================================================= | |
# UNIT TESTS | |
# ============================================================================= | |
unit-tests: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run tests | |
run: | | |
if [ -d "tests" ] && [ "$(find tests -name "test_*.py" -o -name "*_test.py" | wc -l)" -gt 0 ]; then | |
echo "Running tests" | |
# Run pytest and allow exit code 5 (no tests found), but fail on any other error | |
pytest tests/ -v --cov=src --cov-report=term-missing -p no:ethereum || ([ $? -eq 5 ] && echo "Pytest exited with 5 (No tests found), which is expected. Passing." || exit $?) | |
else | |
echo "No tests found. Test directory is empty or doesn't contain test files." | |
echo "Tests will be skipped until test files are added." | |
fi | |
# ============================================================================= | |
# INTEGRATION TESTS | |
# ============================================================================= | |
integration-tests: | |
name: Integration Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Validate Docker setup | |
run: docker compose config > /dev/null | |
- name: Run integration tests | |
run: | | |
if [ -d "tests/integration" ] && [ "$(find tests/integration -name '*.py' -not -name '__init__.py' | wc -l)" -gt 0 ]; then | |
echo "Running integration tests" | |
pytest tests/integration/ -v | |
else | |
echo "No integration tests found - create files in tests/integration/ directory" | |
fi |