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
6 changes: 3 additions & 3 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
sudo apt upgrade -y
sudo DEBIAN_FRONTEND=noninteractive sudo apt install -y tzdata
# DEBIAN_FRONTEND=noninteractive apt install -y tzdata
sudo apt install software-properties-common -y
# sudo apt install software-properties-common -y
sudo apt install cmake clang curl pkg-config -y

- name: Make scripts executable
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
path: capnp
key: ${{ runner.os }}-cache-capnp

- name: Download and Compile capnp is not cached
- name: Download and Compile capnp if not cached
if: steps.cache-capnp.outputs.cache-hit != 'true'
run: |
sudo ./scripts/download_install_dependencies.sh capnp compile
Expand All @@ -78,7 +78,7 @@ jobs:
run: |
cmake -S . -B build -DCMAKE_CXX_COMPILER=$(which clang++) -DCMAKE_BUILD_TYPE=Debug
cd build && make
./scaler/object_storage/tests/test_update_record
ctest

- name: Install Python Dependent Packages
run: |
Expand Down
29 changes: 27 additions & 2 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ permissions:

jobs:
deploy:
runs-on: ubuntu-latest
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
environment: release
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm]
permissions:
id-token: write
steps:
Expand All @@ -25,15 +29,36 @@ jobs:
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install uv
pip install cibuildwheel==2.23.3
uv pip install --system -r pyproject.toml

- name: Build package
run: python -m build
# run: python -m build
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BEFORE_ALL: |
echo "Building deps"
yum install sudo -y;
sudo ./scripts/download_install_dependencies.sh capnp compile
sudo ./scripts/download_install_dependencies.sh capnp install
sudo ./scripts/download_install_dependencies.sh boost compile
sudo ./scripts/download_install_dependencies.sh boost install
CIBW_BUILD: "*manylinux_x86_64"
CIBW_SKIP: "pp*"
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"

- name: Build Sdist
run: |
python -m build --sdist
sudo mv dist/scaler* wheelhouse/.

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@db8f07d3871a0a180efa06b95d467625c19d5d5f # release/v1
# path: ./wheelhouse/*.whl
path: ./wheelhouse/*
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# set(CMAKE_CXX_SCAN_FOR_MODULES ON)
set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")

if(NOT SKBUILD_PROJECT_NAME)
set(SKBUILD_PROJECT_NAME "scaler")
Expand Down Expand Up @@ -36,5 +37,15 @@ else()
message(STATUS "${PROJECT_NAME} ${CMAKE_BUILD_TYPE} build")
endif()

find_package(CapnProto CONFIG REQUIRED)
get_target_property(CAPNP_INCLUDE_DIRS CapnProto::capnp INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "Found Capnp in ${CAPNP_INCLUDE_DIRS}")
# Make LSP happy
include_directories(${CAPNP_INCLUDE_DIRS})
include_directories(${PROJECT_SOURCE_DIR})

add_subdirectory(scaler)

if(NOT SKBUILD_STATE)
add_subdirectory(tests)
endif()
9 changes: 0 additions & 9 deletions scaler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,2 @@
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")

find_package(CapnProto CONFIG REQUIRED)

get_target_property(CAPNP_INCLUDE_DIRS CapnProto::capnp INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "Found Capnp in ${CAPNP_INCLUDE_DIRS}")
# Make LSP happy
include_directories(${CAPNP_INCLUDE_DIRS})

add_subdirectory(object_storage)

7 changes: 0 additions & 7 deletions scaler/object_storage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,3 @@ target_include_directories(server PRIVATE ${CMAKE_BINARY_DIR})

install(TARGETS server
LIBRARY DESTINATION ${CMAKE_SOURCE_DIR}/scaler/lib)
message(STATUS ${CMAKE_SOURCE_DIR}/scaler/lib)

# Build tests only when triggering manually for now. Later we change
# when we have proper unit tests
if(NOT SKBUILD_STATE)
add_subdirectory(tests)
endif()
4 changes: 2 additions & 2 deletions scaler/object_storage/io_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#include <boost/asio/write.hpp>
#include <boost/system/system_error.hpp>

#include "constants.h"
#include "defs.h"
#include "protocol/object_storage.capnp.h"
#include "scaler/object_storage/constants.h"
#include "scaler/object_storage/defs.h"

using boost::asio::awaitable;
using boost::asio::use_awaitable;
Expand Down
2 changes: 1 addition & 1 deletion scaler/object_storage/io_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/read.hpp>

#include "defs.h"
#include "scaler/object_storage/defs.h"

namespace scaler {
namespace object_storage {
Expand Down
69 changes: 0 additions & 69 deletions scaler/object_storage/tests/CMakeLists.txt

This file was deleted.

78 changes: 0 additions & 78 deletions scaler/object_storage/tests/test_server_main.cpp

This file was deleted.

8 changes: 4 additions & 4 deletions scripts/download_install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ if [ "$1" == "boost" ]; then
tar -xzf ${BOOST_PACKAGE_NAME}
mv ${BOOST_FOLDER_NAME} boost
elif [ "$2" == "install" ]; then
sudo cp -r boost/boost /usr/include/.
echo "Installed Boost into /usr/include/boost"
sudo cp -r boost/boost /usr/local/include/.
echo "Installed Boost into /usr/local/include/boost"
else
echo "Argument needs to be either compile or install"
exit 1
Expand All @@ -29,12 +29,12 @@ elif [ "$1" == "capnp" ]; then
tar -xzf ${CAPNP_PACKAGE_NAME}
mv ${CAPNP_FOLDER_NAME} capnp
cd capnp
./configure --prefix=/usr/
./configure --prefix=/usr/local/
make -j6 check
elif [ "$2" == "install" ]; then
cd capnp
sudo make install
echo "Installed capnp into /usr"
echo "Installed capnp into /usr/local"
else
echo "Argument needs to be either compile or install"
exit 1
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(object_storage)
50 changes: 50 additions & 0 deletions tests/object_storage/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/155b337c938a2953e5675f9dc18c99f05f4c85d0.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)

set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
set(BUILD_GTEST ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)

add_executable(
test_update_record
test_update_record.cpp
${PROJECT_SOURCE_DIR}/scaler/object_storage/io_helper.cpp
)

target_include_directories(test_update_record
PRIVATE ${CMAKE_BINARY_DIR}
)

target_link_libraries(
test_update_record
PRIVATE GTest::gtest_main
PRIVATE CapnProto::capnp
)

add_test(NAME test_update_record COMMAND test_update_record)

add_executable(
test_scaler_object
test_scaler_object.cpp
${PROJECT_SOURCE_DIR}/scaler/object_storage/io_helper.cpp
${PROJECT_SOURCE_DIR}/scaler/object_storage/server.cpp
${CMAKE_BINARY_DIR}/protocol/object_storage.capnp.c++
)

target_include_directories(test_scaler_object
PRIVATE ${CMAKE_BINARY_DIR}
)

target_link_libraries(
test_scaler_object
PRIVATE GTest::gtest_main
PRIVATE CapnProto::capnp
)

add_test(NAME test_scaler_object COMMAND test_scaler_object)
Loading
Loading