-
Notifications
You must be signed in to change notification settings - Fork 8
ci(cpp-tui): add lint, build and integration test #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Teodor Ciuraru (teodorciuraru)
merged 45 commits into
main
from
teodor/add-cpp-browserstack-pipeline
Sep 11, 2025
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
cb46a45
feat: add C++ CI pipeline with BrowserStack integration
748c3cd
fix: apply clang-format to existing C++ files and fix script permissions
80f260f
fix: resolve CI build issues and apply code review suggestions
03bae88
fix: make C++ CI pipeline work end-to-end with mock SDK
90d83ff
fix: complete C++ CI pipeline with fully working mock SDK
c553834
fix: comprehensive mock SDK implementation for C++ CI pipeline
cead34d
fix: implement comprehensive mock SDK with all required APIs
98c850a
fix: add missing mock SDK methods and improve json initialization
f2870ec
fix: resolve compilation errors in C++ CI pipeline
75a2d64
fix: resolve macOS clang compilation issues in C++ CI
bfd8399
feat: clean C++ CI pipeline with lint, build, integration test
948462b
fix: use REAL Ditto SDK for proper integration testing
6b17d78
fix: correct LogLevel enum case in C++ TUI main.cpp
8e52879
fix: restore real Ditto SDK API compatibility in tasks_peer.cpp
9b35672
fix: use lowercase LogLevel enum values for real Ditto SDK
f6699ad
clean: remove cruft, mocks, unit tests and redundant PR checks
28d9b60
fix: recreate sdk directory for CI SDK downloads
f74f3c4
fix: apply Copilot suggestions for C++ standard consistency
e614034
feat: add automatic SDK download and apply remaining Copilot suggestions
1ee1abd
fix: rename misleading BrowserStack workflow to Secondary CI
a2f418b
remove: unnecessary secondary CI workflow
d0347d1
feat: finalize C++ CI pipeline with comprehensive integration tests
2b07072
clean: remove redundant test document insertion from CI
cff077c
Merge branch 'main' of github.com:getditto/quickstart into teodor/add…
3567ac4
feat: add inverted timestamp seeding and exact document verification …
9138a87
clean: simplify C++ integration test to focus on GitHub seeded docume…
f3e2031
simplify: create minimal C++ integration test for GitHub seeded document
bd6919f
rename: cpp-ci.yml → cpp-tui-ci.yml for clarity
a0d28c1
docs: restore and update SDK README with auto-download info
be50b60
fix: revert executable permission on generate_env.awk
c053f96
fix: correct Ditto SDK method call from get_sync() to sync()
49284af
docs: clarify SDK setup - Linux OOTB, macOS/Windows manual
be841aa
fix: restore simple SDK instructions for macOS/Windows
20a0aad
docs: clarify C++ TUI is Linux-only based on official Ditto compatibi…
f1da6b6
remove: duplicate SDK README - keep only top-level README
5465f0a
docs: reframe platform support with positive messaging
8804b1f
refactor: split C++ CI into separate lint, build, and integration tes…
7c20089
fix: create build directory and correct deprecated sync API
892cc38
test: add false positive detection to integration test
6597b25
test: intentionally break test to verify exact matching
71ecf63
fix: restore test to look for correct seeded document title
54c2e12
test: simulate test failure by adding suffix to expected title
7323d51
fix: restore integration test to correct exact matching behavior
c133117
refactor: clean up integration test output for production CI
2856e9d
style: apply PR review suggestions for modern C++ practices
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| name: C++ TUI CI | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'cpp-tui/**' | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - 'cpp-tui/**' | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
|
|
||
| jobs: | ||
| lint: | ||
| name: Lint | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y clang-format | ||
|
|
||
| - name: Run clang-format check | ||
| working-directory: cpp-tui/taskscpp | ||
| run: | | ||
| make format | ||
| if ! git diff --exit-code; then | ||
| echo "❌ Code style issues found. Run 'make format' to fix." | ||
| exit 1 | ||
| fi | ||
|
|
||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| needs: lint | ||
| timeout-minutes: 15 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y cmake clang build-essential | ||
|
|
||
| - name: Create .env file | ||
| run: | | ||
| echo "DITTO_APP_ID=${{ secrets.DITTO_APP_ID }}" > .env | ||
| echo "DITTO_PLAYGROUND_TOKEN=${{ secrets.DITTO_PLAYGROUND_TOKEN }}" >> .env | ||
| echo "DITTO_AUTH_URL=${{ secrets.DITTO_AUTH_URL }}" >> .env | ||
| echo "DITTO_WEBSOCKET_URL=${{ secrets.DITTO_WEBSOCKET_URL }}" >> .env | ||
|
|
||
| - name: Download and setup Ditto C++ SDK | ||
| working-directory: cpp-tui/taskscpp | ||
| run: make download-sdk | ||
|
|
||
| - name: Build application | ||
| working-directory: cpp-tui/taskscpp | ||
| run: | | ||
| awk -f scripts/generate_env.awk ../../.env > src/env.h | ||
| make build | ||
|
|
||
| integration-test: | ||
| name: Integration Test | ||
| runs-on: ubuntu-latest | ||
| needs: [lint, build] | ||
| timeout-minutes: 10 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y cmake clang build-essential | ||
|
|
||
| - name: Create .env file | ||
| run: | | ||
| echo "DITTO_APP_ID=${{ secrets.DITTO_APP_ID }}" > .env | ||
| echo "DITTO_PLAYGROUND_TOKEN=${{ secrets.DITTO_PLAYGROUND_TOKEN }}" >> .env | ||
| echo "DITTO_AUTH_URL=${{ secrets.DITTO_AUTH_URL }}" >> .env | ||
| echo "DITTO_WEBSOCKET_URL=${{ secrets.DITTO_WEBSOCKET_URL }}" >> .env | ||
|
|
||
| - name: Insert test document into Ditto Cloud | ||
| run: | | ||
| TIMESTAMP=$(date +%s) | ||
| INVERTED_TIMESTAMP=$((9999999999 - TIMESTAMP)) | ||
| DOC_ID="${INVERTED_TIMESTAMP}_ci_test_${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER}" | ||
| DOC_TITLE="${INVERTED_TIMESTAMP}_ci_test_${GITHUB_RUN_ID}_${GITHUB_RUN_NUMBER}" | ||
|
|
||
| RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \ | ||
| -H 'Content-type: application/json' \ | ||
| -H "Authorization: Bearer ${{ secrets.DITTO_API_KEY }}" \ | ||
| -d "{ | ||
| \"statement\": \"INSERT INTO tasks DOCUMENTS (:newTask) ON ID CONFLICT DO UPDATE\", | ||
| \"args\": { | ||
| \"newTask\": { | ||
| \"_id\": \"${DOC_ID}\", | ||
| \"title\": \"${DOC_TITLE}\", | ||
| \"done\": false, | ||
| \"deleted\": false | ||
| } | ||
| } | ||
| }" \ | ||
| "https://${{ secrets.DITTO_API_URL }}/api/v4/store/execute") | ||
|
|
||
| HTTP_CODE=$(echo "$RESPONSE" | tail -n1) | ||
| BODY=$(echo "$RESPONSE" | head -n-1) | ||
|
|
||
| if [ "$HTTP_CODE" -eq 200 ] || [ "$HTTP_CODE" -eq 201 ]; then | ||
| echo "GITHUB_TEST_DOC_TITLE=${DOC_TITLE}" >> $GITHUB_ENV | ||
| else | ||
| echo "❌ Failed to insert document. HTTP Status: $HTTP_CODE" | ||
| echo "Response: $BODY" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Download and setup Ditto C++ SDK | ||
| working-directory: cpp-tui/taskscpp | ||
| run: make download-sdk | ||
|
|
||
| - name: Build and run integration test | ||
| working-directory: cpp-tui/taskscpp | ||
| env: | ||
| GITHUB_TEST_DOC_TITLE: ${{ env.GITHUB_TEST_DOC_TITLE }} | ||
| GITHUB_RUN_ID: ${{ github.run_id }} | ||
| GITHUB_RUN_NUMBER: ${{ github.run_number }} | ||
| run: | | ||
| awk -f scripts/generate_env.awk ../../.env > src/env.h | ||
| mkdir -p build | ||
| g++ -std=c++17 -I./src -I./sdk -I./third_party/cxxopts/include \ | ||
| tests/integration_test.cpp \ | ||
| src/task.cpp src/tasks_peer.cpp src/tasks_log.cpp \ | ||
| -L./sdk -lditto -ldl -lrt -pthread \ | ||
| -o build/integration_test | ||
| ./build/integration_test | ||
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| Ditto.h | ||
| libditto.a | ||
| # SDK files downloaded by CI |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.