diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f72943a9..17162bda 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 @@ -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 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..ef9a9286 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ +black==24.8.0 python-whois==0.9.4 dnspython==2.6.1 \ No newline at end of file