Merge pull request #3 from ThePhoenixAgency/copilot/update-requiremen… #32
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: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| release: | |
| types: [published] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: [3.8, 3.9, "3.10", "3.11"] | |
| steps: | |
| - 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 dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install -r requirements-dev.txt | |
| - 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 | |
| - name: Run tests | |
| run: | | |
| pytest tests/ -v --cov=stats_toolkit --cov-report=xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.xml | |
| fail_ci_if_error: false | |
| # Tests autonomes sans dépendance au package | |
| standalone-tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.11"] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install numpy pandas scipy scikit-learn matplotlib pytest | |
| - name: Test examples autonomes | |
| run: | | |
| # Test des exemples autonomes | |
| python examples/example_usage.py | |
| python examples/utils_demo.py | |
| - name: Test classes autonomes | |
| run: | | |
| # Test des classes autonomes dans les tests | |
| python -c " | |
| import numpy as np | |
| import pandas as pd | |
| from scipy import stats | |
| # Test de classe autonome | |
| class BasicStatistics: | |
| def process(self, data): | |
| return {'mean': data.mean(), 'std': data.std()} | |
| # Test | |
| data = pd.Series([1, 2, 3, 4, 5]) | |
| stats_engine = BasicStatistics() | |
| result = stats_engine.process(data) | |
| print('Test réussi:', result) | |
| " |