Improve Coverage & Add Tests #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Test | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
workflow_dispatch: | |
inputs: | |
host: | |
description: "Host to Test" | |
type: string | |
required: false | |
default: "one.one.one.one" | |
ipv6: | |
description: "IPv6 to Test" | |
type: string | |
required: false | |
default: "2606:4700:4700::1111" | |
critical: | |
description: "Critical Level to Test" | |
type: string | |
required: false | |
default: "99" | |
warning: | |
description: "Warning Level to Test" | |
type: string | |
required: false | |
default: "99" | |
env: | |
COVERALLS_VERSION: "3.11" | |
TEST_HOST: ${{ github.event.inputs.host || 'one.one.one.one' }} | |
TEST_IPV6: ${{ github.event.inputs.ipv4 || '2606:4700:4700::1111' }} | |
CRITICAL: ${{ github.event.inputs.critical || '99' }} | |
WARNING: ${{ github.event.inputs.warning || '99' }} | |
jobs: | |
test: | |
name: Test | |
timeout-minutes: 5 | |
if: ${{ !contains(github.event.head_commit.message, '#noci') }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, ubuntu-20.04] | |
version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] | |
exclude: | |
- os: ubuntu-22.04 | |
version: "3.6" | |
- os: ubuntu-20.04 | |
version: "3.7" | |
- os: ubuntu-20.04 | |
version: "3.8" | |
- os: ubuntu-20.04 | |
version: "3.9" | |
- os: ubuntu-20.04 | |
version: "3.10" | |
- os: ubuntu-20.04 | |
version: "3.11" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v3 | |
- name: "Setup Python ${{ matrix.version }}" | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.version }} | |
- name: "Dependencies ${{ matrix.version }}" | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 coverage | |
- name: "Lint ${{ matrix.version }}" | |
run: | | |
flake8 check_rbl.py | |
- name: "Test ${{ matrix.version }}" | |
run: | | |
coverage run check_rbl.py ||: | |
coverage run -a check_rbl.py -w $WARNING ||: | |
coverage run -a check_rbl.py -a $TEST_IPV4 -h $TEST_HOST ||: | |
coverage run -a check_rbl.py --ipv4 $TEST_IPV4 --ipv6 $TEST_IPV6 ||: | |
coverage run -a check_rbl.py -h invalid.com ||: | |
coverage run -a check_rbl.py -d -w $WARNING -c $CRITICAL -h $TEST_HOST | |
coverage run -a check_rbl.py -d -w $WARNING -c $CRITICAL -a $TEST_IPV6 | |
coverage report -m | |
- name: "Coveralls" | |
if: ${{ matrix.version == env.COVERALLS_VERSION }} | |
uses: coverallsapp/github-action@v2 |