Skip to content

Commit 3f0871e

Browse files
authored
Merge pull request #5 from indrajithi/feature/test-workflow
Feature/test workflow
2 parents 0521af7 + db8986b commit 3f0871e

5 files changed

Lines changed: 70 additions & 59 deletions

File tree

.github/workflows/ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Lint and Test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: ["3.8", "3.9", "3.10", "3.11"]
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Set up Python ${{ matrix.python-version }}
14+
uses: actions/setup-python@v3
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install '.[dev]'
21+
pip install .
22+
pip install pylint
23+
- name: Run pylint
24+
run: |
25+
pylint tiny_web_crawler
26+
27+
test:
28+
needs: lint
29+
runs-on: ubuntu-latest
30+
strategy:
31+
matrix:
32+
python-version: ["3.8", "3.9", "3.10", "3.11"]
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: Set up Python ${{ matrix.python-version }}
36+
uses: actions/setup-python@v3
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
- name: Install dependencies
40+
run: |
41+
python -m pip install --upgrade pip
42+
pip install '.[dev]'
43+
pip install .
44+
- name: Run tests
45+
run: |
46+
pytest
47+
48+
deploy:
49+
needs: test
50+
runs-on: ubuntu-latest
51+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
52+
steps:
53+
- uses: actions/checkout@v4
54+
- name: Set up Python
55+
uses: actions/setup-python@v3
56+
with:
57+
python-version: '3.x'
58+
- name: Install dependencies
59+
run: |
60+
python -m pip install --upgrade pip
61+
pip install build
62+
- name: Build package
63+
run: python -m build
64+
- name: Publish package
65+
uses: pypa/gh-action-pypi-publish@v1.5.1
66+
with:
67+
user: __token__
68+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/pylint.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/python-publish.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name="tiny-web-crawler", # PyPI package name
5-
version="0.1.3",
5+
version="0.1.4",
66
author="Indrajith Indraprastham",
77
author_email="indr4jith@gmail.com",
88
description="A simple and efficient web crawler in Python.",

tests/test_crawler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_save_results() -> None:
6363

6464
with patch("builtins.open", mock_open()) as mocked_file:
6565
spider.save_results()
66-
mocked_file.assert_called_once_with("out.json", "w")
66+
mocked_file.assert_called_once_with("out.json", "w", encoding='utf-8')
6767

6868

6969
@patch.object(Spider, "crawl")

0 commit comments

Comments
 (0)