Goal
You are the DevOps Engineer. A developer gave you the Restaurant Company source code.
Your job is to understand the application first, run its checks manually, and then automate them with GitHub Actions.
Part 1 β Get the latest code
Use your Restaurant Company repository.
cd restaurant-company
git switch main
git pull origin main
Check:
git status
git log --oneline -5
Part 2 β Investigate the application
Before running anything:
ls
cat package.json
Students must find and write down:
1. What is package.json?
2. What scripts are defined?
3. What command is used for lint?
4. What command is used for build?
5. What dependencies do you see?
Then:
ls package-lock.json
Question:
What is the difference between
package.jsonandpackage-lock.json?
They should be able to explain it in their own words.
Part 3 β Run manually
Run:
npm ci
Then:
npm run lint
Then:
npm run build
Finally:
ls
ls dist
Students should understand this flow:
SOURCE CODE
β
npm ci
β
Dependencies
β
npm run lint
β
Code Check β
β
npm run build
β
dist/
Questions
They must answer:
What does npm ci do?
Where does npm know which dependencies to install?
Why is package-lock.json important?
What does npm run lint do?
Where does npm find the lint command?
What does npm run build do?
What is dist/?
Part 4 β Create your own CI branch
Do not work directly on main.
git switch -c homework-ci
Create:
mkdir -p .github/workflows
nano .github/workflows/homework-ci.yml
Use:
name: Homework Restaurant CI
on:
pull_request:
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install Dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Build
run: npm run build
Part 5 β Before pushing, explain the YAML
They must be able to explain:
on:
pull_request:
jobs:
runs-on:
steps:
uses:
run:
actions/checkout
actions/setup-node
npm ci
npm run lint
npm run build
Do not accept βI copied the YAML.β
They need to explain what happens:
Pull Request
β
Trigger
β
Workflow
β
Job
β
Ubuntu Runner
β
Checkout
β
Setup Node
β
npm ci
β
Lint
β
Build
Part 6 β Push
git status
git diff
git add .
git commit -m "Add homework CI pipeline"
git push -u origin homework-ci
Important question
Ask them:
We used only
pull_request:. Should CI run just because you pushed the branch?
They should understand the difference from:
on:
push:
pull_request:
which can result in separate runs from the two different events.
Part 7 β Create Pull Request
On GitHub:
homework-ci
β
Pull Request
β
main
Now watch GitHub Actions.
Expected:
β Checkout Code
β Setup Node
β Install Dependencies
β Lint
β Build
DO NOT MERGE immediately.
Open the workflow and look at every step.
Part 8 β Explain the result
Students should prepare a 2-minute explanation:
CI is an approach. GitHub Actions is a tool.
Developer gave me the Restaurant Company source code.
I first inspected
package.jsonandpackage-lock.json.I manually ran
npm ci,npm run lint, andnpm run build.Then I automated those commands using GitHub Actions.
My workflow is triggered by a Pull Request.
GitHub creates a runner, checks out the source code, sets up Node, installs dependencies, runs lint, and builds the application.
I would have every student say this aloud rather than only submit screenshots.
π€ What to submit
- Screenshot of
package.jsonscripts - Screenshot of successful
npm ci - Screenshot of successful
npm run lint - Screenshot of successful
npm run build - Screenshot showing
dist/ - Screenshot of their
homework-ci.yml - Screenshot of Pull Request
- Screenshot of GREEN GitHub Actions
- Their answers to the seven questions above
β Bonus β only for stronger students
Have them explain, without changing the workflow:
Why do we need Setup Node in GitHub Actions
if Node/npm is already installed on our EC2?
Correct concept:
EC2 β GitHub Actions Runner
The GitHub runner is a separate environment. Installing Node on EC2 does not install it on the GitHub Actions runner.
Top comments (0)