Skip to content

Misc CI and packaging updates #75

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

Merged
merged 1 commit into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
Ubuntu:
name: 'Ubuntu (${{ matrix.python }})'
name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
timeout-minutes: 10
runs-on: 'ubuntu-latest'
strategy:
Expand All @@ -20,6 +20,16 @@ jobs:
- '3.8'
- '3.9'
- '3.10'
- 'pypy-3.7'
- 'pypy-3.8'
check_lint: ['0']
extra_name: ['']
include:
- python: '2.7'
extra_name: ', build only'
- python: '3.9'
check_lint: '1'
extra_name: ', check lint'
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -30,5 +40,6 @@ jobs:
- name: Run tests
run: ./ci.sh
env:
CHECK_LINT: '${{ matrix.check_lint }}'
# Should match 'name:' up above
JOB_NAME: 'Ubuntu (${{ matrix.python }})'
JOB_NAME: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
3 changes: 1 addition & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,11 @@ From source

To install from source::

pip install cython
git clone https://github.com/oremanj/python-netfilterqueue
cd python-netfilterqueue
pip install .

If Cython is installed, Distutils will use it to regenerate the .c source from the .pyx. It will then compile the .c into a .so.

API
===

Expand Down
36 changes: 35 additions & 1 deletion ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,43 @@ set -ex -o pipefail

pip install -U pip setuptools wheel
sudo apt-get install libnetfilter-queue-dev

python setup.py sdist --formats=zip
pip install dist/*.zip
pip install -r test-requirements.txt

if python --version 2>&1 | fgrep -q "Python 2.7"; then
# The testsuite doesn't run on 2.7, so do just a basic smoke test.
unshare -Urn python -c "from netfilterqueue import NetfilterQueue as NFQ; NFQ()"
exit $?
fi

pip install -Ur test-requirements.txt

if [ "$CHECK_LINT" = "1" ]; then
error=0
if ! black --check setup.py tests; then
cat <<EOF
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Formatting problems were found (listed above). To fix them, run

pip install -r test-requirements.txt
black setup.py tests

in your local checkout.

EOF
error=1
fi
if [ "$error" = "1" ]; then
cat <<EOF
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
EOF
fi
exit $error
fi

cd tests
pytest -W error -ra -v .
Loading