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
80 changes: 80 additions & 0 deletions .github/actions/cpp-bazel/pre-merge/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

name: cpp-bazel-pre-merge
description: C++ pre-merge testing github iggy actions

inputs:
task:
description: "Task to run (lint, build, test)"
required: true

runs:
using: "composite"
steps:
- name: Setup Bazel with cache
uses: ./.github/actions/utils/setup-cpp-with-cache

- name: Setup Rust with cache
uses: ./.github/actions/utils/setup-rust-with-cache

- name: Install clang-format
if: inputs.task == 'lint'
shell: bash
run: |
if command -v clang-format-18 >/dev/null 2>&1; then
clang-format-18 --version
exit 0
fi
sudo apt-get update --yes
sudo apt-get install --yes clang-format-18
clang-format-18 --version

- name: Lint (clang-format)
if: inputs.task == 'lint'
shell: bash
run: |
cd foreign/cpp
mapfile -t files < <(find include src tests -type f \( -name '*.h' -o -name '*.hpp' -o -name '*.cc' -o -name '*.cpp' -o -name '*.cxx' \) | sort)

if [ "${#files[@]}" -eq 0 ]; then
echo "No C++ files found for clang-format check."
exit 0
fi

printf '%s\n' "${files[@]}" | xargs clang-format-18 --style=file --dry-run --Werror

- name: Build
if: inputs.task == 'build'
shell: bash
run: |
cd foreign/cpp
bazel build --config=ci //:iggy-cpp

- name: Test
if: inputs.task == 'test'
shell: bash
run: |
cd foreign/cpp
bazel test --config=ci //:iggy-cpp-test

- name: Validate task
if: inputs.task != 'lint' && inputs.task != 'build' && inputs.task != 'test'
shell: bash
run: |
echo "::error::Unsupported task '${{ inputs.task }}'. Expected one of: lint, build, test."
exit 1
37 changes: 37 additions & 0 deletions .github/actions/utils/setup-cpp-with-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

name: setup-cpp-with-cache
description: Setup Bazel toolchain and caching (bazelisk + repository + disk cache)

runs:
using: "composite"
steps:
- name: Setup Bazel with cache
uses: bazel-contrib/setup-bazel@8d2cb86a3680a820c3e219597279ce3f80d17a47
with:
bazelisk-cache: true
disk-cache: true
repository-cache: true
module-root: foreign/cpp

- name: Verify Bazel installation
shell: bash
run: |
echo "Bazel setup complete"
cd foreign/cpp
bazel --version
9 changes: 9 additions & 0 deletions .github/config/components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@ components:
- "examples/csharp/**"
tasks: ["lint", "test", "build", "e2e"]

sdk-cpp:
depends_on:
- "rust-sdk"
- "rust-server"
- "ci-infrastructure"
paths:
- "foreign/cpp/**"
tasks: ["lint", "build", "test"]

# Individual BDD tests per SDK - only run when specific SDK changes
bdd-rust:
depends_on:
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/_detect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ on:
csharp_matrix:
description: "Matrix for C# SDK"
value: ${{ jobs.detect.outputs.csharp_matrix }}
cpp_matrix:
description: "Matrix for C++ SDK"
value: ${{ jobs.detect.outputs.cpp_matrix }}
bdd_matrix:
description: "Matrix for BDD tests"
value: ${{ jobs.detect.outputs.bdd_matrix }}
Expand All @@ -58,6 +61,7 @@ jobs:
go_matrix: ${{ steps.mk.outputs.go_matrix }}
java_matrix: ${{ steps.mk.outputs.java_matrix }}
csharp_matrix: ${{ steps.mk.outputs.csharp_matrix }}
cpp_matrix: ${{ steps.mk.outputs.cpp_matrix }}
bdd_matrix: ${{ steps.mk.outputs.bdd_matrix }}
examples_matrix: ${{ steps.mk.outputs.examples_matrix }}
other_matrix: ${{ steps.mk.outputs.other_matrix }}
Expand Down Expand Up @@ -223,7 +227,7 @@ jobs:
console.log(`Total files changed: ${files.length}`);
}

const groups = { rust:[], python:[], node:[], go:[], java:[], csharp:[], bdd:[], examples:[], other:[] };
const groups = { rust:[], python:[], node:[], go:[], java:[], csharp:[], cpp:[], bdd:[], examples:[], other:[] };

