From 5569cf76bf6f384fb9df87f100e17870f4a4f563 Mon Sep 17 00:00:00 2001 From: Ian Torres Date: Fri, 25 Oct 2024 11:19:06 -0300 Subject: [PATCH] Project initialized. --- .github/workflows/ci.yml | 27 ++++++++++ .gitignore | 3 ++ CMakeLists.txt | 66 ++++++++++++++++++++++++ Dockerfile | 16 ++++++ LICENSE | 15 ++++++ README.md | 11 ++++ cmake/AuthenticationConfig.cmake.in | 5 ++ lib/headers/authentication/container.hpp | 11 ++++ lib/sources/container.cpp | 4 ++ tests/base_test.cc | 6 +++ tests/implementation_test.cc | 6 +++ 11 files changed, 170 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 README.md create mode 100644 cmake/AuthenticationConfig.cmake.in create mode 100644 lib/headers/authentication/container.hpp create mode 100644 lib/sources/container.cpp create mode 100644 tests/base_test.cc create mode 100644 tests/implementation_test.cc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..df65f73 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: CI + +on: + push: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v6 + with: + push: ${{ github.ref == 'refs/heads/master' }} + tags: iantorres/authentication:latest \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8bd7793 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/cmake-build-debug +/bin +.idea \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..5676378 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,66 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 3.25) +PROJECT(Authentication VERSION 1.0.0 LANGUAGES CXX) + +SET(CMAKE_CXX_STANDARD 23) +SET(CMAKE_CXX_STANDARD_REQUIRED True) + +OPTION(BUILD_TESTS "Build tests" OFF) + +INCLUDE(FetchContent) + +INCLUDE_DIRECTORIES(lib/headers) + +FILE(GLOB_RECURSE SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/lib/sources/*.cpp") +FILE(GLOB_RECURSE TESTS CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/tests/*.cc") + +ADD_LIBRARY(authentication STATIC ${SOURCES}) + +TARGET_INCLUDE_DIRECTORIES(authentication PUBLIC + $ + $ +) + +INSTALL(DIRECTORY lib/headers/ DESTINATION include) + +INSTALL(TARGETS authentication + EXPORT AuthenticationTargets + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES DESTINATION include +) + +INSTALL(EXPORT AuthenticationTargets + FILE AuthenticationTargets.cmake + NAMESPACE authentication:: + DESTINATION lib/cmake/Authentication +) + +INCLUDE(CMakePackageConfigHelpers) +CONFIGURE_PACKAGE_CONFIG_FILE( + cmake/AuthenticationConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/AuthenticationConfig.cmake + INSTALL_DESTINATION lib/cmake/Authentication +) + +INSTALL(FILES + ${CMAKE_CURRENT_BINARY_DIR}/AuthenticationConfig.cmake + DESTINATION lib/cmake/Authentication +) + +SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) + +if (BUILD_TESTS) + FETCHCONTENT_DECLARE( + googletest + URL https://github.com/google/googletest/archive/b514bdc898e2951020cbdca1304b75f5950d1f59.zip + ) + SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + FETCHCONTENT_MAKEAVAILABLE(googletest) + ENABLE_TESTING() + ADD_EXECUTABLE(tests ${TESTS} ${SOURCES}) + TARGET_LINK_LIBRARIES(tests GTest::gtest_main) + INCLUDE(GoogleTest) + GTEST_DISCOVER_TESTS(tests) +endif() + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a76bdb3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM iantorres/boosted:amd64-latest + +COPY . . + +RUN mkdir build \ + && cd build \ + && cmake .. -DBUILD_TESTS=ON \ + && make \ + && cd ../bin \ + && ./tests + +RUN mkdir install \ + && cd install \ + && cmake .. -DBUILD_TESTS=OFF \ + && make \ + && make install \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..054cda7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,15 @@ +ZenAlgorithms Authentication +Copyright (C) 2024 Ian Torres + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as +published by the Free Software Foundation, either version 3 of the +License, or any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..1d9fb00 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +## Build + +```shell +git clone https://github.com/ZenAlgorithms/Authentication.git +cd Authentication +mkdir build +cd build +cmake .. +make +make install +``` diff --git a/cmake/AuthenticationConfig.cmake.in b/cmake/AuthenticationConfig.cmake.in new file mode 100644 index 0000000..a026082 --- /dev/null +++ b/cmake/AuthenticationConfig.cmake.in @@ -0,0 +1,5 @@ +@PACKAGE_INIT@ + +INCLUDE(CMakeFindDependencyMacro) + +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/AuthenticationTargets.cmake") \ No newline at end of file diff --git a/lib/headers/authentication/container.hpp b/lib/headers/authentication/container.hpp new file mode 100644 index 0000000..bc8d7b3 --- /dev/null +++ b/lib/headers/authentication/container.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include +#include +#include +#include + +namespace authentication { + struct container { + }; +} diff --git a/lib/sources/container.cpp b/lib/sources/container.cpp new file mode 100644 index 0000000..93f2a8f --- /dev/null +++ b/lib/sources/container.cpp @@ -0,0 +1,4 @@ +#include + +namespace authentication { +} diff --git a/tests/base_test.cc b/tests/base_test.cc new file mode 100644 index 0000000..7763b4a --- /dev/null +++ b/tests/base_test.cc @@ -0,0 +1,6 @@ +#include + +TEST(Base, Assertions) { + EXPECT_EQ(true, true); + EXPECT_NE(true, false); +} diff --git a/tests/implementation_test.cc b/tests/implementation_test.cc new file mode 100644 index 0000000..1a5769b --- /dev/null +++ b/tests/implementation_test.cc @@ -0,0 +1,6 @@ +#include +#include + +TEST(Authentication, Assertions) { + using namespace authentication; +}