Skip to content

Commit

Permalink
Feature/setup ci (#4)
Browse files Browse the repository at this point in the history
* setup ci

* setup image for ci

* try gcc

* Update package versions

* Update .gitlab-ci.yml file
  • Loading branch information
ClausKlein authored Aug 28, 2023
1 parent bc1b50f commit 80a5aa4
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 19 deletions.
22 changes: 21 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,27 @@
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml

default:
image: saas-linux-small-amd64
tags: [linux]
before_script:
- pip install -r requirements.txt

.standard-rules: # Make a hidden job to hold the common rules
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'


stages: # List of stages for jobs, and their order of execution
- build
- test
- deploy

build-job: # This job runs in the build stage, which runs first.
stage: build
extends:
- .standard-rules # Reuse the configuration in `.standard-rules` here
script:
- echo "Compiling the code..."
- cmake --preset default
Expand All @@ -31,20 +45,26 @@ build-job: # This job runs in the build stage, which runs first.

unit-test-job: # This job runs in the test stage.
stage: test # It only starts when the job in the build stage completes successfully.
extends:
- .standard-rules # Reuse the configuration in `.standard-rules` here
script:
- echo "Running unit tests... This will take about 60 seconds."
- echo "Running unit tests... This will take about a view seconds."
- cmake --build --preset default --target test
- gcovr .

lint-test-job: # This job also runs in the test stage.
stage: test # It can run at the same time as unit-test-job (in parallel).
extends:
- .standard-rules # Reuse the configuration in `.standard-rules` here
script:
- echo "Linting code... This will take about 10 seconds."
- run-clang-tidy -p build
- echo "No lint issues found."

deploy-job: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
environment: production
script:
- echo "Deploying application..."
Expand Down
25 changes: 12 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(CMAKE_CXX_EXTENSIONS NO)
# ===============================
project(
tftpd # ORIG: netkit-tftp v0.17.6
VERSION 1.0.0
VERSION 1.0.0.1
LANGUAGES CXX
)
# ===============================
Expand Down Expand Up @@ -40,10 +40,10 @@ find_package(Threads REQUIRED)
include(cmake/CPM.cmake)

# PackageProject.cmake will be used to make our target installable
CPMAddPackage("gh:TheLartians/PackageProject.cmake@1.10.0")
CPMAddPackage("gh:TheLartians/PackageProject.cmake@1.11.0")

# see https://github.com/aminya/project_options for more info
CPMAddPackage("gh:aminya/project_options@0.26.1")
CPMAddPackage("gh:aminya/project_options@0.32.1")
# XXX list(APPEND CMAKE_MODULE_PATH ${project_options_SOURCE_DIR})

add_library(
Expand All @@ -56,16 +56,16 @@ add_library(
tftp_subs.cpp
tftp/tftpsubs.h
)
target_link_libraries(${PROJECT_NAME} PUBLIC Boost::filesystem Boost::headers Threads::Threads)
target_link_libraries(
${PROJECT_NAME} PUBLIC Boost::filesystem Boost::headers Threads::Threads
)
target_compile_definitions(${PROJECT_NAME} PUBLIC BOOST_ASIO_NO_DEPRECATED)
target_include_directories(
${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

if(PROJECT_IS_TOP_LEVEL AND CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_SKIP_INSTALL_RULES TRUE)

project_options(
PREFIX
${PROJECT_NAME}
Expand All @@ -81,13 +81,12 @@ if(PROJECT_IS_TOP_LEVEL AND CMAKE_BUILD_TYPE STREQUAL "Debug")
# ENABLE_INCLUDE_WHAT_YOU_USE
)

if(CMAKE_SKIP_INSTALL_RULES)
# FIXME: should be PRIVATE! CK
target_link_libraries(
${PROJECT_NAME} PUBLIC ${PROJECT_NAME}_project_warnings
${PROJECT_NAME}_project_options
)
endif()
# FIXME: should be PRIVATE! CK
target_link_libraries(
${PROJECT_NAME}
PUBLIC $<BUILD_INTERFACE:${PROJECT_NAME}_project_warnings>
$<BUILD_INTERFACE:${PROJECT_NAME}_project_options>
)
else()
include(cmake/WarningsAsErrors.cmake)
endif()
Expand Down
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# =============================================================================
# PYTHON PACKAGES (PIP)
# =============================================================================
# USE (python3): sudo pip3 install -r <THIS_FILE_NAME>
# USE (python3): pip3 install -r <THIS_FILE_NAME>
# =============================================================================

PyYAML>=5.4.1,<6.0
asyncio==3.4.3
# PyYAML>=5.4.1,<6.0
# asyncio==3.4.3
builddriver==0.9.0
bumpversion>=0.6.0
cmake-format>=0.6.13
cmake>=3.25
gcovr>=5.2
ninja>=1.11
pytest-asyncio==0.19.0
pytest==7.1.3
# pytest-asyncio==0.19.0
# pytest==7.1.3
tftpy>=0.8.2
wheel>=0.37.1

0 comments on commit 80a5aa4

Please sign in to comment.