From b833983b301b7f82dcd2e0245ea08d9e5edc1295 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 10 Nov 2025 17:06:04 +0000 Subject: [PATCH] Add GitHub Actions workflow for automated testing - Run unit, functional, and integration tests on push/PR - Test on Python 3.11 with Ubuntu latest - Include code coverage reporting for unit tests - Add linting job with black and flake8 - Validate all activity YAML files - Trigger on main, master, develop, and claude/** branches --- .github/workflows/test.yml | 88 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..dce4251 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,88 @@ +name: Run Tests + +on: + push: + branches: [ main, master, develop, claude/** ] + pull_request: + branches: [ main, master, develop ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.11'] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r requirements-test.txt + + - name: Run unit tests + run: | + pytest tests/unit/ -v --tb=short --cov=. --cov-report=term-missing + env: + SQLALCHEMY_DATABASE_URI: sqlite:///:memory: + TESTING: 1 + + - name: Run functional tests + run: | + pytest tests/functional/ -v --tb=short + env: + SQLALCHEMY_DATABASE_URI: sqlite:///:memory: + TESTING: 1 + + - name: Run integration tests + run: | + pytest tests/integration/ -v --tb=short + env: + SQLALCHEMY_DATABASE_URI: sqlite:///:memory: + TESTING: 1 + + - name: Validate activity YAML files + run: | + python activity_yaml_validator.py research/SPEC.yaml + python activity_yaml_validator.py research/activity*.yaml + continue-on-error: true + + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + cache: 'pip' + + - name: Install linting dependencies + run: | + python -m pip install --upgrade pip + pip install black flake8 + + - name: Check code formatting with black + run: | + black --check --diff . + continue-on-error: true + + - name: Lint with flake8 + run: | + # Stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # Exit-zero treats all errors as warnings + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + continue-on-error: true