HW4: fixes according to lector's review; output to cout not to file#4
Merged
Conversation
mandelbroo
added a commit
that referenced
this pull request
May 12, 2026
* Initial commit
* chore: scaffold C++ dev container
- Add .devcontainer with Ubuntu noble Dockerfile installing gcc,
clang, clangd, make, cmake, clang-format, cmake-format, and
ninja-build from apt-packages.in, with UTF-8 locale and a
non-root user matching the host user.
- Configure devcontainer.json to bind-mount the workspace, host
SSH keys, and a persistent bash history, and preload VS Code
extensions plus clangd/cmake-format editor defaults.
- Ship root-level .clang-format, .clangd, and .cmake-format.json
into the image so editor integrations and SCA tooling pick up
the intended configs by default.
- Add scripts/initialize host hook that creates the persistent
bash history file under ~/.devcontainers before container
start so shell history survives rebuilds.
* fix: make devcontainer initialize script cross-platform
- Harden .devcontainer/scripts/initialize for macOS, Linux, and
WSL2 hosts by adding `set -euo pipefail`, quoting all variable
expansions, switching backticks to $(...), and using ${HOME}
instead of ~ inside assignments.
- Mark the script executable in the Git index (100755) so hosts
that don't carry POSIX mode bits still execute it in-container.
- Add .gitattributes to pin LF line endings for shell scripts
and the Dockerfile, preventing `bad interpreter: /usr/bin/env^M`
failures when the repo is checked out on a Windows-backed
filesystem (including the NTFS side of some WSL2 setups).
- Drop .vscode/ from .gitignore so the repo can ship shared
editor settings/launch configs that align with the dev
container's clangd and cmake-format defaults.
* fix: create nested WORKSPACE_FOLDER path in Dockerfile
- Switch `mkdir` to `mkdir -p` in the final Dockerfile RUN so the
container image build succeeds on macOS hosts, where
WORKSPACE_FOLDER resolves to /Users/<user>/<project> and /Users
does not exist in the Ubuntu base image. Plain `mkdir` cannot
create nested parents, which broke step 8/8 of the image build.
- Switch `chown` to `chown -R` so ownership on the workspace dir
(and any parents just created) is set for the container user,
keeping behavior correct before the host workspace bind-mount
is applied at runtime.
* chore: recommend Dev Containers extension via .vscode/extensions.json
- Add .vscode/extensions.json recommending the `ms-vscode-remote.
remote-containers` extension, the minimum required on the host
VS Code to expose the "Reopen in Container" command.
- Extension identifier is identical on macOS, Linux, and WSL2
hosts, so a single recommendation covers all supported dev
platforms without branching per-OS.
- Container-internal extensions (clangd, cpptools, cmake-format,
cmake-language-support) remain declared in devcontainer.json's
customizations.vscode.extensions and are intentionally not
duplicated here, since they are installed inside the container
rather than on the host.
* chore: add macOS host prep script for Docker via Colima
- Add preps/macos.sh that installs Colima, Docker CLI, and
docker-buildx via Homebrew, links the buildx plugin into
~/.docker/cli-plugins so `docker buildx` is discoverable, and
starts the Colima VM as the Docker runtime.
- Scope kept to the minimum the Dockerfile-based dev container
actually needs: no docker-compose (the devcontainer is not
compose-based) and no preflight/smoke-test scaffolding.
* chore: add Linux and Windows host prep scripts
- Add preps/linux.sh that installs Docker Engine via the official
get.docker.com convenience script and adds the current user to
the docker group, the minimum needed for the Dev Container CLI
to talk to dockerd without sudo after a relogin.
- Add preps/windows.ps1 that runs `wsl --install -d Ubuntu` to
set up WSL2 with the default Ubuntu distro. Docker Desktop and
winget are intentionally avoided; Docker itself is installed
inside WSL2 by running preps/linux.sh from the Ubuntu distro,
and the script's header comment spells out that chain so users
aren't left guessing where the Docker engine install happens.
- Keep both scripts at the same minimum scope as preps/macos.sh:
host-only setup, nothing more than what's required for VS Code
Dev Containers to reach a working dockerd.
* lesson1
* docs: replace preps/ shell scripts with platform notes
- Remove preps/linux.sh, preps/macos.sh, and preps/windows.ps1.
The per-platform host setup is short enough to follow as plain
prose and doesn't justify shipping runnable scripts that have
to be kept in sync with the prose anyway.
- Add preps/linux.md, preps/macos.md, and preps/windows.md with
copy-pasteable commands for installing Docker (Engine on Linux,
Colima on macOS, WSL2+Engine on Windows 11), including the
non-obvious bits (BIOS virtualization on Windows, systemd in
WSL, docker-group relogin) that a plain script would hide.
- Add preps/README.md as an index that routes users by OS and by
editor (VS Code Dev Containers vs. any other editor via the
devcontainers CLI), plus the final verification flow.
- Add preps/devcontainers-cli.md covering the @devcontainers/cli
workflow so users on Neovim, JetBrains, Helix, Sublime, and
others can drive the same container without VS Code.
* revert: remove block2-lesson1/ subdirectory
- Delete block2-lesson1/CMakeLists.txt and block2-lesson1/main.cpp
introduced by commit 49d7702 ("lesson1"). The repo is already
scoped to a single lesson (tracked on the block-2-lesson-1
branch), so nesting source files under a same-named subdir is
redundant and puts the cmake build/ directory one level deeper
than necessary for no gain.
* feat: add lesson starter CMake project at repo root
- Add CMakeLists.txt configuring a C++20 build of an `app`
executable from main.cpp, with -Wall -Wextra -pedantic and
CXX_EXTENSIONS=OFF so portability issues surface early.
- Add main.cpp as the lesson's hello-world entry point, printing
"Hello, section 2!" to stdout.
- Add README.md covering prerequisites (the dev container under
.devcontainer/ plus host setup in preps/), the
cmake -S . -B build / cmake --build build flow, and the
expected runtime output.
* docs(preps): rework clone flow and add Windows troubleshooting
- README.md: linear numbered steps (Docker -> clone -> code . -> extension -> Reopen in Container)
- OS files: clone uses --branch block-2-lesson-1; linux/windows include apt update + git install
- windows.md: systemd=true as default so docker auto-starts on WSL boot
- windows.md: troubleshooting for common Windows-native open mistakes (error 193, out-of-space in docker-desktop VM, missing WSL prefix, empty localEnv vars)
- Impersonal tone throughout (no 2nd-person addressing)
* fix(devcontainer): create ~/.ssh in initialize to prevent mount failure
On fresh machines (students who never generated SSH keys) the bind-mount
source=${HOME}/.ssh failed with "bind source path does not exist",
blocking container start.
- scripts/initialize: create ~/.ssh with 700 perms if missing (idempotent,
does not touch existing .ssh)
- preps/README.md: add "Якщо вже клонували репо раніше" section with
git pull steps for students who cloned before this fix
* fix(devcontainer): free UID 1000 by removing default ubuntu user
Ubuntu 24.04 (Noble) base image ships with a pre-created 'ubuntu' user
at UID 1000. Without this fix, useradd for the course user picked UID
1001 (next available), so bind-mounted workspace files (owned by host
UID 1000) appeared as owned by 'ubuntu' inside the container. Dev
Containers CLI updateUID step also could not realign the course user
to 1000 because UID 1000 was already taken.
- Dockerfile: userdel -r ubuntu + groupdel ubuntu before useradd, then
useradd -u 1000 -U so the course user owns UID 1000 and bind-mount
ownership maps to the right name inside the container.
- preps/README.md: in "Якщо вже клонували" section, switch instruction
from "Reopen in Container" to "Rebuild Container" so students pick
up the new Dockerfile layer after git pull.
* feat(homework-04): add wheel odometry starter (CMake, main stub, samples)
* feat(devcontainer): add ssh and git packages
* chore(devcontainer): pin ubuntu base image by digest
The :noble tag is mutable on Docker Hub, so the same Dockerfile can pull
different images over time. Pin to a digest for reproducibility.
* build(cmake): include homework_04 from root
So `cmake --build build` at the repo root builds both the root app and
the homework target in one pass.
* ci(build): add workflow using devcontainers/ci
Runs cmake configure+build inside the repo's devcontainer so CI matches
the local VS Code environment.
* ci(build): disable image push in devcontainers/ci
Default push=filter tries to push the built image and fails with
'imageName is required' because no registry is configured. The image is
only needed locally on the runner for the build step.
* ci(build): limit push trigger to main to avoid duplicate PR runs
A push to a feature branch with an open PR used to trigger the workflow
twice (once from push, once from pull_request synchronize). Restricting
push to main keeps push runs for merges and leaves PR runs to the
pull_request trigger.
* chore(devcontainer): drop hardcoded UID 1000, rely on updateRemoteUserUID
useradd previously hardcoded -u 1000 to match a common host UID. That is
what VS Code and devcontainers/ci already handle at container start via
updateRemoteUserUID, which syncs the container user UID to the host's.
All we need from the image is that UID 1000 be free so the default
useradd slot and the runtime remap don't collide with the ubuntu user
that noble ships on UID 1000. Remove ubuntu conditionally (guarded by
`id ubuntu`) and let useradd pick the UID on its own.
* build(cmake): drop root main.cpp and app target
Root CMakeLists.txt used to build a small hello app from a top-level
main.cpp. With homework_NN subdirectories in place (each with its own
CMakeLists.txt and executable target), the root app is no longer
useful. Remove main.cpp and the add_executable(app) line from the
root CMakeLists.txt.
* docs(readme): rewrite root README
Replace the "Section 2 - стартовий код" stub with a course-level
README covering clone + Reopen in Container + build, repo structure,
how to add new homework_NN, and what CI does. Platform-specific
setup stays in preps/.
* docs(readme): document template workflow and upstream updates
Rewrite the quickstart to lead with GitHub's "Use this template"
button instead of cloning the course repo directly, so each student
gets their own independent repo with a clean git history and PRs that
default to their own main (not upstream).
Add an 'Оновлення з курс-репо' section with the remote add + fetch +
merge/cherry-pick recipe for pulling later changes from the course
repo without the fork-style upstream binding.
* docs(changelog): add CHANGELOG.md with recent merged PRs
Document PRs #3, #4, #5 and the initial block 2 content in a CHANGELOG
at repo root, Keep a Changelog format. Update the README structure
tree to reference the new file.
* docs(readme): tell Windows students to clone inside WSL
Quickstart step 2 runs git clone without saying where. On Windows,
cloning into C:\ makes VS Code run devcontainer scripts on the
Windows host, which lacks a POSIX shell and HOME/USER vars, so
initializeCommand fails (error 193) and ${localEnv:...} resolves
to empty strings. Add a callout before the clone command.
* docs(readme): recommend Docker Engine over Docker Desktop
Docker Desktop needs extra setup (WSL2 integration, file sharing,
resource limits) to work with Dev Containers, and preps/ covers the
Engine path only. Bump Engine to primary recommendation on all
platforms and note Desktop as an optional alternative not documented
here.
* docs(readme): note how to give lecturer access for review
Without adding yevhenkuznetsov as a collaborator, the lecturer cannot
see private student repos at all and cannot submit formal reviews
(approve/request changes) even on public ones.
* docs(readme): add farnblack as second lecturer contact
The course has two lecturers; the 'Доступ для перевірки' section only
listed yevhenkuznetsov. Add farnblack alongside so students grant
collaborator access to both when creating their repo.
* docs(readme): drop git-sync recipes, route updates through Slack
Cherry-pick / merge / remote add for syncing course-repo changes turn
out brittle: template/manual-copy student repos have no shared history
with course/main, so merge fails outright and cherry-pick can conflict
on locally-modified files.
Replace the section with a one-paragraph note that any meaningful
course-repo change comes with a Slack announcement and explicit
instructions on what to replace by hand. Keep the explanation of why
git-sync doesn't work, since that question will keep coming up.
* docs(preps): align setup docs with template flow
Block 2 / Lessons 2.1-2.2
Update setup instructions to use the GitHub template workflow instead of the old lesson branch. Adjust the verification step to build the current homework target.
* chore(clangd): wire clangd to CMake compile database
Block 2 / Lesson 2.3
Export compile_commands.json from the root CMake project and point clangd at the generated build directory inside the devcontainer.
* chore(clang-tools): add clang-tidy course config
Block 2 / Lesson 2.6
Add the course clang-tidy configuration, install clang-tidy in the devcontainer, and copy the config into the container root alongside the existing clang-format setup.
* chore(devcontainer): add debug tools for diagnostics
Block 2 / Lesson 2.4
Install the GDB and Valgrind tools needed for diagnostics demos and homework. Also keep the devcontainer terminal settings inside VS Code settings and remove the trailing mount entry comma so the file is valid JSON.
* docs(config): document student-facing setup files
Block 2 / Lessons 2.3-2.6
Add Ukrainian comments to CMake, devcontainer, formatter/linter configs, Git settings, VS Code host recommendation, and homework starter code so student-facing files explain why each block exists.
* docs(homework): keep C++ comments in English
Block 2 / Lesson 2.4
Translate homework starter C++ comments to English while keeping student-facing configuration comments in Ukrainian.
* chore(vscode): add build and clean tasks
Block 2 / Lessons 2.3-2.4
Add VS Code tasks for configuring/building the CMake project and cleaning the local build directory.
* docs(changelog): record tooling updates
Block 2 / Lessons 2.1-2.6
Document the clangd, clang-tidy, debug tooling, VS Code tasks, setup docs, and student-facing config updates from the latest repository changes.
* feat(block-2-lesson-2-4): add local and remote GDB demo
Block: 2
Lesson: 2.4
* feat(block-2-lesson-2-4): add homework 05 telemetry starter
Block: 2
Lesson: 2.4
* chore(block-2-lesson-2-4): add debug presets and launch tooling
Block: 2
Lesson: 2.4
* docs(block-2-lesson-2-4): document debug demo and homework starter
Block: 2
Lesson: 2.4
* fix(block-2-lesson-2-4): align debug_probe demo naming
Block: 2
Lesson: 2.4
* chore(block-2-lesson-2-4): enable core dump debugging in devcontainer
Block: 2
Lesson: 2.4
* fix(block-2-lesson-2-4): add clang sanitizer runtime to devcontainer
Block: 2
Lesson: 2.4
* fix(block-2-lesson-2-4): adjust devcontainer diagnostics setup
Block: 2
Lesson: 2.4
* docs(block-2-lesson-2-4): document course update sync flow
Block: 2
Lesson: 2.4
* chore: relax clang-tidy rules for lesson 2.6
---------
Co-authored-by: Dima Pylypenko <pylypenkodima@gmail.com>
Co-authored-by: Yevhen Kuznetsov <eugene.kuznetsov.de@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.