Skip to content

Commit 6cef222

Browse files
committed
Continuous depolyment finished
1 parent 485123f commit 6cef222

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

.github/workflows/github-actions-CI-CD.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,14 @@ jobs:
6060
CD:
6161
runs-on: ubuntu-latest
6262
needs: [CI]
63-
63+
environment:
64+
name: Production
6465
steps:
65-
- name: deploying stuff
66-
run: echo "Going to check for depolyment in cd"
66+
- name: Check out repository code
67+
uses: actions/checkout@v4
68+
- name: deployment on Render
69+
uses: sws2apps/render-deployment@main
70+
with:
71+
serviceId: ${{ secrets.RENDER_SERVICE_ID }}
72+
apiKey: ${{ secrets.RENDER_API_KEY }}
73+
multipleDeployment: false #optional, default true

app/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ async def lifespan(app: FastAPI):
2929

3030
@app.get("/")
3131
def read_root():
32-
return {"message": "Hello World"}
32+
return {"message": "Hello World Successfully deployed on Render via CICD"}

tests/test_users.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
def test_root(client: TestClient):
1111
res = client.get("/")
12-
assert res.json().get('message') == "Hello World"
12+
assert res.json().get('message') == "Hello World Successfully deployed on Render via CICD"
1313

1414

1515
def test_create_user(session: Session, client: TestClient):
@@ -21,6 +21,7 @@ def test_create_user(session: Session, client: TestClient):
2121
assert new_user.email == "[email protected]"
2222
assert res.status_code == 201
2323

24+
2425
@pytest.mark.parametrize("email, password, status_code", [
2526
("[email protected]", "password123", 403),
2627
("[email protected]", "wrongpassword", 403),
@@ -37,15 +38,16 @@ def test_login_user(session: Session, client: TestClient, email, password, statu
3738
assert res.json().get("detail") == "Invalid Credentials!"
3839
assert res.status_code == status_code
3940

41+
4042
def test_login_user_token_check(client: TestClient, test_user):
4143
res = client.post("/login", data={
4244
"username": "[email protected]",
4345
"password": "password123"
4446
})
4547
login_res = Token(**res.json())
46-
payload = jwt.decode(login_res.access_token, settings.secret_key, algorithms=[settings.algorithm])
48+
payload = jwt.decode(login_res.access_token,
49+
settings.secret_key, algorithms=[settings.algorithm])
4750
id = payload.get("user_id")
4851
assert id == test_user["id"]
49-
assert login_res.token_type== "bearer"
52+
assert login_res.token_type == "bearer"
5053
assert res.status_code == 200
51-

0 commit comments

Comments
 (0)