https://github.com/sunnypatell/csci4230-advwebdev-devops-activity.git
This project implements a minimal Flask API and a full DevOps automation stack (tests, coverage, linting, security scanning, dependency updates) per the activity instructions.
| Requirement | Implemented | Evidence |
|---|---|---|
| Minimal Flask service | Yes | app.py provides /hello, /echo, /items/<key> (PUT/DELETE) |
| Unit tests with pytest | Yes | test_app.py (3 test functions) all passing locally & in CI |
| Run tests locally | Yes | pytest -q succeeds (3 passed) |
| GitHub Actions CI (tests + coverage) | Yes | .github/workflows/test.yml matrix (3.10, 3.11, 3.12) + pytest --cov + coverage.xml |
| Linting (Flake8) | Yes | .github/workflows/lint.yml + .flake8 config; latest run passes after removing unused import |
| Coverage reporting (Codecov) | Yes | Codecov action (codecov/codecov-action@v4) uploads coverage; public repo so token not required |
| Dependabot for pip updates | Yes | .github/dependabot.yml weekly schedule |
| CodeQL security analysis | Yes | .github/workflows/codeql.yml with permissions (actions/content read, security-events write) |
| Matrix builds (multiple Python versions) | Yes | strategy.matrix.python-version: ["3.10", "3.11", "3.12"] in test workflow |
| Extended endpoints (POST/PUT/DELETE) | Yes | /echo (POST), /items/<key> PUT & DELETE implemented & tested |
| README documents endpoints & issues | Yes | Sections below + note on resolved lint issue |
| Optional deployment | Not implemented (documented guidance optional) | Out of scope for mandatory portion |
app.py)test_app.py) with coverageapp.py
test_app.py
requirements.txt
.flake8
.gitignore
.github/
workflows/
test.yml
lint.yml
codeql.yml
dependabot.yml
README.md
python -m venv .venv
. .\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python .\app.py
Open http://127.0.0.1:5000/hello
pytest -q
pytest -q --cov=app --cov-report=term --cov-report=xml
Generates coverage.xml consumed by Codecov.
git init
git add .
git commit -m "activity 8 initial"
git branch -M main
git remote add origin https://github.com/sunnypatell/csci4230-advwebdev-devops-activity.git
git push -u origin main
CODECOV_TOKEN.coverage.xml after tests.app.py β Flask apptest_app.py β pytest tests.github/workflows/test.yml β matrix + coverage + Codecov.github/workflows/lint.yml β flake8.github/workflows/codeql.yml β CodeQL security.github/dependabot.yml β weekly pip updates.flake8, requirements.txt, .gitignoreGET /hello β {"message":"Hello, World!"}POST /echo β mirrors request JSON with 201PUT /items/<key> body: {"value": "..."}DELETE /items/<key> β {"deleted": "<key>"}{ "value": <string|number> } β Response: { "key": <key>, "value": <string> }{ "deleted": <key> } (404 if missing)
pytest, pytest-cov, flask in requirements.txt.coverage.xml path; remove token line if not needed.flake8 app.py test_app.py; tweak .flake8 or fix code.permissions and repository Code scanning is enabled.| Workflow | Purpose | Key Steps |
|---|---|---|
| test.yml | Tests + coverage + Codecov | setup-python, install deps, pytest with coverage, upload coverage |
| lint.yml | Flake8 style checks | setup-python, install flake8, run flake8 |
| codeql.yml | Static security scan | checkout, CodeQL init, analyze |
| dependabot.yml | Dependency update PRs | weekly pip ecosystem scan |
json) in test_app.py (Flake8 F401). CodeQL required enabling Code scanning in repository settings or make the repo public instead of private.