Skip to content

Commit 54b5b52

Browse files
committed
Add section on testing CI/CD locally with act
- Document how to use act to test GitHub Actions workflows locally - Include installation instructions for act - Provide examples for quick tests and full workflow runs - Add faster alternative for testing CMake configuration manually
1 parent 3ddd86a commit 54b5b52

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,71 @@ The `VCPKG_TARGET_TRIPLET=x64-linux-release` option ensures vcpkg only builds re
114114
cmake --build build --parallel
115115
```
116116

117+
### Testing CI/CD Locally
118+
119+
You can test the GitHub Actions workflow locally before pushing using [`act`](https://github.com/nektos/act), which runs GitHub Actions workflows in Docker containers.
120+
121+
**Prerequisites:**
122+
- Docker installed and running
123+
- `act` installed (check with `which act`)
124+
125+
**Install `act` (if not already installed):**
126+
```bash
127+
# On Linux/macOS
128+
curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
129+
130+
# Or using package managers
131+
# Ubuntu/Debian
132+
sudo apt-get install act
133+
134+
# macOS
135+
brew install act
136+
```
137+
138+
**Quick test (CMake configuration only):**
139+
```bash
140+
cd /home/$USER/workspace/robotic_notes
141+
# Test just the CMake configuration step (dry run)
142+
act -j build -s GITHUB_TOKEN=dummy --dryrun
143+
```
144+
145+
**Full workflow test (takes 30+ minutes):**
146+
```bash
147+
cd /home/$USER/workspace/robotic_notes
148+
# Run the full workflow
149+
act workflow_dispatch \
150+
-W . \
151+
--container-architecture linux/amd64 \
152+
-P ubuntu-latest=catthehacker/ubuntu:act-latest \
153+
--verbose
154+
```
155+
156+
**Test specific job:**
157+
```bash
158+
# Run just the build job
159+
act -j build -W . \
160+
--container-architecture linux/amd64 \
161+
-P ubuntu-latest=catthehacker/ubuntu:act-latest
162+
```
163+
164+
**Notes:**
165+
- First run will download Docker images (can be large, ~10GB+)
166+
- Full build takes 30+ minutes as it builds all dependencies from scratch
167+
- Uses your local files, so you can test changes immediately
168+
- Some steps may behave slightly differently than on GitHub Actions
169+
170+
**Faster alternative - test CMake configuration manually:**
171+
```bash
172+
cd /home/$USER/workspace/robotic_notes
173+
# Clean build directory
174+
rm -rf build
175+
# Run the same CMake command as CI/CD
176+
cmake -S . -B build \
177+
-DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake \
178+
-DCMAKE_BUILD_TYPE=Release \
179+
-DVCPKG_TARGET_TRIPLET=x64-linux-release
180+
```
181+
117182
To build the `rerun`, just comment everything in the `CMakeLists.txt` and only leave this part:
118183

119184
```

0 commit comments

Comments
 (0)