How nogibjj/coursera-mlops-foundations-lab-1-cicd works
Project type and purpose
• This is a Python-based command‐line tool lab project whose primary goal is to teach CI/CD principles (lint, format, refactor, test, container build, and deployment) via a Makefile, GitHub Actions workflows, and a devcontainer.
File structure
• .devcontainer/: Dockerfile + VS Code devcontainer.json → defines a reproducible development environment.
• .github/workflows/: cicd.yml + docker-image.yml → two GitHub Actions pipelines (CI and CD).
• Makefile + requirements.txt → defines automated tasks (lint, format, refactor, test) and dependencies.
• main.py (Click CLI) + mylib/calculator.py → core application code.
• test_main.py → CLI unit tests using Click’s test runner.
Pull insights from the README
• The README describes lab objectives: automated lint/format/refactor/test via Makefile, writing tests for the Click CLI, and building/deploying via GitHub Actions and Docker.
a. Main components:
• Developer workstation (VS Code + devcontainer)
• Git source repository (GitHub)
• GitHub Actions – CI pipeline (lint, format, refactor, test)
• GitHub Actions – CD pipeline (build Docker image, push to registry)
• Docker registry (Docker Hub or GitHub Container Registry)
• End‐users invoking the CLI (optional)
b. Relationships & interactions:
1. Developer writes code in devcontainer → commits & pushes to GitHub.
2. Push triggers CI workflow (cicd.yml): runs Makefile targets in order (lint → format → refactor → test).
3. On successful CI, push also triggers CD workflow (docker-image.yml): builds Docker image (using .devcontainer/Dockerfile), tags it, and pushes to a registry.
4. Consumers can pull the Docker image or run the standalone CLI after checkout.
c. Architectural patterns & principles:
• Pipeline-as-code: all build/test/deploy steps are defined in Makefile + GitHub Actions YAML.
• Infrastructure-as-code: devcontainer + Dockerfile define a consistent environment.
• Single‐responsibility: separate workflows for CI vs. CD; separate Makefile tasks.
d. Key technologies/frameworks/libraries:
• Python + Click (CLI framework)
• pytest/Click test runner
• Makefile (task runner)
• Docker (containerization)
• GitHub Actions (cicd.yml, docker-image.yml)
• devcontainer (VS Code remote development)