Skip to content

Commit ab85caa

Browse files
authored
chore: import codebase from Gerrit (#1)
Migrating code from the internal Gerrit repo to this GitHub repo, as of internal commit SHA `25d28c1443eae5cd6ba5d1bc5c70164565533d63` (internally tagged as `github-cutover`), with the following tweaks: 1. minor removals from `GEMINI.md` 1. removed `louhi_presubmit.yaml` (so there is 1 less file in this PR than the internal Gerrit repo) 1. updates to `build_and_test.yml` to get the build workflow to work Follow-up todos to fix in the build (for C++ lint and coverage check): #2 and #3
1 parent 99886c4 commit ab85caa

File tree

129 files changed

+28406
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+28406
-0
lines changed

.clang-format

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Run manually to reformat a file:
2+
# clang-format -i --style=file <file>
3+
Language: Cpp
4+
BasedOnStyle: Google

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Set default behavior to normalize all files (determined to be text) to lf
2+
* text=auto eol=lf
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
5+
---
6+
7+
## Expected Behavior
8+
9+
10+
## Actual Behavior
11+
12+
13+
## Steps to Reproduce the Problem
14+
15+
1.
16+
1.
17+
1.
18+
19+
## Specifications
20+
21+
- Version:
22+
- Platform:

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Fixes #<issue_number_goes_here>
2+
3+
> It's a good idea to open an issue first for discussion.
4+
5+
- [ ] Tests pass
6+
- [ ] Appropriate changes to documentation are included in the PR
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Build and Test
16+
17+
on:
18+
push:
19+
branches: [ "main" ]
20+
pull_request:
21+
branches: [ "main" ]
22+
23+
jobs:
24+
build:
25+
# Use larger machine with more disk space
26+
runs-on: ubuntu-24.04-32core
27+
strategy:
28+
matrix:
29+
python-version: ["3.10"]
30+
31+
steps:
32+
- uses: actions/checkout@v3
33+
34+
- name: Set up Python ${{ matrix.python-version }}
35+
uses: actions/setup-python@v3
36+
with:
37+
python-version: ${{ matrix.python-version }}
38+
39+
- run: df -h
40+
41+
- name: Install dependencies
42+
run: |
43+
python -m pip install --upgrade pip
44+
# Clean up apt cache to save space
45+
sudo apt-get clean
46+
sudo rm -rf /var/lib/apt/lists/*
47+
df -h
48+
# Install python dependencies (with coverage enabled)
49+
echo -e "\n##### Running pip install #####"
50+
pip install -e '.[dev]' --config-settings=cmake.args="-DENABLE_COVERAGE=ON"
51+
52+
- run: df -h
53+
54+
- name: Test with pytest with coverage enabled
55+
run: |
56+
# Run all tests with coverage (Python and C++)
57+
echo -e "\n##### Running Python tests with coverage #####"
58+
coverage run --source=src/ml_flashpoint --branch -m pytest -v -s
59+
60+
- name: Check Python test coverage
61+
run: |
62+
# Verify python coverage thresholds
63+
echo -e "\n##### Verifying Python coverage thresholds #####"
64+
coverage report
65+
66+
- name: Check C++ test coverage
67+
if: false # TODO(#3): fix and then re-enable
68+
run: |
69+
# Run C++ coverage check
70+
echo -e "\n##### Running C++ coverage check #####"
71+
mkdir -p htmlcov/cpp
72+
gcovr --root=. \
73+
--filter=src/ml_flashpoint \
74+
--exclude=".*/_deps/.*" \
75+
--gcov-executable=gcov \
76+
--txt-metric branch \
77+
--html-details htmlcov/cpp/index.html \
78+
--xml-pretty -o cxx-coverage.xml \
79+
--sort uncovered-number \
80+
--gcov-ignore-parse-errors negative_hits.warn \
81+
--gcov-ignore-parse-errors suspicious_hits.warn
82+
83+
lint:
84+
runs-on: ubuntu-24.04-32core
85+
strategy:
86+
matrix:
87+
python-version: [ "3.10" ]
88+
89+
steps:
90+
- uses: actions/checkout@v3
91+
92+
- name: Set up Python ${{ matrix.python-version }}
93+
uses: actions/setup-python@v3
94+
with:
95+
python-version: ${{ matrix.python-version }}
96+
97+
- name: Lint with ruff
98+
run: |
99+
pip install ruff==0.12.11
100+
ruff check .
101+
ruff format --check .
102+
103+
- name: Lint with clang-format
104+
if: false # TODO(#2): fix this then re-enable
105+
run: |
106+
# Install and run C++ linter
107+
echo -e "\n##### Installing and running clang-format linter #####"
108+
sudo apt-get update && sudo apt-get install -y clang-format
109+
clang-format --version
110+
find src -name '*.cpp' -o -name '*.h' | xargs clang-format --dry-run --Werror

.github/workflows/docs.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# [2025-12-05] This is not in use as of now, but will be if/when this repo is migrated to GitHub w/ GitHub Actions.
16+
name: Documentation
17+
on:
18+
push:
19+
branches:
20+
- main
21+
permissions:
22+
contents: read
23+
pages: write
24+
id-token: write
25+
jobs:
26+
deploy:
27+
environment:
28+
name: github-pages
29+
url: ${{ steps.deployment.outputs.page_url }}
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/configure-pages@v5
33+
- uses: actions/checkout@v5
34+
- uses: actions/setup-python@v5
35+
with:
36+
python-version: 3.x
37+
- run: pip install .[docs]
38+
- run: mkdocs build
39+
- uses: actions/upload-pages-artifact@v4
40+
with:
41+
path: site
42+
- uses: actions/deploy-pages@v4
43+
id: deployment

.gitignore

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
*.pyd
9+
10+
# Distribution / packaging
11+
.Python
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
*.gcno
53+
54+
# Environments
55+
.env
56+
.venv
57+
.venv*
58+
env/
59+
venv/
60+
ENV/
61+
env.bak/
62+
venv.bak/
63+
64+
# IDEs
65+
.idea/
66+
.vscode/
67+
*.suo
68+
*.ntvs*
69+
*.njsproj
70+
*.sln
71+
*.sw?
72+
73+
# CMake
74+
CMakeCache.txt
75+
CMakeFiles/
76+
cmake_install.cmake
77+
cmake-build-debug/

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10

CMakeLists.txt

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
cmake_minimum_required(VERSION 3.18)
16+
project(ml_flashpoint_cpp LANGUAGES CXX)
17+
18+
# --- Global Build Settings ---
19+
# Set the C++ standard for the entire project
20+
set(CMAKE_CXX_STANDARD 20)
21+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
22+
# Enable Position Independent Code (PIC) for all targets
23+
# This is CRITICAL for building Python .so modules
24+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
25+
26+
# Generate compile_commands.json for clangd
27+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
28+
29+
# --- Code Coverage ---
30+
option(ENABLE_COVERAGE "Enable code coverage" OFF)
31+
if(ENABLE_COVERAGE)
32+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
33+
message(STATUS "Code coverage is enabled")
34+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
35+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
36+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
37+
else()
38+
message(WARNING "Code coverage is only supported for GCC")
39+
endif()
40+
endif()
41+
42+
# --- Python & Pybind ---
43+
# Use FindPython to explicitly locate a Python interpreter and its
44+
# development libraries, as currently recommended.
45+
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
46+
find_package(pybind11 CONFIG REQUIRED)
47+
48+
# --- Dependencies ---
49+
include(FetchContent)
50+
FetchContent_Declare(
51+
abseil-cpp
52+
GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git
53+
GIT_TAG 20250814.1
54+
)
55+
FetchContent_MakeAvailable(abseil-cpp)
56+
57+
58+
# --- GoogleTest ---
59+
# Enable testing for the whole project if BUILD_TESTING is set (ON by default).
60+
option(BUILD_TESTING "Build tests" ON)
61+
if(BUILD_TESTING)
62+
enable_testing()
63+
FetchContent_Declare(
64+
googletest
65+
GIT_REPOSITORY https://github.com/google/googletest.git
66+
GIT_TAG release-1.12.1
67+
)
68+
FetchContent_MakeAvailable(googletest)
69+
# Include this module so child projects can use gtest_discover_tests
70+
include(GoogleTest)
71+
endif()
72+
73+
74+
# --- Sub-projects ---
75+
# Add your child projects. They will inherit all settings and
76+
# dependencies (absl::*, gtest*, pybind11::*) from this file.
77+
add_subdirectory(src/ml_flashpoint/checkpoint_object_manager/buffer_object)
78+
add_subdirectory(src/ml_flashpoint/checkpoint_object_manager/object_manager)
79+
add_subdirectory(src/ml_flashpoint/replication/transfer_service)
80+
add_subdirectory(src/ml_flashpoint/example_cpp)

0 commit comments

Comments
 (0)