Skip to content

Commit

Permalink
Merge pull request #235 from eseiler/infra/update_tdl
Browse files Browse the repository at this point in the history
[INFRA] Update TDL
  • Loading branch information
eseiler authored Feb 9, 2024
2 parents d48c51f + 5cd2f94 commit 0f91e17
Show file tree
Hide file tree
Showing 15 changed files with 200 additions and 23 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/ci_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ defaults:

jobs:
build:
name: "External project"
name: "External project ${{ contains(matrix.SHARG_NO_TDL, 'OFF') && 'with TDL' || 'without TDL' }}"
runs-on: ubuntu-22.04
timeout-minutes: 120
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint'
strategy:
fail-fast: false
matrix:
SHARG_NO_TDL: [ON, OFF]

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -48,13 +53,30 @@ jobs:
uses: seqan/actions/setup-toolchain@main
with:
compiler: gcc-13
use_actions_cache: false

- name: Install dependencies
if: matrix.SHARG_NO_TDL == 'OFF'
run: |
git clone --depth 1 --single-branch --branch 0.8.0 https://github.com/jbeder/yaml-cpp.git
cd yaml-cpp
mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE=Debug \
-DYAML_CPP_BUILD_CONTRIB=OFF \
-DYAML_CPP_BUILD_TOOLS=OFF \
-DYAML_BUILD_SHARED_LIBS=OFF \
-DYAML_CPP_INSTALL=ON \
-DYAML_CPP_BUILD_TESTS=OFF \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
make -j2
sudo make install
- name: Configure tests
run: |
mkdir sharg-build
cd sharg-build
cmake ../sharg-parser/test/external_project -DCMAKE_BUILD_TYPE=Debug
cmake ../sharg-parser/test/external_project -DCMAKE_BUILD_TYPE=Debug \
-DSHARG_NO_TDL=${{ matrix.SHARG_NO_TDL }}
make -j2 sharg_test_prerequisite
- name: Build tests
Expand Down
15 changes: 14 additions & 1 deletion build_system/sharg-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,20 @@ endif ()
set (SHARG_USE_TDL FALSE)

if (NOT SHARG_NO_TDL)
find_package (TDL QUIET HINTS ${SHARG_SUBMODULES_DIR}/submodules/tool_description_lib ${SHARG_HINT_TDL})
find_package (TDL QUIET HINTS ${SHARG_HINT_TDL})

if (NOT TDL_FOUND)
if (EXISTS ${SHARG_SUBMODULES_DIR}/submodules/tool_description_lib)
include (FetchContent)
FetchContent_Declare (tdl SOURCE_DIR ${SHARG_SUBMODULES_DIR}/submodules/tool_description_lib)
set (SHARG_LOG_LEVEL ${CMAKE_MESSAGE_LOG_LEVEL})
set (CMAKE_MESSAGE_LOG_LEVEL "ERROR")
option (INSTALL_TDL "Enable installation of TDL." ${INSTALL_SHARG})
FetchContent_MakeAvailable (tdl)
set (CMAKE_MESSAGE_LOG_LEVEL ${SHARG_LOG_LEVEL})
set (TDL_FOUND TRUE)
endif ()
endif ()

if (TDL_FOUND)
sharg_config_print ("Optional dependency: TDL found.")
Expand Down
4 changes: 2 additions & 2 deletions test/api_stability/1.1.1/0001-API-Update-TDL.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 27bc700234a23ea6c6c7337a427c4a3c6f2bbe55 Mon Sep 17 00:00:00 2001
From ace25c7fffccdac9ccaf81329ada87f60021b5f9 Mon Sep 17 00:00:00 2001
From: Simon Gene Gottlieb <[email protected]>
Date: Thu, 5 Oct 2023 13:43:30 +0200
Subject: [PATCH 1/3] [API] Update TDL
Subject: [PATCH 1/5] [API] Update TDL

---
test/unit/detail/format_ctd_test.cpp | 2 +-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 09a51343b1ee29f245eeae8210d50cd74ac9b1b4 Mon Sep 17 00:00:00 2001
From 7bf847b4991636a59f26ca89977e94f51edfbf11 Mon Sep 17 00:00:00 2001
From: Enrico Seiler <[email protected]>
Date: Mon, 5 Feb 2024 16:02:03 +0100
Subject: [PATCH 2/3] [API] Quoted strings and paths
Subject: [PATCH 2/5] [API] Quoted strings and paths

