-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
162 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,22 +10,31 @@ jobs: | |
runs-on: ubuntu-24.04 | ||
|
||
steps: | ||
- name: Run sccache-cache | ||
uses: mozilla-actions/[email protected] | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Conan Environment | ||
uses: hankhsu1996/[email protected] | ||
with: | ||
cache-dependencies: true | ||
cache-tool: true | ||
cache-dependencies: false | ||
cache-tool: false | ||
|
||
- name: Install conan dependencies | ||
run: | | ||
conan profile detect --force | ||
conan install . --output-folder=build --build=missing -s:a compiler.cppstd=20 -o:a generate_documentation=True | ||
conan install . --output-folder=build --build=missing -s:a compiler.cppstd=20 -o:a use_date_polyfill=True -o:a build_tests=True | ||
- name: CMake configuration | ||
run: cmake --preset conan-release -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON | ||
run: | | ||
cmake --preset conan-release \ | ||
-DBUILD_TESTS=ON \ | ||
-DBUILD_EXAMPLES=ON \ | ||
-DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING \ | ||
-DCMAKE_C_COMPILER_LAUNCHER=sccache \ | ||
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache | ||
- name: Build | ||
working-directory: build/build/Release | ||
|
@@ -49,4 +58,11 @@ jobs: | |
echo "version=$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH" >> $GITHUB_OUTPUT | ||
- name: Conan create package | ||
run: conan create . --version=${{ steps.extract-version.outputs.version }} -s:a build_type=Release --build=missing -s:a compiler.cppstd=20 -o:a generate_documentation=True | ||
run: conan create . --version=${{ steps.extract-version.outputs.version }} -s:a build_type=Release --build=missing -s:a compiler.cppstd=20 -o:a use_date_polyfill=True | ||
|
||
- name: Conan test package | ||
run: conan test ./conan_test_package sparrow/${{ steps.extract-version.outputs.version }} -s:a build_type=Release --build=missing -s:a compiler.cppstd=20 -o:a use_date_polyfill=True | ||
|
||
- name: Run sccache stat for check | ||
shell: bash | ||
run: ${SCCACHE_PATH} --show-stats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,3 +47,4 @@ CMakeUserPresets.json | |
|
||
# MacOS | ||
.DS_Store | ||
conan_test_package/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
cmake_minimum_required(VERSION 3.28) | ||
project(test_package LANGUAGES CXX) | ||
|
||
find_package(sparrow REQUIRED CONFIG) | ||
|
||
add_executable(standalone main.cpp) | ||
|
||
target_link_libraries(standalone PRIVATE sparrow::sparrow) | ||
target_compile_features(standalone PRIVATE cxx_std_20) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout | ||
from conan.tools.microsoft import is_msvc | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.generate() | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if can_run(self): | ||
self.run(os.path.join(self.cpp.build.bindirs[0], "standalone"), env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include <cassert> | ||
#include <list> | ||
|
||
#include <sparrow/builder/builder.hpp> | ||
|
||
int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv) | ||
{ | ||
// using initializer_list | ||
auto arr = sparrow::build({1, 2, 3, 4, 5}); | ||
///////////////////// | ||
// using vector | ||
std::vector<int> v{1, 2, 3, 4, 5}; | ||
auto arr2 = sparrow::build(v); | ||
///////////////////// | ||
// using list | ||
std::list<int> l{1, 2, 3, 4, 5}; | ||
auto arr3 = sparrow::build(l); | ||
///////////////////// | ||
// using any range | ||
auto iota = std::views::iota(1, 6) | ||
| std::views::transform( | ||
[](int i) | ||
{ | ||
return static_cast<int>(i); | ||
} | ||
); | ||
auto arr4 = sparrow::build(iota); | ||
///////////////////// | ||
// all of the arrays above are equivalent to the manually built array | ||
auto arr5 = sparrow::primitive_array<int>({1, 2, 3, 4, 5}); | ||
assert(arr == arr2); | ||
assert(arr == arr3); | ||
assert(arr == arr4); | ||
assert(arr == arr5); | ||
return EXIT_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters