Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for urls present in requires_dist #1728

Merged
11 changes: 7 additions & 4 deletions .github/workflows/cpu-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:
python -m pip install --upgrade pip setuptools==59.4.0 wheel tox pybind11
python -m pip uninstall protobuf -y
python -m pip install --no-binary=protobuf protobuf
- name: Generate package for pypi
run: |
python setup.py sdist bdist_wheel
- name: Check distribution is valid
run: |
./ci/check_dist.sh
- name: Run tests
run: |
ref_type=${{ github.ref_type }}
Expand All @@ -44,9 +50,6 @@ jobs:
branch=${raw/origin\/}
fi
tox -e test-cpu -- $branch
- name: Generate package for pypi
run: |
python setup.py sdist bdist_wheel
- name: Upload pypi artifacts to github
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -132,4 +135,4 @@ jobs:
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
anaconda -t $ANACONDA_TOKEN upload -u nvidia conda/*.tar.bz2
anaconda -t $ANACONDA_TOKEN upload -u nvidia conda/*.tar.bz2
18 changes: 18 additions & 0 deletions ci/check_dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__root="$(cd "$(dirname "${__dir}")" && pwd)"

pip install pkginfo twine

pkginfo -f requires_dist ${__root}/dist/*.whl | grep "@"

if [ $? -eq 0 ]; then
cat <<EOF
::error::Found direct reference(s) in package requires_dist. Please use only normal version specifiers.
See https://peps.python.org/pep-0440/#direct-references for more details.
EOF
exit 1
fi

twine check ${__root}/dist/*