diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f72943a9..95aaa0a9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,44 +1,55 @@ name: Tests on: push jobs: + code-style: + name: Code style + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.8 + cache: 'pip' + - run: pip install -r requirements.txt + - name: Check + run: black . --check + duplicates: name: No duplicate domains in list runs-on: ubuntu-latest - continue-on-error: true steps: - - uses: actions/checkout@v2 - name: Python setup - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: 3.8 - - name: Install pytest - run: pip install pytest + cache: 'pip' + - run: pip install -r requirements.txt - name: Check for duplicate lines run: | cd scripts python3 tests.py --type duplicates + regex: name: No regex domains in list runs-on: ubuntu-latest - continue-on-error: true steps: - - uses: actions/checkout@v2 - name: Python setup - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: 3.8 - - name: Install pytest - run: pip install pytest + cache: 'pip' + - run: pip install -r requirements.txt - name: Check if list includes regex domains run: | cd scripts python3 tests.py --type regex + unbound: name: Check Unbound list runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install Unbound run: sudo apt-get update && sudo apt-get install -y unbound - name: Check unbound list - run: unbound-checkconf unbound.conf \ No newline at end of file + run: unbound-checkconf unbound.conf diff --git a/Makefile b/Makefile index 3f22ae18..d6d47e49 100644 --- a/Makefile +++ b/Makefile @@ -16,4 +16,10 @@ whois: ## Check all domains with whois @. .venv/bin/activate; cd scripts && python domain-check-api.py dnscheck: ## Check all domains if they have a response - @. .venv/bin/activate; cd scripts && python dnscheck.py \ No newline at end of file + @. .venv/bin/activate; cd scripts && python dnscheck.py + +codestyle-check: ## Check all Python scripts code style + @. .venv/bin/activate; black . --check + +codestyle-fix: ## Fix all Python scripts code style + @. .venv/bin/activate; black . \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 5079df26..36ccab83 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,4 @@ +black==24.8.0 python-whois==0.9.4 -dnspython==2.6.1 \ No newline at end of file +dnspython==2.6.1 +pytest==8.3.2 \ No newline at end of file