Basic

Running your first pipeline

Let's run a real pipeline. We set up a small project, add a test, and watch the pipeline run when we push code.

What you will see

success: [install] npm install ... done (12s) success: [test] pytest ... 140 passed (3s) success: [build] npm run build ... done success: [deploy] Deployed to test server ✅ FAIL: [lint] flake8 ... FAIL: 2 errors found

About 1 min of reading

Quick check

Before this new lesson, one small question about the lesson you just finished. Recall it, do not look it up.

Try It

Running your first pipeline means pushing code and watching the workflow respond. I start the workflow on a push, show where the workflow file lives, then read a real log line by line and mark each one green or red.

1

Every push starts the workflow automatically. I print what GitHub does when you commit and push: it starts the workflow and reports that the tests passed.

def workflow(code): print("New push! Starting the workflow.") if "test" in code: print("Installing, testing... PASSED.") workflow("commit and push")

Before you run it, say out loud what it will print. Then open the answer.

What it prints
New push! Starting the workflow. Installing, testing... PASSED.
Every future push does the same thing. That repetition is how teams work with CI/CD without babysitting the process.
2

The workflow file lives inside the repo next to your code, so every push is read by the runner. I print the two places the workflow file can be found.

paths = [".github/workflows/ci.yml", "next to your code"] for p in paths: print(f"File lives: {p}")

Before you run it, say out loud what it will print. Then open the answer.

What it prints
File lives: .github/workflows/ci.yml File lives: next to your code
Change the file and you change what runs. The workflow lives in the repo so its history is tracked alongside your code.
3

The log is your map: green lines mean success and a red line shows the exact command that failed. I read a real pipeline log and print success or failure for each line.

def read_log(log): ok_words = ["done", "passed", "Deployed"] for line in log: status = "success" if any(w in line for w in ok_words) else "FAIL" print(f"{status}: {line.strip()}") log = [ "[install] npm install ... done (12s)", "[test] pytest ... 140 passed (3s)", "[build] npm run build ... done", "[deploy] Deployed to test server ✅", "[lint] flake8 ... FAIL: 2 errors found", ] read_log(log)

Before you run it, say out loud what it will print. Then open the answer.

What it prints
success: [install] npm install ... done (12s) success: [test] pytest ... 140 passed (3s) success: [build] npm run build ... done success: [deploy] Deployed to test server ✅ FAIL: [lint] flake8 ... FAIL: 2 errors found
A red line shows the exact command that failed, so you know where to look instead of guessing.

Put it in order

Before you write anything, put these lines back in the right order. Click a line to move it up one step. This support step is easier than writing code from scratch, and it is here to make the last example stick.

Data Flow

Push code, the pipeline runs, and you read the log to see what happened.
1 Push code
↓
2 Pipeline runs
↓
3 Check the log
↓
4 Fix if red
Line by line

Read the first example one line at a time. A line that prints shows what appears on screen; the rest set things up quietly.

def workflow(code): sets nothing on screen
print("New push! Starting the workflow.") New push! Starting the workflow.
if "test" in code: sets nothing on screen
print("Installing, testing... PASSED.") Installing, testing... PASSED.
workflow("commit and push") sets nothing on screen
Why this works
Where to start

Use a free CI service like GitHub Actions. Add a workflow file to your repo. It runs automatically on every push.

Read the results

Each run has a log. It shows what ran and what failed. Learn to read a log; it tells you exactly what broke.

Examples

First push

You: commit and push your code to the repo.
GitHub: "New push! Starting the workflow."
CI: "Installing, testing... PASSED."

You just ran your first pipeline. Every future push will do the same. That is how teams work with CI/CD.

Where the file lives

repo/
  .github/
    workflows/
        ci.yml   <-- the pipeline

The workflow file lives inside the repo, next to your code. Every push is read by GitHub Actions. Change the file, change what runs.

Reading the log

[install] npm install ... done (12s)
[test]    pytest ... 140 passed (3s)
[build]   npm run build ... done
[deploy]  Deployed to test server ✅

The log is your map. Green lines mean success. A red line shows the exact command that failed, so you know where to look.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← The parts of a pipeline
Previous Lesson
The parts of a pipeline
Next Lesson
GitHub Actions basics
GitHub Actions basics →