Skip to content

Commit

Permalink
Make: SemVer updates and checks
Browse files Browse the repository at this point in the history
Closes #92
  • Loading branch information
ashvardanian committed Jan 27, 2024
1 parent dd3d7d7 commit ff24a3b
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 80 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
contents: write
pages: write
id-token: write

Expand All @@ -25,7 +25,7 @@ jobs:
with:
persist-credentials: false
- uses: actions/setup-node@v3
- run: cp .github/workflows/package.json . && npm install && npx semantic-release
- run: npm install --save-dev @semantic-release/exec @semantic-release/git conventional-changelog-eslint semantic-release && npx semantic-release


rebase:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/update_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

echo $1 > VERSION &&
sed -i "s/^\(#define UCALL_VERSION_MAJOR \).*/\1$(echo "$1" | cut -d. -f1)/" ./include/ucall/ucall.h &&
sed -i "s/^\(#define UCALL_VERSION_MINOR \).*/\1$(echo "$1" | cut -d. -f2)/" ./include/ucall/ucall.h &&
sed -i "s/^\(#define UCALL_VERSION_PATCH \).*/\1$(echo "$1" | cut -d. -f3)/" ./include/ucall/ucall.h &&
sed -i "s/VERSION [0-9]\+\.[0-9]\+\.[0-9]\+/VERSION $1/" CMakeLists.txt
84 changes: 84 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"branches": [
"main"
],
"debug": true,
"ci": true,
"dryRun": false,
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "eslint",
"releaseRules": [
{
"tag": "Break",
"release": "major"
},
{
"tag": "Add",
"release": "minor"
},
{
"tag": "Improve",
"release": "patch"
},
{
"tag": "Make",
"release": "patch"
},
{
"tag": "Refactor",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "eslint",
"releaseRules": [
{
"tag": "Break",
"release": "major"
},
{
"tag": "Add",
"release": "minor"
},
{
"tag": "Improve",
"release": "patch"
},
{
"tag": "Make",
"release": "patch"
},
{
"tag": "Refactor",
"release": false
}
]
}
],
"@semantic-release/github",
[
"@semantic-release/exec",
{
"prepareCmd": "bash .github/workflows/update_version.sh '${nextRelease.version}'"
}
],
[
"@semantic-release/git",
{
"assets": [
"VERSION",
"CMakeLists.txt",
"include/ucall/ucall.h"
],
"message": "Build: Released ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
36 changes: 21 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
project(ucall LANGUAGES CXX C)

project(
ucall
VERSION 0.7.1
LANGUAGES C CXX
DESCRIPTION "Up to 100x Faster FastAPI. JSON-RPC with io_uring, SIMD-acceleration, and pure CPython bindings"
HOMEPAGE_URL "https://github.com/unum-cloud/ucall")

set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)
Expand All @@ -14,9 +20,10 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

if (NOT CMAKE_BINARY_DIR OR ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
if(NOT CMAKE_BINARY_DIR OR ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
set(CMAKE_BINARY_DIR "${CMAKE_SOURCE_DIR}/build")
endif()

set(CMAKE_CACHEFILE_DIR ${CMAKE_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" CACHE PATH "Path to static libs")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" CACHE PATH "Path to shared libs")
Expand All @@ -36,7 +43,6 @@ else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
endif()


if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmax-errors=1")
endif()
Expand Down Expand Up @@ -123,17 +129,19 @@ FetchContent_Declare(
FetchContent_MakeAvailable(tb64)
include_directories(${tb64_SOURCE_DIR})

if (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
FetchContent_Declare(
OpenSSL
URL https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.7.3.tar.gz
OVERRIDE_FIND_PACKAGE
)

FetchContent_MakeAvailable(OpenSSL)

if(IS_DIRECTORY "${LibreSSL_SOURCE_DIR}")
set_property(DIRECTORY ${LibreSSL_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL YES)
endif()

set(OPENSSL_INCLUDE_DIR ${LibreSSL_SOURCE_DIR}/include)
set(OPENSSL_VERSION "1.1.1")
set(OPENSSL_FOUND true)
Expand All @@ -142,7 +150,6 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
GET_FILENAME_COMPONENT(OPENSSL_LIBDIR "${OPENSSL_ONE_LIB_PATH}" DIRECTORY)
endif()


if(MSVC)
set(PICOTLS_DIR ${CMAKE_BINARY_DIR}/_deps/picotls-ep)
set(PICOTLSVS_DIR ${PICOTLS_DIR}/picotlsvs)
Expand Down Expand Up @@ -176,15 +183,17 @@ if(MSVC)
set(URING_LIBS uring_internal)
else()
FetchContent_Declare(
picotls
GIT_REPOSITORY https://github.com/h2o/picotls.git
GIT_TAG master
picotls
GIT_REPOSITORY https://github.com/h2o/picotls.git
GIT_TAG master
)

FetchContent_MakeAvailable(picotls)

if(IS_DIRECTORY "${picotls_SOURCE_DIR}")
set_property(DIRECTORY ${picotls_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL YES)
endif()

include_directories(${picotls_SOURCE_DIR}/include)
endif()

Expand Down Expand Up @@ -219,7 +228,6 @@ endif()

find_package(Threads REQUIRED)


add_library(ucall_server_posix src/engine_posix.cpp)
target_link_libraries(ucall_server_posix simdjson::simdjson Threads::Threads ${tls_LIBS})
set(BACKENDS ucall_server_posix)
Expand All @@ -238,10 +246,10 @@ foreach(backend IN LISTS BACKENDS)
string(FIND "${backend}" "_" last_underscore REVERSE)
math(EXPR substring_length "${last_underscore} + 1")
string(SUBSTRING "${backend}" ${substring_length} -1 backend_name)

set(jsonrpc_example_name "ucall_example_login_${backend_name}")
set(rest_example_name "ucall_example_rest_${backend_name}")

add_executable(${jsonrpc_example_name} examples/login/ucall_server.cpp)
target_link_libraries(${jsonrpc_example_name} ${backend} cxxopts)
target_compile_options(${jsonrpc_example_name} PUBLIC -DCXXOPTS_NO_EXCEPTIONS=ON)
Expand All @@ -251,7 +259,6 @@ foreach(backend IN LISTS BACKENDS)
target_compile_options(${rest_example_name} PUBLIC -DCXXOPTS_NO_EXCEPTIONS=ON)
endforeach()


if(UCALL_BUILD_EXAMPLES)
add_executable(ucall_example_redis examples/redis/ucall_server.cpp)
target_link_libraries(ucall_example_redis ucall_server_posix)
Expand All @@ -265,12 +272,11 @@ endif()
find_package(Python3 REQUIRED Development.Module)
include_directories(${Python_INCLUDE_DIRS})


foreach(backend IN LISTS BACKENDS)
string(FIND "${backend}" "_" last_underscore REVERSE)
math(EXPR substring_length "${last_underscore} + 1")
string(SUBSTRING "${backend}" ${substring_length} -1 backend_name)

set(py_lib_name "ucall_${backend_name}_python")
Python3_add_library(${py_lib_name} python/lib.c)
target_include_directories(${py_lib_name} PUBLIC src/ include/ python/)
Expand Down
Loading

0 comments on commit ff24a3b

Please sign in to comment.