PYTHON-3929 Add check-manifest support (#1366)

This commit is contained in:
Steven Silvester 2023-09-15 17:54:03 -05:00 committed by GitHub
parent 14640256cb
commit 87d6a54f77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 97 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -80,6 +80,7 @@ tls = []
zstd = [
"zstandard",
]
test = ["pytest>=7"]
[project.urls]
Homepage = "http://github.com/mongodb/mongo-python-driver"

15
tox.ini
View File

@ -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 <label> fails instantly if the label does not exist
test = test
@ -40,11 +42,12 @@ labels = # Use labels and -m instead of -e so that tox -m <label> fails instantl
linkcheck = linkcheck
test-mockupdb = test-mockupdb
aws-secrets = aws-secrets
manifest = manifest
[testenv:test]
description = run base set of unit tests with no extra functionality
deps =
pytest>=7
extras =
test
commands =
python --version
pytest -v --durations=5 --maxfail=10 {posargs}
@ -52,8 +55,8 @@ commands =
[testenv:test-eg]
description = run tests using run-tests.sh Evergreen script
passenv = *
extras = test
deps =
pytest>=7
setuptools
allowlist_externals =
bash
@ -154,6 +157,12 @@ passenv = *
commands =
{[testenv:test]commands} {posargs} ./test/mockupdb
[testenv:manifest]
deps =
check-manifest
commands =
python -m check_manifest -v
[testenv:aws-secrets]
deps =
PyYAML