fix/tests #6
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: Pytest | |
| on: | |
| push: | |
| workflow_dispatch: | |
| pull_request: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| jobs: | |
| tests: | |
| name: pytest - ${{ matrix.os }} - py${{ matrix.python-version }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-latest, windows-latest ] | |
| python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] | |
| env: | |
| PYTHONUTF8: "1" | |
| PYTHONPATH: ${{ github.workspace }}/service | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: "pip" | |
| - name: Install deps (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| shell: bash | |
| run: | | |
| set -eux | |
| python -m pip install -U pip | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi | |
| pip install pytest coverage nbformat nbclient | |
| if [ -f service/pyproject.toml ] || [ -f service/setup.cfg ] || [ -f service/setup.py ]; then | |
| pip install -e service | |
| fi | |
| - name: Install deps (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| $ErrorActionPreference = "Stop" | |
| python -m pip install -U pip | |
| if (Test-Path requirements.txt) { pip install -r requirements.txt } | |
| if (Test-Path requirements-dev.txt) { pip install -r requirements-dev.txt } | |
| pip install pytest coverage nbformat nbclient | |
| if (Test-Path service/pyproject.toml -or Test-Path service/setup.cfg -or Test-Path service/setup.py) { | |
| pip install -e service | |
| } | |
| - name: Show versions | |
| shell: bash | |
| run: | | |
| python --version | |
| pip --version | |
| pytest --version | |
| python -c "import sys,platform,os;print(platform.platform());print(sys.version);print('PYTHONPATH=',os.environ.get('PYTHONPATH'))" | |
| - name: Run tests with coverage | |
| shell: bash | |
| run: | | |
| python -m coverage run -m pytest -q | |
| python -m coverage xml -o coverage.xml | |
| - name: Upload coverage.xml | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-${{ matrix.os }}-py${{ matrix.python-version }} | |
| path: coverage.xml | |
| if-no-files-found: error | |