Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 43 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,43 @@
name: Continuous Integration

on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
build:
name: Build Docker image and run end-to-end tests
runs-on: ubuntu-latest
steps:
- name: Checkout code from GitHub
uses: actions/checkout@v5

- name: Run end-to-end tests
run: >
docker compose --profile testing up
--build --exit-code-from test-service

# временно отключено
#- name: Login to Docker Hub
# uses: docker/login-action@v3
# if: ${{ github.event_name == 'push' }}
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}

# временно отключено
#- name: Push image to Docker Hub
# uses: docker/build-push-action@v6
# if: ${{ github.event_name == 'push' }}
# with:
# context: ./web
# push: true
# tags: |
# ${{ secrets.DOCKERHUB_USERNAME }}/page-tracker:${{ github.sha }}
# ${{ secrets.DOCKERHUB_USERNAME }}/page-tracker:latest





name: Continuous Integration

on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
build:
name: Build Docker image and run end-to-end tests
runs-on: ubuntu-latest
steps:
- name: Checkout code from GitHub
uses: actions/checkout@v5

- name: Run end-to-end tests
run: >
docker compose --profile testing up
--build --exit-code-from test-service

# временно отключено
#- name: Login to Docker Hub
# uses: docker/login-action@v3
# if: ${{ github.event_name == 'push' }}
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}

# временно отключено
#- name: Push image to Docker Hub
# uses: docker/build-push-action@v6
# if: ${{ github.event_name == 'push' }}
# with:
# context: ./web
# push: true
# tags: |
# ${{ secrets.DOCKERHUB_USERNAME }}/page-tracker:${{ github.sha }}
# ${{ secrets.DOCKERHUB_USERNAME }}/page-tracker:latest


2 changes: 1 addition & 1 deletion web/src/page_tracker/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def index():
page_views = redis().incr("page_views")
except RedisError:
app.logger.exception("Redis Error")
return "Sorry, something went wrong \N{PENSIVE FACE}", 500
return "Sorry, something went wrong \N{thinking FACE}", 500
else:
return f"This page has been seen {page_views} times."

Expand Down
2 changes: 1 addition & 1 deletion web/tests/unit/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_should_handle_redis_connection_error(mock_redis, http_client):

#Then
assert response.status_code == 500
assert response.text == "Sorry, something went wrong \N{pensive face}"
assert response.text == "Sorry, something went wrong \N{thinking face}"

@unittest.mock.patch("src.page_tracker.app.redis")
def test_should_call_redis_incr(mock_redis, http_client):
Expand Down
Loading