Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions .github/workflows/day1-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -37,32 +37,20 @@ jobs:
if: matrix.os == 'windows-latest'
run: choco install cmake

- name: Configure project (Windows) # 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 # -B is the build directory flag
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 # -DCMAKE_BUILD_TYPE=Debug is the build type flag, needed in Unix at the configuration step
run: cmake -B build -DCMAKE_BUILD_TYPE=Debug

- 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
5 changes: 2 additions & 3 deletions day1-cmake-ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -60,7 +59,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:**
Expand All @@ -76,7 +75,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) - generating the Debug build has to use the correct generator.

**File location:**
`cpp-perf-foundations/.github/workflows/day1-ci.yml`
Expand Down
Loading