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 b456171
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 37 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/ci.yml

This file was deleted.

60 changes: 60 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
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: 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 }}-${{ hashFiles('conanfile.txt') }}
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 }}
56 changes: 56 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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 }}-${{ hashFiles('conanfile.txt') }}
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
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"]
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ 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
)
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS conanfile.txt)

Expand Down Expand Up @@ -44,6 +45,8 @@ target_link_libraries(nova_symbol
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
6 changes: 6 additions & 0 deletions conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
boost/1.83.0
catch2/3.4.0
cityhash/cci.20130801

[generators]
CMakeDeps
CMakeToolchain

[layout]
cmake_layout

[options]
boost*:header_only=True
catch2*:shared=False
9 changes: 8 additions & 1 deletion inc/nova/symbol/symbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@


#include <string_view>
#include <version>

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

#include <boost/hana/string.hpp>

Expand Down Expand Up @@ -138,6 +141,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 +153,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
5 changes: 5 additions & 0 deletions test/symbol_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ TEST_CASE( "symbol" )
CHECK( b != a_4 );
}


#ifdef __cpp_lib_format

TEST_CASE( "format" )
{
nova::symbol a( "a" );
CHECK( std::format( "{}", a ) == "a" );
}

#endif

0 comments on commit b456171

Please sign in to comment.