Skip to content

Commit

Permalink
Merge pull request #10 from paveldat/dev/pdat
Browse files Browse the repository at this point in the history
Add test pipeline
  • Loading branch information
paveldat committed Sep 11, 2023
2 parents 3d52808 + af71976 commit 4cbdcaa
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 37 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/deploy-job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build, Test, Deploy

on: [push]

jobs:
info:
runs-on: ubuntu-latest
steps:
- name: Print node info
run: |
cat /etc/os-release
build:
runs-on: ubuntu-latest
needs: info
strategy:
matrix:
python-version: [ "3.10" ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
sudo apt install pycodestyle
pip install pylint build
- name: Build package
run: |
python -m build .
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: built-artifacts
path: dist
retention-days: 1
test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
sudo apt install pycodestyle pylint
pip install -r py-requirements.txt
- name: Analysing the code with pycodestyle
run: |
pycodestyle src/**/*.py
- name: Analysing the code with pylint
run: |
pylint src/**/*.py
deploy:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: built-artifacts
path: dist
23 changes: 0 additions & 23 deletions .github/workflows/pylint.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[MESSAGES CONTROL]
disable = C0413, W1203, W0703, R1710, R0903, R1732,
R0201, W1508, R0801
10 changes: 5 additions & 5 deletions py-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pathlib
dnspython
dnspython >= 2.2.1
requests
python-nmap
python-nmap >= 0.7.1
build
folium
opencage
phonenumbers
folium >= 0.14.0
opencage >= 2.1.0
phonenumbers >= 8.13.2
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ where = src
include = clickjacking, dns_lookup, exec_shell_command, http_headers_grabber,
ip, logger, nmap_scanner, robots_scanner, whois_lookup, ip_info_finder,
pwned, phone_info

[pycodestyle]
ignore = E402, W504, E123
max-line-length = 160
10 changes: 5 additions & 5 deletions src/nmap_scanner/nmap_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"""

import sys
import nmap
import logging
import nmap

sys.path.insert(
0,
Expand Down Expand Up @@ -73,10 +73,10 @@ def nmap_scanner(target: str, arguments: str = '',
except KeyError:
logger.raise_fatal(ValueError(f'Cannot scan {proto}'))

for port in lports:
state = nm_scan[host][proto][port]["state"]
logger.debug(f'Port: {port} State: {state}')
ports_state[port] = state
for port in lports:
state = nm_scan[host][proto][port]["state"]
logger.debug(f'Port: {port} State: {state}')
ports_state[port] = state

return ports_state
except Exception as ex:
Expand Down
9 changes: 6 additions & 3 deletions src/phone_info/phone_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"""

import sys
import folium
import logging
import opencage
import phonenumbers
from pathlib import Path

import folium
import phonenumbers
from phonenumbers import geocoder, carrier
from opencage.geocoder import OpenCageGeocode

Expand Down Expand Up @@ -47,6 +47,9 @@ def __init__(self,

@property
def number(self) -> str:
"""
Property number method.
"""
return self.__number

@number.setter
Expand Down
2 changes: 1 addition & 1 deletion src/pwned/pwned.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def check_password(password: str, debug: bool = False) -> bool:
logger.info('Pwned')
logger.debug(f'{password} has previously appeared in '
f'a data breach, used {hashes[hash_string]} times, '
'and should never be used')
'and should never be used')
return True

logger.info('No pwnage found')
Expand Down

0 comments on commit 4cbdcaa

Please sign in to comment.