From 3c27687c3ed221695b9558329278047691e7965b Mon Sep 17 00:00:00 2001 From: Tiago Flora Date: Thu, 10 Jul 2025 18:06:12 -0300 Subject: [PATCH 1/5] fix: added Visual Studio generator flag to avoid using Ninja instead --- .github/workflows/day1-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/day1-ci.yml b/.github/workflows/day1-ci.yml index e7efd92..a0a7a8b 100644 --- a/.github/workflows/day1-ci.yml +++ b/.github/workflows/day1-ci.yml @@ -40,7 +40,7 @@ jobs: - name: Configure project (Windows) # run the CMake build configuration step if: runner.os == 'Windows' working-directory: day1-cmake-ci - run: cmake -B build # -B is the build directory flag + run: cmake -B build -G "Visual Studio 17 2022" # -G is the generator flag, and "Visual Studio 17 2022" is the generator name for Visual Studio 2022 - name: Configure project (Unix) # run the CMake build configuration step if: runner.os != 'Windows' From 5f3708b086830b5dbac29748aa8db4db64686f07 Mon Sep 17 00:00:00 2001 From: Tiago Flora Date: Thu, 10 Jul 2025 18:10:04 -0300 Subject: [PATCH 2/5] edit: added warning about Windows --- day1-cmake-ci/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/day1-cmake-ci/README.md b/day1-cmake-ci/README.md index e6c9562..d228264 100644 --- a/day1-cmake-ci/README.md +++ b/day1-cmake-ci/README.md @@ -76,7 +76,7 @@ It provides automated CI (Continuous Integration) for every push or pull request **What this means for you:** Every time you push changes or open a pull request, your code will be automatically built and tested on all three major platforms. -If any step fails (e.g., build error, test failure, or missing dependency), the workflow will mark the CI run as failed, so you can catch issues before merging. There are a _lot_ of ways these steps can go wrong, especially if you're trying to do cross-platform development. **Consider setting up CI for the platform you are using, and adding other platforms as a stretch goal.** +If any step fails (e.g., build error, test failure, or missing dependency), the workflow will mark the CI run as failed, so you can catch issues before merging. There are a _lot_ of ways these steps can go wrong, especially if you're trying to do cross-platform development. **Consider setting up CI for the platform you are using, and adding other platforms as a stretch goal.** If you are on Windows, in particular, this step may be a bit more difficult to get right (that's usually the case with Windows). **File location:** `cpp-perf-foundations/.github/workflows/day1-ci.yml` From ad0ad5e2c81f10180cdeb2bf69787279e69964f3 Mon Sep 17 00:00:00 2001 From: Tiago Flora Date: Thu, 10 Jul 2025 18:15:46 -0300 Subject: [PATCH 3/5] fix: specified branches for Actions workflows --- .github/workflows/day1-ci.yml | 2 +- day1-cmake-ci/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/day1-ci.yml b/.github/workflows/day1-ci.yml index a0a7a8b..cdcdf42 100644 --- a/.github/workflows/day1-ci.yml +++ b/.github/workflows/day1-ci.yml @@ -2,7 +2,7 @@ name: Day 1 - CMake & CI on: push: - branches: [ main, template ] # CI will trigger on any push to main or template branch + branches: [ main, template, 'fix/*', 'feature/*', 'day*' ] # CI will trigger on main, template, fix, feature, and day-specific branches paths: - 'day1-cmake-ci/**' # CI will only trigger on changes to day1-cmake-ci directory pull_request: # CI will trigger on any pull request changing day1-cmake-ci directory diff --git a/day1-cmake-ci/README.md b/day1-cmake-ci/README.md index d228264..da48ddd 100644 --- a/day1-cmake-ci/README.md +++ b/day1-cmake-ci/README.md @@ -60,7 +60,7 @@ cmake --build . ## Configuring Github Actions CI The GitHub Actions workflow for this project is defined in `../.github/workflows/day1-ci.yml`. -It provides automated CI (Continuous Integration) for every push or pull request that affects the `day1-cmake-ci` directory. +It provides automated CI (Continuous Integration) for every push or pull request that affects the `day1-cmake-ci` directory. Beware how you set up your branches - workflows will run on updates to all of them by default. **Key features:** - **Triggers:** From b02c40831ac71e1b10423e6bf87a898ae88f0a17 Mon Sep 17 00:00:00 2001 From: Tiago Flora Date: Thu, 10 Jul 2025 18:27:13 -0300 Subject: [PATCH 4/5] simplify: use single-config approach for all platforms --- .github/workflows/day1-ci.yml | 26 ++++---------------------- day1-cmake-ci/README.md | 2 +- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/.github/workflows/day1-ci.yml b/.github/workflows/day1-ci.yml index cdcdf42..06681e1 100644 --- a/.github/workflows/day1-ci.yml +++ b/.github/workflows/day1-ci.yml @@ -37,32 +37,14 @@ jobs: if: matrix.os == 'windows-latest' run: choco install cmake - - name: Configure project (Windows) # run the CMake build configuration step - if: runner.os == 'Windows' + - name: Configure project # run the CMake build configuration step working-directory: day1-cmake-ci - run: cmake -B build -G "Visual Studio 17 2022" # -G is the generator flag, and "Visual Studio 17 2022" is the generator name for Visual Studio 2022 + run: cmake -B build -DCMAKE_BUILD_TYPE=Debug - - name: Configure project (Unix) # run the CMake build configuration step - if: runner.os != 'Windows' - working-directory: day1-cmake-ci - run: cmake -B build -DCMAKE_BUILD_TYPE=Debug # -DCMAKE_BUILD_TYPE=Debug is the build type flag, needed in Unix at the configuration step - - - name: Build project (Windows) # run the CMake build step - if: runner.os == 'Windows' - working-directory: day1-cmake-ci - run: cmake --build build --config Debug # --config Debug is the build type flag, needed in Windows at the build step - - - name: Build project (Unix) # run the CMake build step - if: runner.os != 'Windows' + - name: Build project # run the CMake build step working-directory: day1-cmake-ci run: cmake --build build - - name: Run tests (Windows) # run tests with CTest (Windows only - the --config Debug flag is required and not supported on Unix) - if: runner.os == 'Windows' - working-directory: day1-cmake-ci/build - run: ctest --verbose --config Debug # --config Debug is needed in Windows at the test step - - - name: Run tests (Unix) # run tests with CTest - if: runner.os != 'Windows' + - name: Run tests # run tests with CTest working-directory: day1-cmake-ci/build run: ctest --verbose \ No newline at end of file diff --git a/day1-cmake-ci/README.md b/day1-cmake-ci/README.md index da48ddd..454fb8e 100644 --- a/day1-cmake-ci/README.md +++ b/day1-cmake-ci/README.md @@ -76,7 +76,7 @@ It provides automated CI (Continuous Integration) for every push or pull request **What this means for you:** Every time you push changes or open a pull request, your code will be automatically built and tested on all three major platforms. -If any step fails (e.g., build error, test failure, or missing dependency), the workflow will mark the CI run as failed, so you can catch issues before merging. There are a _lot_ of ways these steps can go wrong, especially if you're trying to do cross-platform development. **Consider setting up CI for the platform you are using, and adding other platforms as a stretch goal.** If you are on Windows, in particular, this step may be a bit more difficult to get right (that's usually the case with Windows). +If any step fails (e.g., build error, test failure, or missing dependency), the workflow will mark the CI run as failed, so you can catch issues before merging. There are a _lot_ of ways these steps can go wrong, especially if you're trying to do cross-platform development. **Consider setting up CI for the platform you are using, and adding other platforms as a stretch goal.** If you are on Windows, in particular, this step may be a bit more difficult to get right (that's usually the case with Windows) - generating the Debug build has to use the correct generator. **File location:** `cpp-perf-foundations/.github/workflows/day1-ci.yml` From 45b2f8c14d23c5867e2d5e5829b6c259cc8f1b03 Mon Sep 17 00:00:00 2001 From: Tiago Flora Date: Thu, 10 Jul 2025 18:36:12 -0300 Subject: [PATCH 5/5] fix: force Ninja generator on Windows to ensure single-config behavior --- .github/workflows/day1-ci.yml | 8 +++++++- day1-cmake-ci/README.md | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/day1-ci.yml b/.github/workflows/day1-ci.yml index 06681e1..c6caa32 100644 --- a/.github/workflows/day1-ci.yml +++ b/.github/workflows/day1-ci.yml @@ -37,7 +37,13 @@ jobs: if: matrix.os == 'windows-latest' run: choco install cmake - - name: Configure project # run the CMake build configuration step + - name: Configure project (Windows) # force Ninja generator for single-config behavior + if: runner.os == 'Windows' + working-directory: day1-cmake-ci + run: cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Debug + + - name: Configure project (Unix) # run the CMake build configuration step + if: runner.os != 'Windows' working-directory: day1-cmake-ci run: cmake -B build -DCMAKE_BUILD_TYPE=Debug diff --git a/day1-cmake-ci/README.md b/day1-cmake-ci/README.md index 454fb8e..9b75068 100644 --- a/day1-cmake-ci/README.md +++ b/day1-cmake-ci/README.md @@ -15,7 +15,6 @@ A template-based calculator library demonstrating modern C++ build practices wit ``` day1-cmake-ci/ ├── src/ -├── src/ │ ├── calculator.hpp # Template calculator functions + helpers │ └── main.cpp # Interactive calculator application │ └── CMakeLists.txt # Build config for header-only interface library target and executable target for interactive calculator