name: Python Tests on: push: pull_request: jobs: pre-commit: name: pre-commit runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - uses: pre-commit/action@v2.0.0 with: extra_args: --all-files --hook-stage=manual build: # supercharge/mongodb-github-action requires containers so we don't test other platforms runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-20.04] python-version: ["3.7", "3.10", "pypy-3.8"] name: CPython ${{ matrix.python-version }}-${{ matrix.os }} steps: - uses: actions/checkout@v2 - name: Setup Python uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} cache: 'pip' cache-dependency-path: 'setup.py' - name: Start MongoDB uses: supercharge/mongodb-github-action@1.7.0 with: mongodb-version: 4.4 - name: Run tests run: | python setup.py test mypytest: name: Run mypy runs-on: ubuntu-latest strategy: matrix: python-version: ['3.7', '3.10'] fail-fast: false steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} cache: 'pip' cache-dependency-path: 'setup.py' - name: Install dependencies run: | python -m pip install -U pip mypy==0.990 pip install -e ".[zstd, encryption, ocsp]" - name: Run mypy run: | mypy --install-types --non-interactive bson gridfs tools pymongo # Test overshadowed codec_options.py file mypy --install-types --non-interactive bson/codec_options.py mypy --install-types --non-interactive --disable-error-code var-annotated --disable-error-code attr-defined --disable-error-code union-attr --disable-error-code assignment --disable-error-code no-redef --disable-error-code index --allow-redefinition --allow-untyped-globals --exclude "test/mypy_fails/*.*" test python -m pip install -U typing_extensions mypy --install-types --non-interactive test/test_typing.py test/test_typing_strict.py - name: Run mypy strict run: | mypy --strict test/test_typing_strict.py - name: Run pyright run: | python -m pip install -U pip pyright==1.1.290 pyright test/test_typing.py test/test_typing_strict.py - name: Run pyright strict run: | echo '{"strict": ["tests/test_typing_strict.py"]}' >> pyrightconfig.json pyright test/test_typing_strict.py linkcheck: name: Check Links runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: cache: 'pip' cache-dependency-path: 'setup.py' - name: Install dependencies run: | python -m pip install -U pip python -m pip install sphinx - name: Check links run: | cd doc make linkcheck