Skip to content
Merged
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
45 changes: 26 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,17 @@ on:

jobs:
test:

runs-on: ubuntu-latest

services:
postgres:
image: postgres:16

env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: tasktracker

ports:
- 5432:5432

options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s
Expand All @@ -40,27 +36,38 @@ jobs:
LOG_LEVEL: INFO

steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python -m pip install -r requirements.txt

- name: Run Tests
run: |
pytest -v
- name: Run tests
run: python -m pytest -v

- name: Generate Coverage Report
run: |
pytest --cov=app --cov-report=term-missing
- name: Generate coverage report
run: python -m pytest --cov=app --cov-report=term-missing

- name: Build Docker Image
run: |
docker build -t tasktracker:latest .
publish:
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev')
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/tasktracker:latest
Loading