Objective: add a working CI workflow to your sandbox that runs tests, caches dependencies, and (optionally) builds and publishes a container image. Keep a lab log (codes/lab08/lab-notebook.md) with commands, failing/passing runs, and fixes you applied.
Exercise 1 — Prep and baseline¶
In your
sspa-sandbox, createcodes/lab08/<name.surname>/and copy your Lecture 6/7 project there (code plus tests).Run the local suites (e.g.,
pytest -q,ctestor your C++ test binary) and note the current status in the lab log.Ensure you have a clean branch dedicated to this lab; record tool versions (
python --version,g++ --version,pytest --version).
Exercise 2 — Minimal CI workflow¶
Create
.github/workflows/ci.ymlundercodes/lab08/<name.surname>/.Add triggers on
pushandpull_requesttomain(or your branch) and a job that:Checks out the repo.
Sets up Python (pin a version, e.g., 3.11).
Installs dependencies deterministically (
pip install -r requirements.txtor constraints).Runs your test suite (
pytest -q,ctest, or both).
Push and confirm the workflow runs on GitHub; capture screenshots/links and log any failures and fixes.
Exercise 3 — Matrix and caching¶
Extend the workflow with a matrix over Python versions (e.g., 3.10–3.12) or compilers if you have C++ tests.
Enable caching (
actions/setup-pythonwithcache: piporactions/cachekeyed on lockfiles) to speed installs.Add sensible job guards:
timeout-minutes,fail-fast: false, andconcurrencyto avoid overlapping runs on the same branch.Rerun CI and note timing improvements or cache hits in the lab log.
Exercise 4 — Artifacts and docs¶
Upload useful artifacts when jobs succeed or fail (use
if: always()): test logs, coverage reports, or build outputs.If you have docs (Sphinx/JupyterBook), add a job/step to build them with warnings-as-errors; upload the HTML as an artifact for preview.
Check artifact sizes and naming; keep them small and clear. Document what you uploaded and why.
Exercise 5 — Optional: container build and publish¶
Add steps to build a Docker image with
docker/build-push-action(enable BuildKit viadocker/setup-buildx-action).Log in to GHCR using
${{ github.actor }}and${{ secrets.GITHUB_TOKEN }}(ensurepackages: writepermissions) and push tags formainandgit tags.Pin action versions (e.g.,
@v5,@v3) and avoid leaking secrets in logs. Record image tags/digests in the lab log.
Submission checklist¶
codes/lab08/<name.surname>/.github/workflows/ci.ymlwith working tests, caching, and matrix (where relevant).Optional container build/publish steps configured and documented.
Artifacts configured for logs/coverage/docs where applicable.
lab-notebook.mdwith CI run links/screenshots, failures, fixes, and timing notes.