Goals for the recap¶
Rebuild the full toolchain from scratch, end-to-end
Three example stacks: LaTeX, Python+pytest, C++/googletest
CI workflows per stack: build/push + tests inside GHCR images
Emphasize reproducibility and automation
Lab 09 folder layout¶
codes/lab09/
├── python/
│ ├── docker/
│ ├── tests/
│ └── stats.py
├── cpp/
│ ├── docker/
│ ├── include/
│ ├── src/
│ └── tests/
└── latex/
├── docker/
└── main.texEach subproject is self-contained and buildable with Docker.
Pattern to repeat across stacks¶
Minimal code + tests
Docker image that can run the tests
GitHub Actions workflow to build/push the image
GitHub Actions workflow to run tests/compile in
container.image
Python stack¶
stats.pyexposes a small numerical helpertests/uses pytest to validate mean/std outputsDocker image installs
numpy+pytestand runs tests
docker build -t ghcr.io/<owner>/<repo>:latest-python -f docker/Dockerfile .
docker push ghcr.io/<owner>/<repo>:latest-pythonC++ stack¶
CMakeLists.txtfetches googletest and builds testssrc/+include/define a small librarytests/verifies mean/std behavior
cmake -S . -B build
cmake --build build
ctest --test-dir build --output-on-failureLaTeX stack¶
main.texis a tiny document for CI compilationDocker image uses TeX Live +
latexmkWorkflow compiles the PDF and uploads it as an artifact
docker build -t ghcr.io/<owner>/<repo>:latest-latex -f docker/Dockerfile .
docker push ghcr.io/<owner>/<repo>:latest-latexGitHub Actions: build and push images¶
One workflow per stack (manual trigger)
Uses
docker/build-push-actionwith GHCR loginTags images consistently (
latest-python,latest-cpp,latest-latex)
name: Lab09 Python - Build Image
on: { workflow_dispatch: {} }GitHub Actions: run tests¶
Run tests inside the job container image
C++ uses
ctest, Python usespytest, LaTeX compilesLaTeX workflow uploads the generated PDF
jobs:
test:
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository }}:latest-python
steps:
- uses: actions/checkout@v4
- run: pytest -qArtifacts in CI¶
actions/upload-artifactfor build outputsUseful for PDFs, logs, or compiled binaries
Makes CI feedback tangible and shareable
Devcontainers¶
.devcontainer/devcontainer.jsonper stackUses the same GHCR images as CI
Aligns local dev with remote testing
Wrap-up checklist¶
Can every stack build and test in a clean container?
Are workflows minimal and readable?
Do CI outputs (logs/artifacts) help debugging?
Is the repo structure consistent across stacks?