Skip to content

Commit

Permalink
Cleanup scripts and fix signing (#606)
Browse files Browse the repository at this point in the history
IB-8144

Signed-off-by: Raul Metsma <raul@metsma.ee>
  • Loading branch information
metsma authored Jul 17, 2024
1 parent 2b5db85 commit c43bd94
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 103 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ permissions:
env:
BUILD_NUMBER: ${{ github.run_number }}
CMAKE_BUILD_PARALLEL_LEVEL: 4
UBUNTU_DEPS: cmake xsdcxx libxml-security-c-dev libxml2-dev zlib1g-dev
jobs:
macos:
name: Build on macOS for ${{ matrix.target }}
Expand Down Expand Up @@ -119,7 +120,7 @@ jobs:
DEBEMAIL: github-actions@github.com
steps:
- name: Install dependencies
run: apt update -qq && apt install --no-install-recommends -y git lsb-release build-essential devscripts debhelper cmake xsdcxx libxml-security-c-dev libxml2-dev zlib1g-dev doxygen swig openjdk-11-jdk-headless libpython3-dev python3-setuptools libboost-test-dev lintian
run: apt update -qq && apt install --no-install-recommends -y git lsb-release build-essential devscripts debhelper ${UBUNTU_DEPS} doxygen swig openjdk-11-jdk-headless libpython3-dev python3-setuptools libboost-test-dev lintian
- name: Checkout
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -210,7 +211,7 @@ jobs:
with:
submodules: recursive
- name: Install dependencies
run: sudo apt update -qq && sudo apt install --no-install-recommends -y cmake xsdcxx libxml-security-c-dev libxml2-dev zlib1g-dev doxygen
run: sudo apt update -qq && sudo apt install --no-install-recommends -y doxygen ${UBUNTU_DEPS}
- name: Build docs
run: |
cmake -B build -S .
Expand All @@ -234,7 +235,7 @@ jobs:
with:
submodules: recursive
- name: Install dependencies
run: sudo apt update -qq && sudo apt install --no-install-recommends -y cmake xsdcxx libxml-security-c-dev libxml2-dev zlib1g-dev curl ca-certificates
run: sudo apt update -qq && sudo apt install --no-install-recommends -y curl ca-certificates ${UBUNTU_DEPS}
- name: Download Coverity Build Tool
run: |
curl --silent --data "token=$TOKEN&project=$PROJECTNAME" -o cov-analysis-linux64.tar.gz https://scan.coverity.com/download/cxx/linux64
Expand Down Expand Up @@ -268,7 +269,7 @@ jobs:
with:
submodules: recursive
- name: Install dependencies
run: sudo apt update -qq && sudo apt install --no-install-recommends -y cmake xsdcxx libxml-security-c-dev libxml2-dev zlib1g-dev curl ca-certificates
run: sudo apt update -qq && sudo apt install --no-install-recommends -y ${UBUNTU_DEPS}
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
Expand Down
18 changes: 12 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ if(APPLE)
set(FRAMEWORK_DESTINATION /Library/Frameworks CACHE PATH "Mac OS X Framework install destination")
endif()

find_package(Doxygen)
find_package(OpenSSL 1.1.1 REQUIRED)
find_package(PKCS11)
#find_package(PoDoFo)
Expand All @@ -52,16 +51,19 @@ find_package(LibXml2 REQUIRED)
find_package(XmlSecurityC REQUIRED)
find_package(XSD 4.0 REQUIRED)
find_package(ZLIB REQUIRED)
find_package(MiniZip 1 QUIET) # version range (0...<2.0.0) requires CMake>=3.19
find_package(MiniZip 1 QUIET)
if(UNIX AND NOT APPLE)
find_package(PkgConfig)
pkg_check_modules(MINIZIP minizip IMPORTED_TARGET)
endif()
find_package(SWIG)
find_package(JNI)
find_package(Python3 COMPONENTS Interpreter Development)
if(SWIG_FOUND)
find_package(JNI)
find_package(Python3 COMPONENTS Interpreter Development)
endif()

if( DOXYGEN_FOUND )
find_package(Doxygen)
if(TARGET Doxygen::doxygen)
configure_file( ${CMAKE_SOURCE_DIR}/etc/Doxyfile.in Doxyfile @ONLY )
add_custom_target( docs ALL
Doxygen::doxygen Doxyfile
Expand All @@ -78,5 +80,9 @@ endif()

enable_testing()
add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(examples)

find_package( Boost COMPONENTS unit_test_framework )
if(TARGET Boost::unit_test_framework)
add_subdirectory(test)
endif()
10 changes: 5 additions & 5 deletions build-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ case "$@" in
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-DANDROID_PLATFORM=30 \
-DANDROID_ABI=${ARCH} \
-DBoost_INCLUDE_DIR=NOTFOUND \
-DDOXYGEN_EXECUTABLE=NOTFOUND \
-DCMAKE_DISABLE_FIND_PACKAGE_Boost=YES \
-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=YES \
-DBUILD_TOOLS=NO \
-DBUILD_SHARED_LIBS=NO"
;;
Expand Down Expand Up @@ -72,9 +72,9 @@ case "$@" in
TARGET_PATH=/Library/libdigidocpp.${TARGET}
CMAKEARGS="${CMAKEARGS} \
-DCMAKE_OSX_DEPLOYMENT_TARGET=${IPHONEOS_DEPLOYMENT_TARGET} \
-DSWIG_EXECUTABLE=NOTFOUND \
-DBoost_INCLUDE_DIR=NOTFOUND \
-DDOXYGEN_EXECUTABLE=NOTFOUND \
-DCMAKE_DISABLE_FIND_PACKAGE_SWIG=YES \
-DCMAKE_DISABLE_FIND_PACKAGE_Boost=YES \
-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=YES \
-DFRAMEWORK_DESTINATION=${TARGET_PATH}/lib
-DBUILD_TOOLS=NO"
;;
Expand Down
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ foreach($type in @("Debug", "RelWithDebInfo")) {
$libdigidocpp\libdigidocpp.wxs

if($sign) {
signtool.exe sign /a /v /s MY /n "$sign" /fd SHA256 /du http://installer.id.ee `
& $vcvars $platform "&&" signtool.exe sign /a /v /s MY /n "$sign" /fd SHA256 /du http://installer.id.ee `
/tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td SHA256 "$msi_name"
}
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Build-Depends:
libxml2-dev,
doxygen,
swig,
java8-sdk-headless,
java11-sdk-headless,
libpython3-dev,
python3-setuptools
Standards-Version: 4.5.1
Expand Down
168 changes: 82 additions & 86 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,87 +1,83 @@
find_package( Boost COMPONENTS unit_test_framework )
if( Boost_INCLUDE_DIR )
set_env(RUN_TESTS "" CACHE STRING "Run tests on build")
set_env(TEST_FORMAT XML CACHE STRING "Test result format (XML/JUNIT)")
set( CMAKE_SKIP_RPATH OFF )
include_directories(${Boost_INCLUDE_DIR})
add_definitions(
-DDIGIDOCPPCONF="${CMAKE_SOURCE_DIR}/etc/schema"
-DPKCS11_MODULE="${PKCS11_MODULE}"
-DSIVA_URL="${SIVA_URL}"
)
add_executable(unittests libdigidocpp_boost.cpp)
add_executable(TSLTests TSLTests.cpp)
target_link_libraries(unittests digidocpp digidocpp_priv)
target_link_libraries(TSLTests digidocpp digidocpp_util)
if(WIN32)
string(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
set_target_properties(unittests TSLTests PROPERTIES COMPILE_FLAGS "/bigobj")
else()
set_target_properties(unittests TSLTests PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter -Wno-unused-variable")
endif()
add_test(NAME runtest
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/unittests --build_info=YES --report_level=no --logger=${TEST_FORMAT},all,${CMAKE_CURRENT_BINARY_DIR}/libdigidocpp.xml -- ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_CA-invalid-type
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-CA-invalid-type.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_CA-non-qa
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-CA-non-qa.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_CA-withdrawn
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-CA-withdrawn.xml good ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_CA-withdrawn-granted-before
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-CA-withdrawn-granted-before.xml good ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_CA-withdrawn-granted-after
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-CA-withdrawn-granted-after.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_OCSP-invalid-type
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-OCSP-invalid-type.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_OCSP-withdrawn
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-OCSP-withdrawn.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_OCSP-withdrawn-granted-before
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-OCSP-withdrawn-granted-before.xml good ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_OCSP-withdrawn-granted-after
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-OCSP-withdrawn-granted-after.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_TSA-invalid-type
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-TSA-invalid-type.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_TSA-withdrawn
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-TSA-withdrawn.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_TSA-withdrawn-granted-before
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-TSA-withdrawn-granted-before.xml good ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_TSA-withdrawn-granted-after
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-TSA-withdrawn-granted-after.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_EE_T-no_QCStatement
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-no_QCStatement.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_EE_T-no_QCSD
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-no_QCSD.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS unittests TSLTests)
set_env(RUN_TESTS "" CACHE STRING "Run tests on build")
set_env(TEST_FORMAT XML CACHE STRING "Test result format (XML/JUNIT)")
set( CMAKE_SKIP_RPATH OFF )
add_definitions(
-DDIGIDOCPPCONF="${CMAKE_SOURCE_DIR}/etc/schema"
-DPKCS11_MODULE="${PKCS11_MODULE}"
-DSIVA_URL="${SIVA_URL}"
)
add_executable(unittests libdigidocpp_boost.cpp)
add_executable(TSLTests TSLTests.cpp)
target_link_libraries(unittests digidocpp digidocpp_priv Boost::unit_test_framework)
target_link_libraries(TSLTests digidocpp digidocpp_util Boost::unit_test_framework)
if(WIN32)
string(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
set_target_properties(unittests TSLTests PROPERTIES COMPILE_FLAGS "/bigobj")
else()
set_target_properties(unittests TSLTests PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter -Wno-unused-variable")
endif()
add_test(NAME runtest
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/unittests --build_info=YES --report_level=no --logger=${TEST_FORMAT},all,${CMAKE_CURRENT_BINARY_DIR}/libdigidocpp.xml -- ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_CA-invalid-type
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-CA-invalid-type.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_CA-non-qa
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-CA-non-qa.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_CA-withdrawn
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-CA-withdrawn.xml good ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_CA-withdrawn-granted-before
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-CA-withdrawn-granted-before.xml good ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_CA-withdrawn-granted-after
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-CA-withdrawn-granted-after.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_OCSP-invalid-type
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-OCSP-invalid-type.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_OCSP-withdrawn
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-OCSP-withdrawn.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_OCSP-withdrawn-granted-before
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-OCSP-withdrawn-granted-before.xml good ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_OCSP-withdrawn-granted-after
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-OCSP-withdrawn-granted-after.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_TSA-invalid-type
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-TSA-invalid-type.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_TSA-withdrawn
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-TSA-withdrawn.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_TSA-withdrawn-granted-before
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-TSA-withdrawn-granted-before.xml good ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_TSA-withdrawn-granted-after
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-TSA-withdrawn-granted-after.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_EE_T-no_QCStatement
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-no_QCStatement.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_test(NAME TSLTest_EE_T-no_QCSD
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TSLTests -- EE_T-no_QCSD.xml bad ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS unittests TSLTests)

0 comments on commit c43bd94

Please sign in to comment.