diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 13cbd282b..9c2c5d2bb 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -4,18 +4,32 @@ on: push: pull_request: +concurrency: + group: tests-${{ github.ref }} + cancel-in-progress: true + +defaults: + run: + shell: bash -eux {0} + jobs: - pre-commit: - name: pre-commit + lint: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - uses: pre-commit/action@v2.0.0 + - uses: actions/setup-python@v3 with: - extra_args: --all-files --hook-stage=manual + python-version: 3.8 + cache: 'pip' + cache-dependency-path: 'pyproject.toml' + - name: Install Python dependencies + run: | + python -m pip install -U pip tox + - name: Run linters + run: | + tox -m lint-manual + tox -m manifest build: # supercharge/mongodb-github-action requires containers so we don't test other platforms @@ -106,3 +120,49 @@ jobs: - name: Build docs run: | tox -m doc + + make_sdist: + runs-on: ubuntu-latest + name: "Make an sdist" + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + cache: 'pip' + cache-dependency-path: 'pyproject.toml' + - name: Build SDist + shell: bash + run: | + pip install build + python -m build --sdist + - uses: actions/upload-artifact@v3 + with: + name: "sdist" + path: dist/*.tar.gz + + test_sdist: + runs-on: ubuntu-latest + needs: [make_sdist] + name: Install from SDist and Test + timeout-minutes: 20 + steps: + - name: Download sdist + uses: actions/download-artifact@v3 + - name: Unpack SDist + shell: bash + run: | + cd sdist + mkdir test + tar --strip-components=1 -zxf *.tar.gz -C ./test + - uses: actions/setup-python@v2 + with: + cache: 'pip' + cache-dependency-path: 'sdist/test/pyproject.toml' + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.7.0 + - name: Run Test + shell: bash + run: | + cd sdist/test + pip install -e ".[test]" + pytest -v diff --git a/MANIFEST.in b/MANIFEST.in index d017d16ab..444da54d5 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,14 +1,32 @@ include README.rst include LICENSE include THIRD-PARTY-NOTICES +include *.ini +exclude .coveragerc +exclude .flake8 +exclude .git-blame-ignore-revs +exclude .pre-commit-config.yaml +exclude .readthedocs.yaml +exclude CONTRIBUTING.rst +exclude RELEASE.rst recursive-include doc *.rst recursive-include doc *.py recursive-include doc *.conf recursive-include doc *.css recursive-include doc *.js recursive-include doc *.png +include doc/Makefile +include doc/_templates/layout.html +include doc/docs-requirements.txt +include doc/make.bat +include doc/static/periodic-executor-refs.dot recursive-include tools *.py include tools/README.rst +include green_framework_test.py recursive-include test *.pem recursive-include test *.py +recursive-include test *.json recursive-include bson *.h +prune test/mod_wsgi_test +prune test/lambda +prune .evergreen diff --git a/pyproject.toml b/pyproject.toml index 0c0db366a..66afea4c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,6 +80,7 @@ tls = [] zstd = [ "zstandard", ] +test = ["pytest>=7"] [project.urls] Homepage = "http://github.com/mongodb/mongo-python-driver" diff --git a/tox.ini b/tox.ini index c0fafb251..c3ac6a339 100644 --- a/tox.ini +++ b/tox.ini @@ -25,6 +25,8 @@ envlist = doc-test, # Linkcheck sphinx docs linkcheck + # Check the sdist integrity. + manifest labels = # Use labels and -m instead of -e so that tox -m