EECE 2140 · Week 1 · Class Project
Engineering Profile App
Class Project · Complete worked solution — use this example as a model for source organization, reproducible builds, testing, documentation, and continuous integration.
Build, test, and publish your first C++ application using the terminal and GitHub Actions.
Estimated time: 90–120 minutes after setup.
Goal and learning objectives
Create a console profile, verify its output, and automatically build and test it on every push.
- Create, compile, and execute a C++ project from the terminal.
- Compare actual output against an expected result.
- Commit and push changes using Git.
- Configure and diagnose GitHub Actions checks.
Course alignment: C++ program development, development tools, testing, and technical communication. Official syllabus objective identifiers are pending confirmation.
Required tools and knowledge
This walkthrough uses an Ubuntu terminal on Linux or Windows through WSL, g++, Git, and a GitHub account. VS Code is optional. Know how files and folders work; this project introduces main(), output statements, compilation, and version control.
Setup references: Install WSL · GitHub authentication.
1. Verify and configure your tools
g++ --version
git --versionIf missing, install the compiler and Git:
sudo apt update
sudo apt install build-essential gitReplace these values with your own name and email:
git config --global user.name "Your Name"
git config --global user.email "your-email@example.com"2. Create and clone your repository
On GitHub, create week01-engineering-profile with a README. Replace YOUR-USERNAME below. Use your configured GitHub authentication; do not put credentials in files.
git clone https://github.com/YOUR-USERNAME/week01-engineering-profile.git
cd week01-engineering-profile
mkdir -p src tests .github/workflows3. Create your application
Start with this exact example. Personalize it after the first successful test.
cat > src/main.cpp <<'EOF'
#include <iostream>
int main() {
std::cout << "ENGINEERING PROFILE\n";
std::cout << "Name: Alex Student\n";
std::cout << "Course: EECE 2140\n";
std::cout << "Interest: Robotics\n";
std::cout << "Goal: Build reliable engineering software\n";
return 0;
}
EOF4. Compile and run
mkdir -p build
g++ -std=c++17 -Wall -Wextra -pedantic src/main.cpp -o build/profile
./build/profileExpected output:
ENGINEERING PROFILE
Name: Alex Student
Course: EECE 2140
Interest: Robotics
Goal: Build reliable engineering softwareCheckpoint: explain the difference between src/main.cpp and build/profile.
5. Test the output
cat > tests/expected.txt <<'EOF'
ENGINEERING PROFILE
Name: Alex Student
Course: EECE 2140
Interest: Robotics
Goal: Build reliable engineering software
EOF./build/profile > build/actual.txt
diff -u tests/expected.txt build/actual.txtNo output from diff means the files match. A difference means the test failed; inspect the changed lines.
6. Commit and push
printf 'build/\n' > .gitignore
git status
git add src/main.cpp tests/expected.txt .gitignore
git commit -m "Add profile application and output test"
git pushCheckpoint: GitHub should contain source and tests, but no executable.
7. Add GitHub Actions
cat > .github/workflows/cpp.yml <<'EOF'
name: Build and test C++
on: [push, pull_request]
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Compile
run: |
mkdir -p build
g++ -std=c++17 -Wall -Wextra -pedantic src/main.cpp -o build/profile
- name: Test output
run: |
./build/profile > build/actual.txt
diff -u tests/expected.txt build/actual.txt
EOFgit add .github/workflows/cpp.yml
git commit -m "Add automated build and test"
git pushOpen the repository’s Actions tab. Inspect the latest run: Compile and Test output must both pass.
8. Diagnose a failure
Change the printed interest without changing the expected output:
sed -i 's/Interest: Robotics/Interest: Renewable energy/' src/main.cpp
mkdir -p build
g++ -std=c++17 -Wall -Wextra -pedantic src/main.cpp -o build/profile
./build/profile > build/actual.txt
diff -u tests/expected.txt build/actual.txtgit add src/main.cpp
git commit -m "Personalize profile interest"
git pushInspect the failed Actions run. The program changed intentionally, so update the expected result:
sed -i 's/Interest: Robotics/Interest: Renewable energy/' tests/expected.txt
./build/profile > build/actual.txt
diff -u tests/expected.txt build/actual.txt
git add tests/expected.txt
git commit -m "Update expected profile output"
git pushConfirm the next run passes. Never change expected results merely to hide a program defect.
9. Document and verify a fresh clone
Edit README.md with purpose, prerequisites, exact build/run/test commands, example output, workflow explanation, debugging reflection, and any AI assistance used.
nano README.md
git add README.md
git commit -m "Document build testing and debugging"
git push
cd ..
git clone https://github.com/YOUR-USERNAME/week01-engineering-profile.git week01-profile-verification
cd week01-profile-verification
mkdir -p build
g++ -std=c++17 -Wall -Wextra -pedantic src/main.cpp -o build/profile
./build/profile > build/actual.txt
diff -u tests/expected.txt build/actual.txtSubmission and assessment
- Repository link and latest successful GitHub Actions run.
- Terminal screenshot showing compilation and the passing test.
- Source, expected output, workflow, .gitignore, and complete README.
- Evidence of a failed test followed by its correction.
| Criterion | Weight |
|---|---|
| Application requirements | 30% |
| Terminal build, execution, and testing | 25% |
| GitHub Actions | 25% |
| README and commit history | 10% |
| Debugging explanation | 10% |
Reflection: What does compiling check, what does the output test check, and why are both necessary?
Engineering practice checklist
- Source, tests, and automation are separated into named folders.
- Generated build files are excluded from Git.
- The same build and test commands run locally and in CI.
- Expected output is explicit and reviewed.
- Commits describe meaningful changes.
- A fresh clone reproduces the result.
The source code, expected output, and workflow above constitute the complete worked solution. Apply this process to the team assignment; create your own application content.