// Process affected components and generate tasks
console.log('');
Expand All @@ -250,6 +254,7 @@ jobs:
else if (name === 'sdk-go') groups.go.push(...entries);
else if (name === 'sdk-java') groups.java.push(...entries);
else if (name === 'sdk-csharp') groups.csharp.push(...entries);
else if (name === 'sdk-cpp') groups.cpp.push(...entries);
else if (name.startsWith('bdd-')) {
// Individual BDD tests should run separately with proper Docker setup
groups.bdd.push(...entries);
Expand Down Expand Up @@ -296,6 +301,7 @@ jobs:
groups.go = [];
groups.java = [];
groups.csharp = [];
groups.cpp = [];
groups.bdd = [];
groups.examples = [];
groups.other = [];
Expand All @@ -309,6 +315,7 @@ jobs:
else if (name === 'sdk-go') groups.go.push(...entries);
else if (name === 'sdk-java') groups.java.push(...entries);
else if (name === 'sdk-csharp') groups.csharp.push(...entries);
else if (name === 'sdk-cpp') groups.cpp.push(...entries);
else if (name.startsWith('bdd-')) groups.bdd.push(...entries);
else if (name === 'examples-suite') groups.examples.push(...entries);
else groups.other.push(...entries);
Expand Down Expand Up @@ -344,6 +351,7 @@ jobs:
{ name: 'Go SDK', tasks: groups.go },
{ name: 'Java SDK', tasks: groups.java },
{ name: 'C# SDK', tasks: groups.csharp },
{ name: 'C++ SDK', tasks: groups.cpp },
{ name: 'BDD Tests', tasks: groups.bdd },
{ name: 'Examples', tasks: groups.examples },
{ name: 'Other', tasks: groups.other }
Expand Down Expand Up @@ -375,6 +383,7 @@ jobs:
setOutput('go_matrix', JSON.stringify(matrix(groups.go)));
setOutput('java_matrix', JSON.stringify(matrix(groups.java)));
setOutput('csharp_matrix', JSON.stringify(matrix(groups.csharp)));
setOutput('cpp_matrix', JSON.stringify(matrix(groups.cpp)));
setOutput('bdd_matrix', JSON.stringify(matrix(groups.bdd)));
setOutput('examples_matrix', JSON.stringify(matrix(groups.examples)));
setOutput('other_matrix', JSON.stringify(matrix(groups.other)));
21 changes: 14 additions & 7 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,20 @@ jobs:
with:
task: ${{ inputs.task }}

# C# SDK
- name: Run C# SDK task
if: inputs.component == 'sdk-csharp'
uses: ./.github/actions/csharp-dotnet/pre-merge
with:
task: ${{ inputs.task }}

# C++ SDK
- name: Run C++ SDK Task
if: inputs.component == 'sdk-cpp'
uses: ./.github/actions/cpp-bazel/pre-merge
with:
task: ${{ inputs.task }}

- name: Upload Java coverage to Codecov
if: inputs.component == 'sdk-java' && inputs.task == 'test'
uses: codecov/codecov-action@v5
Expand All @@ -152,13 +166,6 @@ jobs:
verbose: true
override_pr: ${{ github.event.pull_request.number }}

# C# SDK
- name: Run C# SDK task
if: inputs.component == 'sdk-csharp'
uses: ./.github/actions/csharp-dotnet/pre-merge
with:
task: ${{ inputs.task }}

- name: Upload C# coverage to Codecov
if: inputs.component == 'sdk-csharp' && (inputs.task == 'test' || inputs.task == 'e2e')
uses: codecov/codecov-action@v5
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/pre-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,19 @@ jobs:
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

# C++ SDK
test-cpp:
name: C++ • ${{ matrix.task }}
needs: detect
if: ${{ fromJson(needs.detect.outputs.cpp_matrix).include[0].component != 'noop' }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.detect.outputs.cpp_matrix) }}
uses: ./.github/workflows/_test.yml
with:
component: ${{ matrix.component }}
task: ${{ matrix.task }}

