Skip to content

[pre-commit.ci] pre-commit autoupdate #331

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #331

Workflow file for this run

name: Unit Tests
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
pytest:
name: pytest
runs-on: ${{matrix.os}}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: False
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # makes sure that we also fetch main
- name: Initialize vendored libs
run:
git submodule update --init --recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Start MongoDB
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: supercharge/[email protected]
with:
mongodb-version: latest
- name: Install dependencies
run: |
python -W ignore -m pip install --upgrade pip
python -W ignore -m pip install -r requirements.txt
python -W ignore -m pip install -r requirements-dev.txt
- name: Test with pytest
run: |
if [[ ${{ github.event_name }} == pull_request ]]; then
git checkout main
git checkout ${{ github.event.pull_request.head.sha }}
python run_tests.py -c
else
python run_tests.py
fi
exit_code=$?
# run build-tests only on <3.10 for now as long as there are contributions that require
# ptb <v20
if [[ ${{ matrix.python-version }} == 3.10 ]]; then
meta_exit=0
else
pytest -v tests/test_meta.py
meta_exit=$?
fi
global_exit=$(( exit_code > meta_exit ? exit_code : meta_exit ))
exit ${global_exit}
env:
JOB_INDEX: ${{ strategy.job-index }}
TEST_BUILD: "true"
shell: bash --noprofile --norc {0}
- name: Test Summary
id: test_summary
uses: test-summary/[email protected]
if: always() # always run, even if tests fail
with:
paths: ".test-reports/*.xml"