CIS 6930 Spring 26

Logo

Data Engineering at the University of Florida

GitHub Actions CI Setup

This guide shows how to set up continuous integration (CI) for your course projects using GitHub Actions. CI automatically runs your tests every time you push code to your repository.


Quick Setup

Create the GitHub Actions workflow file in your repository:

mkdir -p .github/workflows
touch .github/workflows/pytest.yml

Workflow Configuration

Add the following content to .github/workflows/pytest.yml:

name: PyTest
on: push

jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 10

    steps:
      - name: Check out repository code
        uses: actions/checkout@v4

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.12"

      - name: Install uv
        uses: astral-sh/setup-uv@v5

      - name: Install dependencies
        run: uv sync

      - name: Run test suite
        run: uv run pytest -v .

Understanding the Workflow

Step Purpose
actions/checkout@v4 Clones your repository code
actions/setup-python@v5 Installs Python 3.12
astral-sh/setup-uv@v5 Installs the uv package manager
uv sync Installs project dependencies from pyproject.toml
uv run pytest -v . Runs all tests with verbose output

Viewing Results

  1. Go to your repository on GitHub
  2. Click the Actions tab
  3. Select the workflow run to see test results

A green checkmark indicates all tests passed. A red X indicates failures.

Troubleshooting

Tests pass locally but fail in CI

Workflow not running


Adapted from the GitHub Actions documentation and uv documentation