Files
ai-workflow-course/modules/14-continuous-integration/lab/ci-starter.yml
T
2026-06-22 17:30:41 -04:00

49 lines
2.0 KiB
YAML

# Starter CI workflow for the tasks-app — forge-native, GitHub Actions flavor.
#
# Where this file goes: GitHub Actions reads workflow files from the .github/workflows/ directory
# at the root of your repo. Copy this file to .github/workflows/ci.yml (the name "ci.yml" is yours
# to choose; the .github/workflows/ path is not). Commit it, push, and the forge runs it.
#
# The same three checks (lint, then test) exist on every forge — only the YAML shape differs. See
# gitlab-ci-starter.yml in this folder for the GitLab equivalent of this exact pipeline.
name: CI
# When should this run? "On every push, and on every pull request." That's the whole pitch of CI:
# nothing reaches the shared history without passing through here first.
on:
push:
pull_request:
jobs:
check:
# The runner: a fresh, throwaway Linux machine the forge spins up for this job. "Works on my
# machine" can't hide here — this machine has nothing of yours on it. (More on runners in
# Module 19, including running your own.)
runs-on: ubuntu-latest
steps:
# Step 1: get your code onto the runner. Without this the runner is empty.
- name: Check out the code
uses: actions/checkout@v7
# Step 2: install the language the project needs. Pin a version so CI matches what you run.
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
# Step 3: install the linter (ruff), the new tool this module adds. The test runner is
# Python's standard-library unittest from Module 13 — nothing to install for it.
- name: Install tools
run: pip install ruff
# Step 4: lint. Style and obvious-mistake check. Fails the job on any finding (non-zero exit).
- name: Lint
run: ruff check .
# Step 5: test. The Module 13 tests, run with the stdlib unittest runner. A single failing
# assertion fails the whole job.
- name: Test
run: python -m unittest