Skip to content

Commit 30171e2

Browse files
committed
updates
1 parent 47d3551 commit 30171e2

File tree

9 files changed

+29
-40
lines changed

9 files changed

+29
-40
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Continuous Integration and Delivery
33
on: [push]
44

55
env:
6-
IMAGE: docker.pkg.github.com/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/summarizer
6+
IMAGE: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/summarizer
77

88
jobs:
99

@@ -12,11 +12,11 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v2.4.0
15+
uses: actions/checkout@v3
1616
with:
1717
ref: main
1818
- name: Log in to GitHub Packages
19-
run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_ACTOR} --password-stdin docker.pkg.github.com
19+
run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_ACTOR} --password-stdin ghcr.io
2020
env:
2121
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2222
- name: Pull images
@@ -47,11 +47,11 @@ jobs:
4747
needs: build
4848
steps:
4949
- name: Checkout
50-
uses: actions/checkout@v2.4.0
50+
uses: actions/checkout@v3
5151
with:
5252
ref: main
5353
- name: Log in to GitHub Packages
54-
run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_ACTOR} --password-stdin docker.pkg.github.com
54+
run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_ACTOR} --password-stdin ghcr.io
5555
env:
5656
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5757
- name: Pull images
@@ -83,7 +83,7 @@ jobs:
8383
-p 5003:8765 \
8484
${{ env.IMAGE }}-final:latest
8585
- name: Install requirements
86-
run: docker exec fastapi-tdd pip install black==22.10.0 flake8==5.0.4 isort==5.10.1 pytest==7.2.0
86+
run: docker exec fastapi-tdd pip install black==23.1.0 flake8==6.0.0 isort==5.12.0 pytest==7.2.2
8787
- name: Pytest
8888
run: docker exec fastapi-tdd python -m pytest .
8989
- name: Flake8
@@ -98,15 +98,15 @@ jobs:
9898
runs-on: ubuntu-latest
9999
needs: [build, test]
100100
env:
101-
HEROKU_APP_NAME: guarded-eyrie-00742
101+
HEROKU_APP_NAME: radiant-everglades-49858
102102
HEROKU_REGISTRY_IMAGE: registry.heroku.com/${HEROKU_APP_NAME}/summarizer
103103
steps:
104104
- name: Checkout
105-
uses: actions/checkout@v2.4.0
105+
uses: actions/checkout@v3
106106
with:
107107
ref: main
108108
- name: Log in to GitHub Packages
109-
run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_ACTOR} --password-stdin docker.pkg.github.com
109+
run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_ACTOR} --password-stdin ghcr.io
110110
env:
111111
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112112
- name: Pull images

project/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pull official base image
2-
FROM python:3.10.8-slim-buster
2+
FROM python:3.11.2-slim-buster
33

44
# set working directory
55
WORKDIR /usr/src/app

project/Dockerfile.prod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
###########
44

55
# pull official base image
6-
FROM python:3.10.8-slim-buster as builder
6+
FROM python:3.11.2-slim-buster as builder
77

88
# install system dependencies
99
RUN apt-get update \
@@ -24,7 +24,7 @@ RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requir
2424

2525
# lint
2626
COPY . /usr/src/app/
27-
RUN pip install black==22.10.0 flake8==5.0.4 isort==5.10.1
27+
RUN pip install black==23.1.0 flake8==6.0.0 isort==5.12.0
2828
RUN flake8 .
2929
RUN black --exclude=migrations .
3030
RUN isort .
@@ -35,7 +35,7 @@ RUN isort .
3535
#########
3636

3737
# pull official base image
38-
FROM python:3.10.8-slim-buster
38+
FROM python:3.11.2-slim-buster
3939

4040
# create directory for the app user
4141
RUN mkdir -p /home/app
@@ -65,7 +65,7 @@ COPY --from=builder /usr/src/app/wheels /wheels
6565
COPY --from=builder /usr/src/app/requirements.txt .
6666
RUN pip install --upgrade pip
6767
RUN pip install --no-cache /wheels/*
68-
RUN pip install "uvicorn[standard]==0.19.0"
68+
RUN pip install "uvicorn[standard]==0.21.1"
6969

7070
# add app
7171
COPY . .

project/db/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pull official base image
2-
FROM postgres:14-alpine
2+
FROM postgres:15
33

44
# run create.sql on init
55
ADD create.sql /docker-entrypoint-initdb.d

project/requirements-dev.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
black==22.10.0
2-
flake8==5.0.4
3-
isort==5.10.1
4-
pytest==7.2.0
1+
black==23.1.0
2+
flake8==6.0.0
3+
isort==5.12.0
4+
pytest==7.2.2
55
pytest-cov==4.0.0
6-
pytest-xdist==3.0.2
6+
pytest-xdist==3.2.1
77

88
-r requirements.txt

project/requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
aerich==0.7.1
22
asyncpg==0.27.0
3-
fastapi==0.85.1
3+
fastapi==0.94.1
44
gunicorn==20.1.0
5+
httpx==0.23.3
56
newspaper3k==0.2.8
6-
requests==2.28.1
7-
tortoise-orm==0.19.2
8-
uvicorn==0.19.0
7+
tortoise-orm==0.19.3
8+
uvicorn==0.21.1

project/tests/conftest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def test_app():
1818
app = create_application()
1919
app.dependency_overrides[get_settings] = get_settings_override
2020
with TestClient(app) as test_client:
21-
2221
# testing
2322
yield test_client
2423

@@ -38,7 +37,6 @@ def test_app_with_db():
3837
add_exception_handlers=True,
3938
)
4039
with TestClient(app) as test_client:
41-
4240
# testing
4341
yield test_client
4442

project/tests/test_summaries_unit.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88

99
def test_create_summary(test_app, monkeypatch):
10+
def mock_generate_summary(summary_id, url):
11+
return None
12+
13+
monkeypatch.setattr(summaries, "generate_summary", mock_generate_summary)
14+
1015
test_request_payload = {"url": "https://foo.bar"}
1116
test_response_payload = {"id": 1, "url": "https://foo.bar"}
1217

@@ -15,11 +20,6 @@ async def mock_post(payload):
1520

1621
monkeypatch.setattr(crud, "post", mock_post)
1722

18-
def mock_generate_summary(summary_id, url):
19-
return None
20-
21-
monkeypatch.setattr(summaries, "generate_summary", mock_generate_summary)
22-
2323
response = test_app.post(
2424
"/summaries/",
2525
data=json.dumps(test_request_payload),
@@ -220,12 +220,3 @@ async def mock_put(id, payload):
220220
response = test_app.put(f"/summaries/{summary_id}/", data=json.dumps(payload))
221221
assert response.status_code == status_code
222222
assert response.json()["detail"] == detail
223-
224-
225-
def test_update_summary_invalid_url(test_app):
226-
response = test_app.put(
227-
"/summaries/1/",
228-
data=json.dumps({"url": "invalid://url", "summary": "updated!"}),
229-
)
230-
assert response.status_code == 422
231-
assert response.json()["detail"][0]["msg"] == "URL scheme not permitted"

0 commit comments

Comments
 (0)