mirror of
https://github.com/progsource/maddy.git
synced 2026-03-25 07:50:39 +01:00
chore: add cmake find_package test
Some checks failed
run-checks / run-clang-format (push) Has been cancelled
run-tests / test-on-ubuntu (push) Has been cancelled
run-tests / test-on-windows (push) Has been cancelled
run-tests / test-on-osx (push) Has been cancelled
Some checks failed
run-checks / run-clang-format (push) Has been cancelled
run-tests / test-on-ubuntu (push) Has been cancelled
run-tests / test-on-windows (push) Has been cancelled
run-tests / test-on-osx (push) Has been cancelled
This commit is contained in:
23
.github/workflows/run-tests.yml
vendored
23
.github/workflows/run-tests.yml
vendored
@@ -12,17 +12,26 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: lukka/get-cmake@latest
|
- uses: lukka/get-cmake@latest
|
||||||
with:
|
with:
|
||||||
cmakeVersion: "~3.25.0" # <--= optional, use most recent 3.25.x version
|
cmakeVersion: "~3.25.0"
|
||||||
ninjaVersion: "^1.11.1" # <--= optional, use most recent 1.x version
|
ninjaVersion: "^1.11.1"
|
||||||
- name: build
|
- name: build
|
||||||
run: |
|
run: |
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
cd tmp
|
cd tmp
|
||||||
cmake -DMADDY_BUILD_WITH_TESTS=ON ..
|
cmake -DMADDY_BUILD_WITH_TESTS=ON -DCMAKE_INSTALL_PREFIX=./install ..
|
||||||
make -j4
|
make -j4
|
||||||
|
make install
|
||||||
- name: run tests
|
- name: run tests
|
||||||
run: |
|
run: |
|
||||||
./build/MaddyTests
|
./build/MaddyTests
|
||||||
|
- name: test find_package
|
||||||
|
run: |
|
||||||
|
cd tests/cmake/find_package
|
||||||
|
mkdir tmp
|
||||||
|
cd tmp
|
||||||
|
cmake -DCMAKE_PREFIX_PATH=../../../tmp/install ..
|
||||||
|
make -j4
|
||||||
|
./maddy_find_package_example
|
||||||
|
|
||||||
test-on-windows:
|
test-on-windows:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
@@ -30,8 +39,8 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: lukka/get-cmake@latest
|
- uses: lukka/get-cmake@latest
|
||||||
with:
|
with:
|
||||||
cmakeVersion: "~3.25.0" # <--= optional, use most recent 3.25.x version
|
cmakeVersion: "~3.25.0"
|
||||||
ninjaVersion: "^1.11.1" # <--= optional, use most recent 1.x version
|
ninjaVersion: "^1.11.1"
|
||||||
- name: build
|
- name: build
|
||||||
run: |
|
run: |
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
@@ -48,8 +57,8 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: lukka/get-cmake@latest
|
- uses: lukka/get-cmake@latest
|
||||||
with:
|
with:
|
||||||
cmakeVersion: "~3.25.0" # <--= optional, use most recent 3.25.x version
|
cmakeVersion: "~3.25.0"
|
||||||
ninjaVersion: "^1.11.1" # <--= optional, use most recent 1.x version
|
ninjaVersion: "^1.11.1"
|
||||||
- name: build
|
- name: build
|
||||||
run: |
|
run: |
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
|
|||||||
8
tests/cmake/find_package/CMakeLists.txt
Normal file
8
tests/cmake/find_package/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# This project is licensed under the MIT license. For more information see the
|
||||||
|
# LICENSE file.
|
||||||
|
cmake_minimum_required(VERSION 3.25)
|
||||||
|
|
||||||
|
find_package(maddy REQUIRED)
|
||||||
|
|
||||||
|
add_executable(maddy_find_package_example main.cpp)
|
||||||
|
target_link_libraries(maddy_find_package_example PRIVATE maddy::maddy)
|
||||||
25
tests/cmake/find_package/main.cpp
Normal file
25
tests/cmake/find_package/main.cpp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*
|
||||||
|
* This file is a tiny example project to test if find_package works correctly.
|
||||||
|
*/
|
||||||
|
#include <iostream>
|
||||||
|
#include <memory>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/parser.h"
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
std::shared_ptr<maddy::Parser> parser = std::make_shared<maddy::Parser>();
|
||||||
|
|
||||||
|
std::stringstream markdownStream;
|
||||||
|
markdownStream << "# Hello World\n"
|
||||||
|
<< "This is a **bold** text and this is *italic* text.\n";
|
||||||
|
|
||||||
|
std::cout << parser->Parse(markdownStream) << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -70,6 +70,11 @@ def format_files(dry_run):
|
|||||||
files_to_format = []
|
files_to_format = []
|
||||||
for pattern in patterns:
|
for pattern in patterns:
|
||||||
matched_files = glob.glob(pattern, recursive=True)
|
matched_files = glob.glob(pattern, recursive=True)
|
||||||
|
|
||||||
|
for file in matched_files:
|
||||||
|
if '\/tmp\/' in file or '\\tmp\\' in file:
|
||||||
|
matched_files.remove(file)
|
||||||
|
|
||||||
files_to_format.extend(matched_files)
|
files_to_format.extend(matched_files)
|
||||||
|
|
||||||
if not files_to_format:
|
if not files_to_format:
|
||||||
|
|||||||
Reference in New Issue
Block a user