Skip to content

Commit

Permalink
Add code style check and fix commands
Browse files Browse the repository at this point in the history
  • Loading branch information
nickspaargaren committed Aug 14, 2024
1 parent b39823e commit 45279e9
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
34 changes: 29 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
name: Tests
on: push
jobs:
setup:
name: Setup Environment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: pip install -r requirements.txt

code-style:
name: Code style
runs-on: ubuntu-latest
needs: setup
steps:
- name: Check
run: black . --check

duplicates:
name: No duplicate domains in list
runs-on: ubuntu-latest
needs: setup
continue-on-error: true
steps:
- uses: actions/checkout@v2
Expand All @@ -17,22 +43,20 @@ jobs:
run: |
cd scripts
python3 tests.py --type duplicates
regex:
name: No regex domains in list
runs-on: ubuntu-latest
needs: setup
continue-on-error: true
steps:
- uses: actions/checkout@v2
name: Python setup
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install pytest
run: pip install pytest
- name: Check if list includes regex domains
run: |
cd scripts
python3 tests.py --type regex
unbound:
name: Check Unbound list
runs-on: ubuntu-latest
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
@. .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 .
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
black==24.8.0
python-whois==0.9.4
dnspython==2.6.1

0 comments on commit 45279e9

Please sign in to comment.