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)