Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Recap: Containers, CI, and Testing Workflows

University of Pisa

Goals for the recap


Lab 09 folder layout

codes/lab09/
├── python/
│   ├── docker/
│   ├── tests/
│   └── stats.py
├── cpp/
│   ├── docker/
│   ├── include/
│   ├── src/
│   └── tests/
└── latex/
    ├── docker/
    └── main.tex

Pattern to repeat across stacks

  1. Minimal code + tests

  2. Docker image that can run the tests

  3. GitHub Actions workflow to build/push the image

  4. GitHub Actions workflow to run tests/compile in container.image


Python stack

docker build -t ghcr.io/<owner>/<repo>:latest-python -f docker/Dockerfile .
docker push ghcr.io/<owner>/<repo>:latest-python

C++ stack

cmake -S . -B build
cmake --build build
ctest --test-dir build --output-on-failure

LaTeX stack

docker build -t ghcr.io/<owner>/<repo>:latest-latex -f docker/Dockerfile .
docker push ghcr.io/<owner>/<repo>:latest-latex

GitHub Actions: build and push images

name: Lab09 Python - Build Image
on: { workflow_dispatch: {} }

GitHub Actions: run tests

jobs:
  test:
    runs-on: ubuntu-latest
    container:
      image: ghcr.io/${{ github.repository }}:latest-python
    steps:
      - uses: actions/checkout@v4
      - run: pytest -q

Artifacts in CI


Devcontainers


Wrap-up checklist