Skip to content

Commit 60aa65f

Browse files
committed
Added CI workflow
1 parent 1c80e48 commit 60aa65f

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI Pipeline # The name of the workflow
2+
3+
on: # Events that trigger this workflow
4+
push: # Runs when code is pushed
5+
branches:
6+
- main
7+
pull_request: # Runs when a PR is created
8+
branches:
9+
- main
10+
11+
jobs:
12+
test: # Define a job named 'test'
13+
runs-on: ubuntu-latest # The OS where the job runs
14+
15+
steps:
16+
- name: Checkout code # Step 1: Get the repository code
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Python # Step 2: Install Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: 3.9 # Change if you need a different version
23+
24+
- name: Install dependencies # Step 3: Install required packages
25+
run: |
26+
python -m venv venv # Create a virtual environment
27+
source venv/bin/activate # Activate virtual environment
28+
pip install -r requirements.txt # Install dependencies
29+
30+
- name: Run tests # Step 4: Execute tests
31+
run: |
32+
source venv/bin/activate
33+
pytest

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ Jinja2==3.1.2
44
click==8.1.7
55
itsdangerous==2.1.2
66
MarkupSafe==2.1.3
7+
pytest

test_app.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import pytest
2+
from app import app
3+
4+
@pytest.fixture
5+
def client():
6+
app.config["TESTING"] = True
7+
with app.test_client() as client:
8+
yield client
9+
10+
def test_home_page(client):
11+
response = client.get("/")
12+
assert response.status_code == 200
13+
assert b"Welcome to Flask!" in response.data

0 commit comments

Comments
 (0)