diff options
| author | 李佳 <[email protected]> | 2019-07-09 13:13:45 +0800 |
|---|---|---|
| committer | 李佳 <[email protected]> | 2019-07-09 13:13:45 +0800 |
| commit | e7a53ff8b90e30fbd700ae29cc4947ea0257b788 (patch) | |
| tree | 9d4eeb42c7208a2db67d5547c32534254feca00f | |
| parent | cdf19e44025cb75b57d8b551f6b040201c1a79c3 (diff) | |
| parent | 906233f67e243953a9b84cb4dff93919fbbf0811 (diff) | |
Master
See merge request Alpha_lib/hello_ci_world!1
| -rw-r--r-- | .gitlab-ci.yml | 34 | ||||
| -rw-r--r-- | CMakeLists.txt | 27 | ||||
| -rw-r--r-- | LICENSE | 24 | ||||
| -rw-r--r-- | README.md | 3 | ||||
| -rw-r--r-- | src/hello_ci_world.c | 7 | ||||
| -rw-r--r-- | test/test.c | 15 |
6 files changed, 108 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..afaa968 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,34 @@ +# 定义 stages +stages: + - build + - test + +# 定义 job +job_test: + stage: test + script: + - echo program test start at `date +"%Y/%m/%d, %H:%M:%S"` >> /tmp/ci_auto_test.log + - cd test + - chmod +x test_hello_ci_world + - ./test_hello_ci_world + +# 定义 job +job_build: + stage: build + + script: + - rm -f test/test_hello_ci_world + - mkdir -p build + - rm -rf build/* + - cd build + - cmake .. + - make + - make install + - cd .. + - echo program build start at `date +"%Y/%m/%d, %H:%M:%S"` >> /tmp/ci_auto_build.log + + artifacts: + name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA" + paths: + - ./build/* + - ./test/*
\ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..f806d7d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required (VERSION 2.8) + +set(lib_name hello_ci_world) + +project (${lib_name}) + +file(GLOB SRC + "src/*.c" + "src/*.cpp" +) + +LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib) + +# static Library Output +add_library(${lib_name} STATIC ${SRC}) +set_target_properties(${lib_name} PROPERTIES OUTPUT_NAME ${lib_name}) + +add_executable(test_hello_ci_world test/test.c) +target_link_libraries(test_hello_ci_world ${lib_name}) + + +set(CMAKE_INSTALL_RPATH ${CMAKE_SOURCE_DIR}/lib) +SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + +#install(TARGETS ${lib_name} LIBRARY DESTINATION ${CMAKE_SOURCE_DIR}/lib) +install(TARGETS test_hello_ci_world DESTINATION ${CMAKE_SOURCE_DIR}/test) @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to <http://unlicense.org> @@ -1,3 +1,2 @@ # hello_ci_world - -A simple project shows how Gitlab CI works.
\ No newline at end of file +A simple project shows how Gitlab CI works. diff --git a/src/hello_ci_world.c b/src/hello_ci_world.c new file mode 100644 index 0000000..d6eb692 --- /dev/null +++ b/src/hello_ci_world.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int hello_ci_world(void) +{ + printf("hello, ci world!\n"); + return 0; +} diff --git a/test/test.c b/test/test.c new file mode 100644 index 0000000..5812bcd --- /dev/null +++ b/test/test.c @@ -0,0 +1,15 @@ +#include <stdio.h> + +#define SUCC 0 +#define ERROR -1 + +extern int hello_ci_world(void); + +int main(void) +{ + printf("libhello_ci_world test starting...\n"); + hello_ci_world(); + + //return SUCC; + return ERROR; +} |
