mirror of
https://github.com/progsource/maddy.git
synced 2026-03-25 16:00:39 +01:00
ci: create release workflow
This commit is contained in:
33
.github/workflows/create-release-package.yml
vendored
Normal file
33
.github/workflows/create-release-package.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: release
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: lukka/get-cmake@latest
|
||||||
|
with:
|
||||||
|
cmakeVersion: "~3.25.0" # <--= optional, use most recent 3.25.x version
|
||||||
|
ninjaVersion: "^1.11.1" # <--= optional, use most recent 1.x version
|
||||||
|
|
||||||
|
- name: create zip
|
||||||
|
run: |
|
||||||
|
mkdir tmp
|
||||||
|
cd tmp
|
||||||
|
cmake -DMADDY_CREATE_PACKAGE=ON ..
|
||||||
|
make maddy_package
|
||||||
|
|
||||||
|
- name: create release
|
||||||
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
with:
|
||||||
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
file: build/maddy-src.zip
|
||||||
|
tag: ${{ github.ref }}
|
||||||
|
body: "You can find all changes of this release in the [changelog](https://github.com/progsource/maddy/blob/master/CHANGELOG.md)"
|
||||||
@@ -26,6 +26,7 @@ maddy uses [semver versioning](https://semver.org/).
|
|||||||
*  class attribute to code blocks if there is text after the three backticks like ` ```cpp`
|
*  class attribute to code blocks if there is text after the three backticks like ` ```cpp`
|
||||||
*  optional support for latex blocks - it's off by default
|
*  optional support for latex blocks - it's off by default
|
||||||
*  version info to the parser class
|
*  version info to the parser class
|
||||||
|
*  GitHub workflow for release, so that one can include maddy easier via cmake's `FetchContent`
|
||||||
* ?
|
* ?
|
||||||
|
|
||||||
## version 1.1.2 2020-10-04
|
## version 1.1.2 2020-10-04
|
||||||
|
|||||||
@@ -7,49 +7,33 @@ project(maddy)
|
|||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
set(MADDY_CPP_VERSION 14)
|
|
||||||
add_definitions(-DCPP_VERSION=${MADDY_CPP_VERSION})
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
set(CMAKE_BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build)
|
set(CMAKE_BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build)
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
|
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
|
||||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
|
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
option(MADDY_BUILD_WITH_TESTS "enable building tests" OFF)
|
option(MADDY_BUILD_WITH_TESTS "enable building tests - does not work with zip download" OFF)
|
||||||
|
|
||||||
if(${MADDY_BUILD_WITH_TESTS})
|
if(${MADDY_BUILD_WITH_TESTS})
|
||||||
enable_testing()
|
enable_testing()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
option(MADDY_CREATE_PACKAGE "create a package for a version release" OFF)
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
set(MADDY_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
|
set(MADDY_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
if (UNIX)
|
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
||||||
set(
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
CMAKE_CXX_FLAGS
|
|
||||||
"${CMAKE_CXX_FLAGS} -g -std=c++${MADDY_CPP_VERSION} -Wall -Wpedantic -Wextra -Wno-ignored-qualifiers -fno-rtti -fno-exceptions -fsanitize=address -fno-omit-frame-pointer"
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
if(${CMAKE_CXX_STANDARD} LESS 14)
|
||||||
|
message(FATAL_ERROR "maddy requires >=C++14")
|
||||||
if (UNIX AND NOT APPLE)
|
|
||||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER}
|
|
||||||
-fuse-ld=gold -Wl,--version
|
|
||||||
ERROR_QUIET OUTPUT_VARIABLE ld_version)
|
|
||||||
if ("${ld_version}" MATCHES "GNU gold")
|
|
||||||
message(STATUS "Found Gold linker, use faster linker")
|
|
||||||
set(CMAKE_EXE_LINKER_FLAGS
|
|
||||||
"${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS
|
|
||||||
"${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold ")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
@@ -64,3 +48,14 @@ target_include_directories(maddy INTERFACE
|
|||||||
if(${MADDY_BUILD_WITH_TESTS})
|
if(${MADDY_BUILD_WITH_TESTS})
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if(${MADDY_CREATE_PACKAGE})
|
||||||
|
set(MADDY_PACKAGE_FILES include/ CMakeLists.txt LICENSE)
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-src.zip
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E tar c ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-src.zip --format=zip -- ${MADDY_PACKAGE_FILES}
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
DEPENDS ${MADDY_PACKAGE_FILES})
|
||||||
|
add_custom_target(${PROJECT_NAME}_package DEPENDS ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-src.zip)
|
||||||
|
endif()
|
||||||
|
|||||||
32
README.md
32
README.md
@@ -21,13 +21,40 @@ It is tested to work on:
|
|||||||
|
|
||||||
## Why maddy?
|
## Why maddy?
|
||||||
|
|
||||||
When I was needing a Markdown parser in C++ I couldn't find any, that was
|
When I looking for a Markdown parser in C++, I couldn't find any, that was
|
||||||
fitting my needs. So I simply wrote my own one.
|
fitting my needs. So I simply wrote my own one.
|
||||||
|
|
||||||
## Markdown syntax
|
## Markdown syntax
|
||||||
|
|
||||||
The supported syntax can be found in the [definitions docs](docs/definitions.md).
|
The supported syntax can be found in the [definitions docs](docs/definitions.md).
|
||||||
|
|
||||||
|
## How to add maddy to your cmake project
|
||||||
|
|
||||||
|
You can use [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html)
|
||||||
|
which was introduced in CMake 3.11.
|
||||||
|
|
||||||
|
This way you can add
|
||||||
|
|
||||||
|
```cmake
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
maddy
|
||||||
|
URL https://github.com/progsource/maddy/.../maddy-src.zip
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(maddy)
|
||||||
|
|
||||||
|
add_executable(my_exe)
|
||||||
|
target_link_libraries(my_exe PUBLIC maddy)
|
||||||
|
```
|
||||||
|
|
||||||
|
to your CMake file to make it work. Check the
|
||||||
|
[release](https://github.com/progsource/maddy/releases) for the full
|
||||||
|
zip-file-url.
|
||||||
|
|
||||||
|
The zip only contains a `CMakeLists.txt`, the `include` folder and the `LICENSE`
|
||||||
|
file.
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
To use maddy in your project, simply add the include path of maddy to yours
|
To use maddy in your project, simply add the include path of maddy to yours
|
||||||
@@ -52,7 +79,8 @@ std::shared_ptr<maddy::Parser> parser = std::make_shared<maddy::Parser>(config);
|
|||||||
std::string htmlOutput = parser->Parse(markdownInput);
|
std::string htmlOutput = parser->Parse(markdownInput);
|
||||||
```
|
```
|
||||||
|
|
||||||
You can find all parser flags in [`include/maddy/parserconfig.h`](include/maddy/parserconfig.h).
|
You can find all parser flags in
|
||||||
|
[`include/maddy/parserconfig.h`](include/maddy/parserconfig.h).
|
||||||
|
|
||||||
## How to run the tests
|
## How to run the tests
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,21 @@
|
|||||||
# This project is licensed under the MIT license. For more information see the
|
# This project is licensed under the MIT license. For more information see the
|
||||||
# LICENSE file.
|
# LICENSE file.
|
||||||
|
|
||||||
|
if (UNIX AND NOT APPLE)
|
||||||
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER}
|
||||||
|
-fuse-ld=gold -Wl,--version
|
||||||
|
ERROR_QUIET OUTPUT_VARIABLE ld_version)
|
||||||
|
if ("${ld_version}" MATCHES "GNU gold")
|
||||||
|
message(STATUS "Found Gold linker, use faster linker")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS
|
||||||
|
"${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS
|
||||||
|
"${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold ")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
@@ -25,4 +40,8 @@ target_include_directories(MaddyTests PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
target_link_libraries(MaddyTests maddy gmock_main)
|
target_link_libraries(MaddyTests maddy gmock_main)
|
||||||
|
set_target_properties(MaddyTests PROPERTIES
|
||||||
|
CMAKE_CXX_FLAGS
|
||||||
|
"${CMAKE_CXX_FLAGS} -g -Wall -Wpedantic -Wextra -Wno-ignored-qualifiers -fno-rtti -fno-exceptions -fsanitize=address -fno-omit-frame-pointer"
|
||||||
|
)
|
||||||
add_test(NAME MaddyTests COMMAND MaddyTests)
|
add_test(NAME MaddyTests COMMAND MaddyTests)
|
||||||
|
|||||||
Reference in New Issue
Block a user