Introduction


  • Automation saves time and improves reproducibility by capturing repeatable processes like testing, linting, and building code into scripts or pipelines.
  • Continuous Integration (CI) is the practice of automatically running tasks and checks each time code is updated, helping catch issues early and improving collaboration.
  • Integrating smaller, frequent code updates is more manageable and less error-prone than merging large changes all at once.
  • CI pipelines can run on many platforms and environments using cloud-based services (e.g. GitHub Actions, Travis CI) or self-hosted solutions (e.g. Jenkins, GitLab CI).
  • CI can be extended to Continuous Delivery/Deployment (CD) to automatically package and deliver software updates to users or deploy changes to live systems.

Example Code


  • Pytest uses simple functions rather than test classes
  • A virtual environment keeps test dependencies isolated and reproducible

Defining a Workflow


  • YAML uses indentation and key–value pairs to define workflow structure
  • GitHub looks for workflow files inside the .github/workflows/ directory
  • CI lets your tests run automatically on a clean environment every time you update your code
  • We can trigger workflows manually or automatically using different GitHub events

Tracking a Running Workflow


  • You can view all workflow runs under the Actions tab
  • Each workflow run includes detailed logs for every job and step
  • A workflow re-runs automatically whenever a matching event (like push) occurs
  • Workflow logs help diagnose failing tests or configuration issues

Build Matrices


  • A build matrix allows a workflow to run across many OS and Python version combinations automatically
  • GitHub Actions creates a separate job for every combination in the matrix
  • Matrix jobs run in parallel, reducing the time needed to test multiple configurations
  • Using matrix builds helps ensure code works reliably on all relevant platforms