Projekt för CI/CD kurs
Go to file
2025-12-16 20:43:17 +01:00
.github/workflows Init repo 2025-12-16 20:02:55 +01:00
static Init repo 2025-12-16 20:02:55 +01:00
templates Init repo 2025-12-16 20:02:55 +01:00
tests Städa projekt 2025-12-16 20:06:18 +01:00
__init__.py Init repo 2025-12-16 20:02:55 +01:00
.dockerignore Lägg till stöd för docker 2025-12-16 20:43:17 +01:00
.gitignore Lägg till .gitignore 2025-12-16 20:05:05 +01:00
app.py Lägg till stöd för docker 2025-12-16 20:43:17 +01:00
db.py Init repo 2025-12-16 20:02:55 +01:00
Dockerfile Lägg till stöd för docker 2025-12-16 20:43:17 +01:00
LICENSE Initial commit 2025-12-16 18:33:00 +01:00
pytest.ini Init repo 2025-12-16 20:02:55 +01:00
README.md Uppdatera README 2025-12-16 20:43:17 +01:00
requirements-dev.txt Init repo 2025-12-16 20:02:55 +01:00
requirements.txt Init repo 2025-12-16 20:02:55 +01:00
todo.db Init repo 2025-12-16 20:02:55 +01:00

TODO Flask + SQLite

Ett enkelt TODO-system byggt med Python, Flask och SQLite.
Projektet är uppsatt med app factory-pattern, pytest-tester och är redo att köras i GitHub Actions CI.


Funktioner

  • Skapa TODO-poster (title, description, status)
  • Uppdatera status (not-started, in-progress, done)
  • Ta bort TODO-poster
  • SQLite som databas
  • Tester med pytest
  • CI-redo (GitHub Actions)

🗂 Projektstruktur

.
├── app.py                  # Flask app (app factory)
├── db.py                   # Databasfunktioner (SQLite)
├── todo.db                 # SQLite-databas (lokalt)
├── requirements.txt        # Runtime dependencies
├── requirements-dev.txt    # Dev/test dependencies
├── templates/
│   ├── base.html
│   └── index.html
├── static/
│   └── style.css
├── tests/
│   └── test_app.py
├── .gitignore
└── README.md

🚀 Kom igång lokalt

1. Klona repot

git clone <repo-url>
cd todo

2. Skapa och aktivera virtuell miljö

python3 -m venv venv
source venv/bin/activate

3. Installera beroenden

pip install -r requirements.txt
pip install -r requirements-dev.txt

4. Starta applikationen

python app.py

Öppna i webbläsaren:

http://127.0.0.1:5001

🧪 Tester

Kör alla tester lokalt med pytest:

pytest

Med kodtäckning(coverage)

pytest --cov=app --cov-report=term-missing --cov-fail-under=80

🤖 CI GitHub Actions

Projektet kör automatiskt tester vid varje push och pull request via GitHub Actions.

Exempel på teststeg i CI:

pytest --cov=app --cov-report=term-missing --cov-fail-under=80

🐳 Docker (valfritt)

Detta projekt kan enkelt dockeriseras för lokal utveckling eller deployment.

Exempel (snabbstart):

docker build -t todo-app .
docker run -p 5001:5001 todo-app