---
test/snippet/readme_sneak_peek.out | 6 ++---
Expand Down
4 changes: 2 additions & 2 deletions test/api_stability/1.1.1/0003-NOAPI-Update-copyright.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 859b9d015379e0d708700225fa55dd31f7d2e2f5 Mon Sep 17 00:00:00 2001
From f02ddb2f31a47da16742dbf612d780b328e7602b Mon Sep 17 00:00:00 2001
From: Enrico Seiler <[email protected]>
Date: Wed, 7 Feb 2024 13:31:22 +0100
Subject: [PATCH 3/3] [NOAPI] Update copyright
Subject: [PATCH 3/5] [NOAPI] Update copyright

---
test/unit/detail/format_help_test.cpp | 10 +++++-----
Expand Down
73 changes: 73 additions & 0 deletions test/api_stability/1.1.1/0004-INFRA-Update-TDL.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
From 9f040f8ccb8d304841d24d8ac4d67db0d06c370f Mon Sep 17 00:00:00 2001
From: Enrico Seiler <[email protected]>
Date: Fri, 9 Feb 2024 16:17:21 +0100
Subject: [PATCH 4/5] [INFRA] Update TDL

---
test/unit/detail/format_cwl_test.cpp | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/test/unit/detail/format_cwl_test.cpp b/test/unit/detail/format_cwl_test.cpp
index 1d27cc3..eaf0cad 100644
--- a/test/unit/detail/format_cwl_test.cpp
+++ b/test/unit/detail/format_cwl_test.cpp
@@ -76,8 +76,16 @@ TEST(format_cwl_test, full_information)
parser.info.examples.push_back("example2");

std::string expected_short = "label: default\n"
- "doc: \"description\\ndescription2\\n\"\n"
+ "doc: \"description\\n"
+ "description2\\n"
+ "\"\n"
"inputs:\n"
+ " positional_0:\n"
+ " doc: this is a positional option.\n"
+ " type: string?\n"
+ " positional_1:\n"
+ " doc: \"this is a positional option. Default: []\"\n"
+ " type: string?\n"
" int:\n"
" doc: \"this is a int option. Default: 5\"\n"
" type: long?\n"
@@ -88,6 +96,12 @@ TEST(format_cwl_test, full_information)
" type: long\n"
" inputBinding:\n"
" prefix: --jint\n"
+ " flag:\n"
+ " doc: this is a flag.\n"
+ " type: boolean?\n"
+ " kflag:\n"
+ " doc: this is a flag.\n"
+ " type: boolean?\n"
"outputs:\n"
" []\n"
"cwlVersion: v1.2\n"
@@ -196,6 +210,12 @@ TEST(format_cwl_test, subparser)
"label: default-index\n"
"doc: \"\"\n"
"inputs:\n"
+ " positional_0:\n"
+ " doc: this is a positional option.\n"
+ " type: string?\n"
+ " positional_1:\n"
+ " doc: \"this is a positional option. Default: []\"\n"
+ " type: string?\n"
" int:\n"
" doc: \"this is a int option. Default: 5\"\n"
" type: long?\n"
@@ -244,6 +264,12 @@ TEST(format_cwl_test, subparser)
" type: string?\n"
" inputBinding:\n"
" prefix: --path05\n"
+ " flag:\n"
+ " doc: this is a flag.\n"
+ " type: boolean?\n"
+ " kflag:\n"
+ " doc: this is a flag.\n"
+ " type: boolean?\n"
"outputs:\n"
" path04:\n"
" type: File?\n"
--
2.43.0

3 changes: 3 additions & 0 deletions test/api_stability/1.1.1/0004-INFRA-Update-TDL.patch.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
SPDX-License-Identifier: BSD-3-Clause
25 changes: 25 additions & 0 deletions test/api_stability/1.1.1/0005-INFRA-Use-seqan3-main-branch.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 3a7dfd8103806e97af6376e9173d686b67fb5b52 Mon Sep 17 00:00:00 2001
From: Enrico Seiler <[email protected]>
Date: Fri, 9 Feb 2024 18:13:36 +0100
Subject: [PATCH 5/5] [INFRA] Use seqan3 main branch

---
test/unit/detail/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/unit/detail/CMakeLists.txt b/test/unit/detail/CMakeLists.txt
index 392f878..1f9a8e0 100644
--- a/test/unit/detail/CMakeLists.txt
+++ b/test/unit/detail/CMakeLists.txt
@@ -23,7 +23,7 @@ sharg_test (type_name_as_string_test.cpp)
sharg_test (version_check_debug_test.cpp)
sharg_test (version_check_release_test.cpp)