# Other components
test-other:
name: Other • ${{ matrix.component }}/${{ matrix.task }}
Expand Down Expand Up @@ -177,7 +190,7 @@ jobs:
status:
name: CI Status
runs-on: ubuntu-latest
needs: [common, detect, test-rust, test-python, test-node, test-go, test-java, test-csharp, test-bdd, test-examples, test-other]
needs: [common, detect, test-rust, test-python, test-node, test-go, test-java, test-csharp, test-cpp, test-bdd, test-examples, test-other]
if: always()
steps:
- name: Get job execution times
Expand Down Expand Up @@ -259,6 +272,7 @@ jobs:
const go = findJobInfo('Go •');
const java = findJobInfo('Java •');
const csharp = findJobInfo('C# •');
const cpp = findJobInfo('C++ •');
const bdd = findJobInfo('BDD •');
const examples = findJobInfo('Examples •');
const other = findJobInfo('Other •');
Expand All @@ -278,6 +292,7 @@ jobs:
core.setOutput('go_time', formatJobDuration(go));
core.setOutput('java_time', formatJobDuration(java));
core.setOutput('csharp_time', formatJobDuration(csharp));
core.setOutput('cpp_time', formatJobDuration(cpp));
core.setOutput('bdd_time', formatJobDuration(bdd));
core.setOutput('examples_time', formatJobDuration(examples));
core.setOutput('other_time', formatJobDuration(other));
Expand Down Expand Up @@ -367,6 +382,7 @@ jobs:
go_status=$(format_status "${{ needs.test-go.result }}" "${{ steps.times.outputs.go_time }}")
java_status=$(format_status "${{ needs.test-java.result }}" "${{ steps.times.outputs.java_time }}")
csharp_status=$(format_status "${{ needs.test-csharp.result }}" "${{ steps.times.outputs.csharp_time }}")
cpp_status=$(format_status "${{ needs.test-cpp.result }}" "${{ steps.times.outputs.cpp_time }}")
bdd_status=$(format_status "${{ needs.test-bdd.result }}" "${{ steps.times.outputs.bdd_time }}")
examples_status=$(format_status "${{ needs.test-examples.result }}" "${{ steps.times.outputs.examples_time }}")
other_status=$(format_status "${{ needs.test-other.result }}" "${{ steps.times.outputs.other_time }}")
Expand All @@ -377,6 +393,7 @@ jobs:
echo "| 🐹 Go | $go_status | ${{ steps.times.outputs.go_time }} |" >> $GITHUB_STEP_SUMMARY
echo "| ☕ Java | $java_status | ${{ steps.times.outputs.java_time }} |" >> $GITHUB_STEP_SUMMARY
echo "| 🔷 C# | $csharp_status | ${{ steps.times.outputs.csharp_time }} |" >> $GITHUB_STEP_SUMMARY
echo "| 🔶 C++ | $cpp_status | ${{ steps.times.outputs.cpp_time }} |" >> $GITHUB_STEP_SUMMARY
echo "| 🧪 BDD | $bdd_status | ${{ steps.times.outputs.bdd_time }} |" >> $GITHUB_STEP_SUMMARY
echo "| 📚 Examples | $examples_status | ${{ steps.times.outputs.examples_time }} |" >> $GITHUB_STEP_SUMMARY
echo "| 📦 Other | $other_status | ${{ steps.times.outputs.other_time }} |" >> $GITHUB_STEP_SUMMARY
Expand All @@ -392,6 +409,7 @@ jobs:
[[ "${{ needs.test-go.result }}" == "failure" ]] || \
[[ "${{ needs.test-java.result }}" == "failure" ]] || \
[[ "${{ needs.test-csharp.result }}" == "failure" ]] || \
[[ "${{ needs.test-cpp.result }}" == "failure" ]] || \
[[ "${{ needs.test-bdd.result }}" == "failure" ]] || \
[[ "${{ needs.test-examples.result }}" == "failure" ]] || \
[[ "${{ needs.test-other.result }}" == "failure" ]]; then
Expand All @@ -406,6 +424,7 @@ jobs:
[[ "${{ needs.test-go.result }}" == "cancelled" ]] || \
[[ "${{ needs.test-java.result }}" == "cancelled" ]] || \
[[ "${{ needs.test-csharp.result }}" == "cancelled" ]] || \
[[ "${{ needs.test-cpp.result }}" == "cancelled" ]] || \
[[ "${{ needs.test-bdd.result }}" == "cancelled" ]] || \
[[ "${{ needs.test-examples.result }}" == "cancelled" ]] || \
[[ "${{ needs.test-other.result }}" == "cancelled" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ members = [
"core/tools",
"examples/rust",
]
exclude = ["foreign/python"]
exclude = ["foreign/cpp", "foreign/python"]
resolver = "2"

[workspace.dependencies]
Expand Down
54 changes: 54 additions & 0 deletions foreign/cpp/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Bazel configuration for iggy C++ bindings

# Enable BzlMod
common --enable_bzlmod

# Shared compiler warnings
build --copt=-Wall
build --copt=-Wpedantic
build --copt=-Werror
Comment thread
hubcio marked this conversation as resolved.
build --copt=-Wextra

# Debug configuration
build:debug --compilation_mode=dbg
build:debug --copt=-g3
build:debug --copt=-O0
build:debug --copt=-fno-omit-frame-pointer
build:debug --copt=-DDEBUG
build:debug --strip=never
build:debug --linkopt=-g

# Release configuration
build:release --compilation_mode=opt
build:release --copt=-O2
build:release --copt=-DNDEBUG
build:release --strip=always

# CI configuration
common:ci --color=no
common:ci --curses=no
common:ci --announce_rc

build:ci --config=release
build:ci --lockfile_mode=error

test:ci --lockfile_mode=error
test:ci --test_output=errors
test:ci --test_summary=detailed
1 change: 1 addition & 0 deletions foreign/cpp/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.0.0
Loading
Loading