name: Integration Tests on: push: branches: [ main, develop ] pull_request: branches: [ main, develop ] schedule: # Run nightly at 2 AM UTC - cron: '0 2 * * *' jobs: integration-tests: runs-on: ubuntu-latest strategy: matrix: python-version: ['3.8', '3.9', '3.10', '3.11'] fail-fast: false steps: - name: Checkout code uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - 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 system dependencies run: | sudo apt-get update sudo apt-get install -y \ build-essential \ cmake \ libopencv-dev \ python3-opencv \ ffmpeg - name: Install Python dependencies run: | python -m pip install --upgrade pip pip install -r requirements_camera.txt pip install pytest pytest-cov pytest-timeout pytest-benchmark pytest-xdist pip install numpy scipy opencv-python - name: Install package run: | pip install -e . - name: Run integration tests run: | pytest tests/integration/ \ -v \ --cov=src \ --cov-report=xml \ --cov-report=html \ --junitxml=test-results/junit.xml \ --timeout=300 - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: file: ./coverage.xml flags: integration name: codecov-integration-${{ matrix.python-version }} - name: Upload test results if: always() uses: actions/upload-artifact@v3 with: name: test-results-${{ matrix.python-version }} path: test-results/ - name: Upload coverage report if: always() uses: actions/upload-artifact@v3 with: name: coverage-report-${{ matrix.python-version }} path: coverage_html/ benchmark-tests: runs-on: ubuntu-latest needs: integration-tests steps: - name: Checkout code uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements_camera.txt pip install pytest pytest-benchmark pip install -e . - name: Run benchmark tests run: | pytest tests/benchmarks/ \ -v \ --benchmark-only \ --benchmark-json=benchmark-results.json - name: Upload benchmark results uses: actions/upload-artifact@v3 with: name: benchmark-results path: benchmark-results.json stress-tests: runs-on: ubuntu-latest needs: integration-tests if: github.event_name == 'schedule' || contains(github.event.head_commit.message, '[stress-test]') steps: - name: Checkout code uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements_camera.txt pip install pytest pytest-timeout pip install -e . - name: Run stress tests run: | pytest tests/integration/ \ -v \ -m stress \ --timeout=600 - name: Upload stress test results if: always() uses: actions/upload-artifact@v3 with: name: stress-test-results path: test-results/