-file (DOWNLOAD https://raw.githubusercontent.com/seqan/seqan3/master/include/seqan3/version.hpp
+file (DOWNLOAD https://raw.githubusercontent.com/seqan/seqan3/main/include/seqan3/version.hpp
${CMAKE_BINARY_DIR}/include/seqan3/version.hpp)
sharg_test (seqan3_test.cpp)
target_include_directories (seqan3_test SYSTEM PUBLIC ${CMAKE_BINARY_DIR}/include)
--
2.43.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
SPDX-License-Identifier: BSD-3-Clause
27 changes: 18 additions & 9 deletions test/external_project/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ ExternalProject_Add (
sharg_submodule_add_subdirectory
PREFIX sharg_submodule_add_subdirectory
SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/sharg_submodule_add_subdirectory"
CMAKE_ARGS ${SHARG_EXTERNAL_PROJECT_CMAKE_ARGS}
CMAKE_ARGS ${SHARG_EXTERNAL_PROJECT_CMAKE_ARGS} #
"-DCMAKE_FIND_DEBUG_MODE=${SHARG_EXTERNAL_PROJECT_FIND_DEBUG_MODE}" #
"-DSHARG_ROOT=${SHARG_ROOT}")
"-DSHARG_ROOT=${SHARG_ROOT}" #
"-DSHARG_NO_TDL=${SHARG_NO_TDL}")

# 2) This tests test/external_project/sharg_submodule_find_package/CMakeLists.txt
# We have a sharg checkout somewhere and we point CMAKE_PREFIX_PATH to <checkout>/sharg/build_system
Expand All @@ -37,8 +38,10 @@ ExternalProject_Add (
sharg_submodule_find_package
PREFIX sharg_submodule_find_package
SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/sharg_submodule_find_package"
CMAKE_ARGS ${SHARG_EXTERNAL_PROJECT_CMAKE_ARGS} "-DCMAKE_FIND_DEBUG_MODE=${SHARG_EXTERNAL_PROJECT_FIND_DEBUG_MODE}"
"-DCMAKE_PREFIX_PATH=${SHARG_ROOT}/build_system")
CMAKE_ARGS ${SHARG_EXTERNAL_PROJECT_CMAKE_ARGS} #
"-DCMAKE_FIND_DEBUG_MODE=${SHARG_EXTERNAL_PROJECT_FIND_DEBUG_MODE}" #
"-DCMAKE_PREFIX_PATH=${SHARG_ROOT}/build_system" #
"-DSHARG_NO_TDL=${SHARG_NO_TDL}")

# 3) This tests test/external_project/sharg_installed/CMakeLists.txt
# This test assumes that sharg was installed by make install (e.g. system-wide).
Expand All @@ -53,8 +56,10 @@ ExternalProject_Add (
sharg_installed
PREFIX sharg_installed
SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/sharg_installed"
CMAKE_ARGS ${SHARG_EXTERNAL_PROJECT_CMAKE_ARGS} "-DCMAKE_FIND_DEBUG_MODE=${SHARG_EXTERNAL_PROJECT_FIND_DEBUG_MODE}"
"-DCMAKE_SYSTEM_PREFIX_PATH=${SHARG_SYSTEM_PREFIX}")
CMAKE_ARGS ${SHARG_EXTERNAL_PROJECT_CMAKE_ARGS} #
"-DCMAKE_FIND_DEBUG_MODE=${SHARG_EXTERNAL_PROJECT_FIND_DEBUG_MODE}" #
"-DCMAKE_SYSTEM_PREFIX_PATH=${SHARG_SYSTEM_PREFIX}" #
"-DSHARG_NO_TDL=${SHARG_NO_TDL}")
add_dependencies (sharg_installed sharg_test_prerequisite)

# 4) This tests test/external_project/sharg_fetch_content_zip/CMakeLists.txt
Expand All @@ -68,8 +73,10 @@ ExternalProject_Add (
sharg_fetch_content_zip
PREFIX sharg_fetch_content_zip
SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/sharg_fetch_content_zip"
CMAKE_ARGS ${SHARG_EXTERNAL_PROJECT_CMAKE_ARGS} "-DCMAKE_FIND_DEBUG_MODE=${SHARG_EXTERNAL_PROJECT_FIND_DEBUG_MODE}"
"-DSHARG_PACKAGE_ZIP_URL=${SHARG_PACKAGE_ZIP_URL}")
CMAKE_ARGS ${SHARG_EXTERNAL_PROJECT_CMAKE_ARGS} #
"-DCMAKE_FIND_DEBUG_MODE=${SHARG_EXTERNAL_PROJECT_FIND_DEBUG_MODE}" #
"-DSHARG_PACKAGE_ZIP_URL=${SHARG_PACKAGE_ZIP_URL}" #
"-DSHARG_NO_TDL=${SHARG_NO_TDL}")
add_dependencies (sharg_fetch_content_zip sharg_test_prerequisite)

