diff --git a/.github/workflows/pr-testing.yml b/.github/workflows/pr-testing.yml new file mode 100644 index 0000000..96dc4eb --- /dev/null +++ b/.github/workflows/pr-testing.yml @@ -0,0 +1,80 @@ +name: PR Testing + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.9', '3.10', '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' + cache-dependency-path: '**/requirements.txt' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pytest pytest-cov + + - name: Add src to PYTHONPATH + run: | + echo "PYTHONPATH=$PYTHONPATH:${{ github.workspace }}/src" >> $GITHUB_ENV + + - name: Create test results directory + run: mkdir -p junit + + - name: Run tests + run: | + pytest test/test_quadratic_program.py \ + --doctest-modules \ + --junitxml=junit/test-results-${{ matrix.python-version }}.xml \ + --cov=src \ + --cov-report=xml + + - name: Upload pytest test results + uses: actions/upload-artifact@v4 + with: + name: pytest-results-${{ matrix.python-version }} + path: | + junit/test-results-${{ matrix.python-version }}.xml + coverage.xml + if: always() + + # Optional: Codecov coverage reporting (uncomment and configure if you use coverage) + # coverage: + # needs: lint-and-test + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python + # uses: actions/setup-python@v5 + # with: + # python-version: '3.10' + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # pip install -r requirements.txt + # pip install pytest-cov + # - name: Run coverage + # run: | + # pytest --cov=./ --cov-report=xml + # - name: Upload coverage to Codecov + # uses: codecov/codecov-action@v4 + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5fd9de3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,22 @@ +# Core numerical and scientific libraries +numpy>=1.21.0 +pandas>=1.3.4,<2.0.0 +scipy>=1.10.1 +scikit-learn>=1.0.2,<2.0.0 +pandas + +# Optimization +qpsolvers[open_source_solvers]>=4.4.0 + +pillow +pyparsing +exceptiongroup +pluggy + +# Visualization +matplotlib>=3.5.3,<4.0.0 +iniconfig + +# Testing +pytest>=6.2.5 +pytest-cov>=4.1.0 \ No newline at end of file diff --git a/test/tests_quadratic_program.py b/test/test_quadratic_program.py similarity index 100% rename from test/tests_quadratic_program.py rename to test/test_quadratic_program.py