Your First Pipeline
By Syncfusion®, Inc. · Last updated
Write a pipeline file yourself: triggers for push, pull request, schedule and manual runs, the setup step for the right version, and jobs that run in order on fresh runners.
What you will learn
- Write push, pull request, schedule and manual triggers
- Read a cron schedule
- Use a setup action to pick the tool version
- Split work into jobs and set their order
- Write a working pipeline from a blank file
Your First Pipeline
In this lesson you write a pipeline file yourself.
By the end, your file will:
- start on a push, a pull request, a schedule and a button.
- pick the right Node or .NET version.
- split work into jobs that run in order.
- pass on a clean change.
Simple lesson: a pipeline file has three parts: when to run, where to run, and what to run.
A Real-World Example
Think about a school morning routine.
- When: the bell rings at 8:30. Or the teacher calls an extra class.
- Where: each class has its own room.
- What: attendance first, then lessons, in order.
Now map it:
- Bell or extra class = triggers.
- Room = runner.
- Class period = job.
- Attendance, then lessons = steps.
Simple lesson: triggers say when, the runner says where, steps say what.
Triggers
Trigger = an event that starts a run.
The four you will use most:
| Trigger | When it starts | GitHub Actions | Azure Pipelines |
|---|---|---|---|
| Push | Code lands on a branch | push: | trigger: |
| Pull request | A pull request opens or changes | pull_request: | pr: |
| Schedule | At a set time | schedule: with cron | schedules: with cron |
| Manual | Someone clicks Run | workflow_dispatch: | Always on |
Simple lesson: if an event is not in the trigger list, nothing runs.
Cron in One Minute
Cron = a short text that says when to run.
It has five parts:
- minute, hour, day of month, month, day of week.
0 2 * * *= minute 0, hour 2, every day.*means "every".- Times are in UTC, not Indian time. 2 AM UTC is 7:30 AM in India.
Simple lesson: use a schedule for slow or extra checks that do not need to run on every push.
Steps: Commands and Actions
A step is either a command or a ready-made action.
Command = text typed into the terminal.
- GitHub:
run: npm test - Azure:
script: npm test
- GitHub:
Ready-made action or task = someone else's packaged step.
- GitHub:
uses: actions/setup-node@v4 - Azure:
task: NodeTool@0
- GitHub:
Use a ready-made step when one exists. It saves you many lines.
Pick the Version
- A fresh runner has some Node and .NET already.
- That version may be older than your app needs.
- The setup step installs the exact version you ask for.
Always write the version down. "Whatever the runner has" changes when the runner image updates. Then your pipeline breaks one morning for no clear reason.
Simple lesson: never trust the runner's default version. Set it in the file.
Jobs and Runners
Job = a group of steps on one runner.
- Each job gets its own fresh runner.
- Nothing is shared between jobs unless you save it.
- Jobs run at the same time unless you say otherwise.
Making One Job Wait
| Platform | How to say "wait for build" |
|---|---|
| GitHub Actions | needs: build |
| Azure Pipelines | dependsOn: build |
- The lab shows a timeline after the run.
- With the wait added, test starts after build ends.
A new job does not have the first job's files. Each job needs its own checkout and install. This is the most common surprise when you split a pipeline.
Simple lesson: one job, one fresh runner. Use needs or dependsOn to set the order.
Reading Platform Errors
When the file itself is wrong, no step runs.
- The platform shows "Invalid workflow file".
- It names the line and the problem.
- Common ones: a missing
runs-on, a misspelt key, bad spaces.
| You see | It means |
|---|---|
Required property is missing: jobs | The file has no jobs block |
The job 'x' is missing 'runs-on' | GitHub does not know which machine to use |
All mapping items must start at the same column | The spaces are not lined up |
Real tools vs this lab: GitHub shows file errors on the Actions tab, and Azure shows them when you save or run. Their exact words can differ a little. In this lab, the simulator uses wording close to the real one.
Simple lesson: a file error is the cheapest error. Fix the line it names and run again.
Write It From Scratch
Now put it all together on a blank file.
- Start from the cheat sheet below.
- Run often. Read each error.
- "Show a fix" appears after two tries, if you need it.
Simple lesson: you now know enough to write a real pipeline for a real project.
- Open
.github/workflows/ci.yml(orazure-pipelines.yml) in your starter repo. - Find
on:(ortrigger:), the jobs, and the steps you wrote in this lesson. - Add
workflow_dispatch:underon:, push, then press Run workflow in the Actions tab.
What you should see: a new run that you started by hand.
Quick Check
Cheat Sheet
GitHub Actions, .github/workflows/ci.yml:
name: CI
on:
push:
branches: [main]
pull_request:
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npm run build
test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npm test
Azure Pipelines, azure-pipelines.yml:
trigger:
branches:
include: [main]
pr:
branches:
include: ['*']
schedules:
- cron: '0 2 * * *'
displayName: Nightly
branches:
include: [main]
always: true
pool:
vmImage: ubuntu-latest
jobs:
- job: build
steps:
- task: UseDotNet@2
inputs:
version: '10.0.x'
- script: dotnet restore
- script: dotnet build --no-restore
- job: test
dependsOn: build
steps:
- task: UseDotNet@2
inputs:
version: '10.0.x'
- script: dotnet restore
- script: dotnet test --no-restore
Common mistakes
| Mistake | Wrong idea | Correct idea | What goes wrong |
|---|---|---|---|
No pull_request trigger | Push covers it | Add the pull request trigger | Pull requests merge unchecked |
| Cron in local time | 0 2 is 2 AM in India | Cron runs in UTC | The job runs at 7:30 AM IST |
| No setup step | The runner has the right version | Its default can be older | "Object.groupBy is not a function" |
| Second job with no checkout | Jobs share files | Each job is a fresh runner | "Could not read package.json" |
No needs / dependsOn | Jobs run in file order | Jobs run at the same time | Test runs before build finishes |
What to Remember
- When: triggers. Where: runner. What: steps.
- Push, pull request, schedule, manual.
- Cron runs in UTC.
- Set the tool version yourself.
- One job = one fresh runner. needs or dependsOn sets the order.
Exercises
Next: Reading Red Builds