Skip to content

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
timblechmann committed Nov 27, 2023
1 parent 58dc748 commit f01855e
Show file tree
Hide file tree
Showing 10 changed files with 337 additions and 51 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/ci.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Linux builds

on:
push:
branches:
- master
- develop
- githubactions*
- feature/**
- fix/**
- pr/**
jobs:
build-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
compiler: [g++-12, g++-13]

env:
CONAN_USER_HOME: "${{ github.workspace }}/release/"
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/release/short"

steps:
- uses: actions/checkout@v2

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-${{ matrix.compiler }}

- name: Using the builtin GitHub Cache Action for .conan
id: cache-conan
uses: actions/cache@v1
env:
cache-name: cache-conan-modules
with:
path: ${{ env.CONAN_USER_HOME }}
key: ${{ runner.os }}-builder-${{ env.cache-name }}
restore-keys: ${{ runner.os }}-builder-${{ env.cache-name }}

- name: Conan installation
id: conan
uses: turtlebrowser/[email protected]

- name: Configure, Build, and Test Project
uses: threeal/[email protected]
with:
run-build: true
run-test: true
options: CMAKE_PROJECT_TOP_LEVEL_INCLUDES=cmake/conan_provider.cmake CMAKE_BUILD_TYPE=Release CMAKE_CXX_COMPILER_LAUNCHER=ccache

env:
CXX: ${{ matrix.compiler }}
57 changes: 57 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: MacOs builds

on:
push:
branches:
- master
- develop
- githubactions*
- feature/**
- fix/**
- pr/**

jobs:
build-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [macos-13]
compiler: ['15.0.1', '14.3.1', '14.2']

env:
CONAN_USER_HOME: "${{ github.workspace }}/release/"
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/release/short"

steps:
- uses: actions/checkout@v2

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-${{ matrix.compiler }}

- name: Using the builtin GitHub Cache Action for .conan
id: cache-conan
uses: actions/cache@v1
env:
cache-name: cache-conan-modules
with:
path: ${{ env.CONAN_USER_HOME }}
key: ${{ runner.os }}-builder-${{ env.cache-name }}
restore-keys: ${{ runner.os }}-builder-${{ env.cache-name }}

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.compiler }}

- name: Conan installation
id: conan
uses: turtlebrowser/[email protected]

- name: Configure, Build, and Test Project
uses: threeal/[email protected]
with:
run-build: true
run-test: true
options: CMAKE_PROJECT_TOP_LEVEL_INCLUDES=cmake/conan_provider.cmake CMAKE_BUILD_TYPE=Release CMAKE_CXX_COMPILER_LAUNCHER=ccache
57 changes: 57 additions & 0 deletions .github/workflows/msvc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: MSVC builds

on:
push:
branches:
- master
- develop
- githubactions*
- feature/**
- fix/**
- pr/**

jobs:
build-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [windows-latest]

env:
CONAN_USER_HOME: "${{ github.workspace }}/release/"
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/release/short"

steps:
- uses: actions/checkout@v2

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-${{ matrix.compiler }}

- name: Using the builtin GitHub Cache Action for .conan
id: cache-conan
uses: actions/cache@v1
env:
cache-name: cache-conan-modules
with:
path: ${{ env.CONAN_USER_HOME }}
key: ${{ runner.os }}-builder-${{ env.cache-name }}
restore-keys: ${{ runner.os }}-builder-${{ env.cache-name }}

- name: Conan installation
id: conan
uses: turtlebrowser/[email protected]

- uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
toolset: ${{matrix.compiler}}

- name: Configure, Build, and Test Project
uses: threeal/[email protected]
with:
run-build: true
run-test: true
options: CMAKE_PROJECT_TOP_LEVEL_INCLUDES=cmake/conan_provider.cmake CMAKE_BUILD_TYPE=Release CMAKE_CXX_COMPILER_LAUNCHER=ccache
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ repos:
hooks:
- id: clang-format
types_or: [c++, c, cuda]

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.2
hooks:
- id: check-github-workflows
args: ["--verbose"]
20 changes: 17 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ add_custom_target(nova_symbol_project_files SOURCES
conanfile.txt
Readme.md
License.txt
.github/workflows/ci.yml
.github/workflows/linux.yml
.github/workflows/macos.yml
.github/workflows/msvc.yml
)


set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS conanfile.txt)

########################################################################################################################
Expand All @@ -36,14 +40,24 @@ add_library(nova_symbol STATIC ${Sources})

target_include_directories(nova_symbol PUBLIC inc)
target_link_libraries(nova_symbol
PUBLIC Boost::headers
PRIVATE cityhash::cityhash)
PUBLIC Boost::headers
PRIVATE cityhash::cityhash
)

if (APPLE)
target_link_libraries(nova_symbol
Boost::container # pmr fallback
)
endif()


########################################################################################################################

option(NOVA_SYMBOL_BUILD_TEST "Build unit tests" ON)

if (NOVA_SYMBOL_BUILD_TEST)
enable_testing()

add_executable(nova_symbol_test test/symbol_test.cpp)

add_test(NAME nova_symbol_test COMMAND nova_symbol_test)
Expand Down
35 changes: 35 additions & 0 deletions conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,43 @@
boost/1.83.0
catch2/3.4.0
cityhash/cci.20130801

[generators]
CMakeDeps
CMakeToolchain

[layout]
cmake_layout

[options]
boost*:without_atomic=True
boost*:without_chrono=True
boost*:without_container=False
boost*:without_contract=True
boost*:without_coroutine=True
boost*:without_date_time=True
boost*:without_exception=True
boost*:without_fiber=True
boost*:without_filesystem=True
boost*:without_graph=True
boost*:without_graph_parallel=True
boost*:without_iostreams=True
boost*:without_json=True
boost*:without_locale=True
boost*:without_log=True
boost*:without_math=True
boost*:without_mpi=True
boost*:without_nowide=True
boost*:without_program_options=True
boost*:without_python=True
boost*:without_random=True
boost*:without_regex=True
boost*:without_serialization=True
boost*:without_stacktrace=True
boost*:without_system=True
boost*:without_test=True
boost*:without_thread=True
boost*:without_timer=True
boost*:without_type_erasure=True
boost*:without_url=True
boost*:without_wave=True
37 changes: 35 additions & 2 deletions inc/nova/symbol/symbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@
// As a non-binding request, please use this code responsibly and ethically.


#include <cstdint>
#include <string_view>
#include <version>

#include <format>
#ifdef __cpp_lib_format
# include <format>
#endif

#include <boost/hana/string.hpp>

Expand All @@ -37,6 +41,8 @@ namespace detail {
struct symbol_data;
} // namespace detail

//----------------------------------------------------------------------------------------------------------------------

struct string_data_in_persistent_memory_t
{};

Expand All @@ -57,12 +63,35 @@ struct symbol
explicit operator std::string_view() const;
auto operator<=>( const symbol& ) const = default; // compare by pointer

uint64_t hash() const;
static uint64_t s_hash( std::string_view );

private:
const detail::symbol_data* data;
};

//----------------------------------------------------------------------------------------------------------------------

#define DEFINE_OPERATOR( OP ) \
\
inline auto operator OP( std::string_view lhs, symbol rhs ) \
{ \
return lhs OP std::string_view { rhs }; \
} \
\
inline auto operator OP( symbol lhs, std::string_view rhs ) \
{ \
return std::string_view { lhs } OP rhs; \
}

DEFINE_OPERATOR( == )
DEFINE_OPERATOR( != )
DEFINE_OPERATOR( <=> )

#undef DEFINE_OPERATOR

//----------------------------------------------------------------------------------------------------------------------

struct lexical_less
{
bool operator()( const auto& lhs, const auto& rhs ) const
Expand Down Expand Up @@ -123,7 +152,7 @@ inline symbol operator""_sym( const char* literal, size_t size )
literal,
size,
},
symbol::string_data_in_persistent_memory );
nova::string_data_in_persistent_memory );
}

#endif
Expand All @@ -138,6 +167,8 @@ inline symbol operator""_sym( const char* literal, size_t size )
} // namespace nova


#ifdef __cpp_lib_format

template <>
struct std::formatter< nova::symbol, char > : std::formatter< std::string_view >
{
Expand All @@ -148,6 +179,8 @@ struct std::formatter< nova::symbol, char > : std::formatter< std::string_view >
}
};

#endif

#if __has_include( <fmt/format.h>)

# include <fmt/format.h>
Expand Down
Loading

0 comments on commit f01855e

Please sign in to comment.