Skip to content

Commit

Permalink
test: added workflow (#4)
Browse files Browse the repository at this point in the history
* feat: initial commit

* chore: cleanup

* fix: code fix

* test: added tests

* test: updated trigger

* test: updated nltk lib

* test: updated flask test

* test: optimized testing
  • Loading branch information
AnsahMohammad authored May 1, 2024
1 parent af4294f commit 3241cff
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/crawl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Crawl Workflow

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m venv .env
source .env/bin/activate
pip install -r requirements.txt
- name: Test crawler and indexer
run: |
source .env/bin/activate
python3 -m src.phantom --num_threads 2 --urls "https://github.com/AnsahMohammad" "https://github.com/AnsahMohammad" --sleep 6
python3 -m nltk.downloader stopwords
python3 -m nltk.downloader punkt
python3 -m src.phantom_indexing
echo "Crawling completed"
- name: test search Engine server
run: |
source .env/bin/activate
python3 phantom.py &
sleep 10
curl -f http://localhost:5000/
echo "Flask test completed"
2 changes: 1 addition & 1 deletion crawl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ python3 -m venv .env
source .env/bin/activate

pip install -r requirements.txt
python3 -m src.phantom --num_threads 10 --urls "https://www.geeksforgeeks.org/" "https://stackoverflow.com/questions" --show_logs True --print_logs True --sleep 60
python3 -m src.phantom --num_threads 10 --urls "https://www.geeksforgeeks.org/" "https://stackoverflow.com/questions" "https://en.wikipedia.org/wiki/India" "https://developers.cloudflare.com/" --show_logs True --print_logs True --sleep 600
2 changes: 0 additions & 2 deletions phantom.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ def home():
def process_input(input_text):
result = engine.query(input_text, count=20)
#(doc, score, title)
print("results ; \n\n")
print(result)
return result

if __name__ == '__main__':
Expand Down

0 comments on commit 3241cff

Please sign in to comment.