# 5) This test is the same as 2) but emulates the settings within the setup tutorial.
Expand All @@ -78,4 +85,6 @@ ExternalProject_Add (
sharg_setup_tutorial
PREFIX sharg_setup_tutorial
SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/sharg_setup_tutorial"
CMAKE_ARGS ${SHARG_EXTERNAL_PROJECT_CMAKE_ARGS} "-DCMAKE_FIND_DEBUG_MODE=${SHARG_EXTERNAL_PROJECT_FIND_DEBUG_MODE}")
CMAKE_ARGS ${SHARG_EXTERNAL_PROJECT_CMAKE_ARGS} #
"-DCMAKE_FIND_DEBUG_MODE=${SHARG_EXTERNAL_PROJECT_FIND_DEBUG_MODE}" #
"-DSHARG_NO_TDL=${SHARG_NO_TDL}")
1 change: 0 additions & 1 deletion test/snippet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ endmacro ()
macro (sharg_snippets test_name_prefix snippet_base_path_)
get_filename_component (snippet_base_path "${snippet_base_path_}" ABSOLUTE BASE_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/../..")
message (STATUS "${snippet_base_path}")
sharg_test_files (snippet_files "${snippet_base_path}" "*.cpp")
foreach (snippet ${snippet_files})
sharg_snippet ("${test_name_prefix}" "${snippet}" "${snippet_base_path}")
Expand Down
2 changes: 1 addition & 1 deletion test/unit/detail/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sharg_test (type_name_as_string_test.cpp)
sharg_test (version_check_debug_test.cpp)
sharg_test (version_check_release_test.cpp)

file (DOWNLOAD https://raw.githubusercontent.com/seqan/seqan3/master/include/seqan3/version.hpp
file (DOWNLOAD https://raw.githubusercontent.com/seqan/seqan3/main/include/seqan3/version.hpp
${CMAKE_BINARY_DIR}/include/seqan3/version.hpp)
sharg_test (seqan3_test.cpp)
target_include_directories (seqan3_test SYSTEM PUBLIC ${CMAKE_BINARY_DIR}/include)
28 changes: 27 additions & 1 deletion test/unit/detail/format_cwl_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,16 @@ TEST(format_cwl_test, full_information)
parser.info.examples.push_back("example2");

std::string expected_short = "label: default\n"
"doc: \"description\\ndescription2\\n\"\n"
"doc: \"description\\n"
"description2\\n"
"\"\n"
"inputs:\n"
" positional_0:\n"
" doc: this is a positional option.\n"
" type: string?\n"
" positional_1:\n"
" doc: \"this is a positional option. Default: []\"\n"
" type: string?\n"
" int:\n"
" doc: \"this is a int option. Default: 5\"\n"
" type: long?\n"
Expand All @@ -91,6 +99,12 @@ TEST(format_cwl_test, full_information)
" type: long\n"
" inputBinding:\n"
" prefix: --jint\n"
" flag:\n"
" doc: this is a flag.\n"
" type: boolean?\n"
" kflag:\n"
" doc: this is a flag.\n"
" type: boolean?\n"
"outputs:\n"
" []\n"
"cwlVersion: v1.2\n"
Expand Down Expand Up @@ -199,6 +213,12 @@ TEST(format_cwl_test, subparser)
"label: default-index\n"
"doc: \"\"\n"
"inputs:\n"
" positional_0:\n"
" doc: this is a positional option.\n"
" type: string?\n"
" positional_1:\n"
" doc: \"this is a positional option. Default: []\"\n"
" type: string?\n"
" int:\n"
" doc: \"this is a int option. Default: 5\"\n"
" type: long?\n"
Expand Down Expand Up @@ -247,6 +267,12 @@ TEST(format_cwl_test, subparser)
" type: string?\n"
" inputBinding:\n"
" prefix: --path05\n"
" flag:\n"
" doc: this is a flag.\n"
" type: boolean?\n"
" kflag:\n"
" doc: this is a flag.\n"
" type: boolean?\n"
"outputs:\n"
" path04:\n"
" type: File?\n"
Expand Down
4 changes: 4 additions & 0 deletions test/unit/detail/seqan3_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

#include <sharg/parser.hpp>

#if !__has_include(<seqan3/version.hpp>)
# error "seqan3/version.hpp is not available"
#endif

std::string const basic_options_str = " Common options\n"
" -h, --help\n"
" Prints the help page.\n"
Expand Down

0 comments on commit 0f91e17

Please sign in to comment.