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.

Go to Week #01 Mini Project →

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.

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 --version

If missing, install the compiler and Git:

sudo apt update
sudo apt install build-essential git

Replace 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/workflows

3. 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;
}
EOF

4. Compile and run

mkdir -p build
g++ -std=c++17 -Wall -Wextra -pedantic src/main.cpp -o build/profile
./build/profile

Expected output:

ENGINEERING PROFILE
Name: Alex Student
Course: EECE 2140
Interest: Robotics
Goal: Build reliable engineering software

Checkpoint: 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.txt

No 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 push

Checkpoint: 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
EOF
git add .github/workflows/cpp.yml
git commit -m "Add automated build and test"
git push

Open 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.txt
git add src/main.cpp
git commit -m "Personalize profile interest"
git push

Inspect 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 push

Confirm 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.txt

Submission and assessment

CriterionWeight
Application requirements30%
Terminal build, execution, and testing25%
GitHub Actions25%
README and commit history10%
Debugging explanation10%

Reflection: What does compiling check, what does the output test check, and why are both necessary?

Engineering practice checklist

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.