From 653814afb0f67f23b7ee2a34409e9f1ae6232631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Wed, 6 Jun 2018 23:40:34 +0200 Subject: [PATCH 1/5] [testsuite] Allow setting the binary location for make tests --- CMakeLists.txt | 2 +- ci/test_build.py | 2 +- test/functions.source | 6 +++++- tests/suite.conf | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a56d534..dd3d4e73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,7 +124,7 @@ endif() ## # tests -add_custom_target(tests COMMAND env EXIV2_BINDIR="${CMAKE_BINARY_DIR}"/bin make tests WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" ) +add_custom_target(tests COMMAND env EXIV2_BUILDDIR="${CMAKE_BINARY_DIR}" make tests WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" ) include( config/printSummary.cmake ) diff --git a/ci/test_build.py b/ci/test_build.py index 28b67e00..62a25496 100644 --- a/ci/test_build.py +++ b/ci/test_build.py @@ -68,7 +68,7 @@ for params in itertools.product(SHARED_LIBS, CCS, BUILD_TYPES): env_copy["CCACHE_DIR"] = os.path.join(root_dir, "ccache") # location of the binaries for the new test suite: - env_copy["EXIV2_PATH"] = os.path.join(cwd, "bin") + env_copy["EXIV2_BINDIR"] = os.path.join(cwd, "bin") kwargs = {"env": env_copy, "cwd": cwd} diff --git a/test/functions.source b/test/functions.source index 0b0f10d6..bb89d53a 100644 --- a/test/functions.source +++ b/test/functions.source @@ -442,7 +442,11 @@ prepareTest() datadir="../data" if [ -z "$EXIV2_BINDIR" ] ; then - bin="$here/../bin/" + if [ -z "$EXIV2_BUILDDIR" ]; then + bin="$EXIV2_BUILDDIR/bin/" + else + bin="$here/../build/bin/" + fi else bin="$EXIV2_BINDIR/" fi diff --git a/tests/suite.conf b/tests/suite.conf index 38bff7f2..16dc9d67 100644 --- a/tests/suite.conf +++ b/tests/suite.conf @@ -2,7 +2,7 @@ timeout: 1 [ENV] -exiv2_path: EXIV2_PATH +exiv2_path: EXIV2_BINDIR binary_extension: EXIV2_EXT [ENV fallback] From 7d1d10c338b4af920e26d359a23a597e06da80a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Wed, 6 Jun 2018 23:42:15 +0200 Subject: [PATCH 2/5] [CI] Add installation test to GitLab CI --- .gitlab-ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5594ab37..5f4bbe08 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,6 +15,10 @@ paths: - ccache/ +stages: + - test + - deploy + Fedora: image: fedora:28 <<: *distro_build @@ -38,3 +42,16 @@ CentOS: OpenSUSE: image: opensuse:tumbleweed <<: *distro_build + +Install: + image: fedora:28 + stage: deploy + before_script: + - ci/install_dependencies.sh + script: + - mkdir build && cd build + - cmake -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=/usr/ -DBUILD_WITH_CCACHE=ON .. + - make -j $(nproc) + - make install + - make clean + - EXIV2_BINDIR=/usr/bin/ make tests From 7ac40ba0b2222d4ae223fd8c670c054e6af6b61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Thu, 7 Jun 2018 00:12:06 +0200 Subject: [PATCH 3/5] [CI] Move CCache config out of python build script --- .gitlab-ci.yml | 38 ++++++++++++++++++++++++++++---------- ci/test_build.py | 6 +----- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5f4bbe08..984bdb86 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,19 +1,32 @@ -# default build for all distros -# only create artifacts of the build directory when something fails (for cmake logs) -# cache the ccache/ directory for each job separately -.build_template: &distro_build +# all builds use the same ccache folder in the project root that is cached +variables: + CCACHE_BASEDIR: '$CI_PROJECT_DIR' + CCACHE_DIR: '$CI_PROJECT_DIR/ccache' + +# default config for all distros: +# - install dependencies via script +# - create ccache dir & setup caching of it (for each job separately) +.build_config: &default_config before_script: - ci/install_dependencies.sh + - mkdir -p ccache + cache: + key: "$CI_JOB_NAME" + paths: + - ccache/ + +# default build job: +# - run build script +# - only create artifacts of the build directory when something fails +# (for cmake logs) +.build_template: &distro_build script: - python3 ci/test_build.py artifacts: when: on_failure paths: - build/ - cache: - key: "$CI_JOB_NAME" - paths: - - ccache/ + stages: - test @@ -21,33 +34,38 @@ stages: Fedora: image: fedora:28 + <<: *default_config <<: *distro_build Debian: image: debian:9 + <<: *default_config <<: *distro_build Archlinux: image: base/archlinux + <<: *default_config <<: *distro_build Ubuntu: image: ubuntu:18.04 + <<: *default_config <<: *distro_build CentOS: image: centos:7 + <<: *default_config <<: *distro_build OpenSUSE: image: opensuse:tumbleweed + <<: *default_config <<: *distro_build Install: image: fedora:28 stage: deploy - before_script: - - ci/install_dependencies.sh + <<: *default_config script: - mkdir build && cd build - cmake -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=/usr/ -DBUILD_WITH_CCACHE=ON .. diff --git a/ci/test_build.py b/ci/test_build.py index 62a25496..73bb5d2c 100644 --- a/ci/test_build.py +++ b/ci/test_build.py @@ -37,10 +37,8 @@ def call_wrapper(*args, **kwargs): sys.exit(return_code) -# create build & ccache directory (ccache could already exist in the CI's cache) +# create build directory os.mkdir("build") -if not os.path.exists('ccache'): - os.mkdir("ccache") root_dir = os.path.abspath(os.getcwd()) @@ -64,8 +62,6 @@ for params in itertools.product(SHARED_LIBS, CCS, BUILD_TYPES): env_copy = os.environ.copy() env_copy["CC"] = cc env_copy["CXX"] = cxx - env_copy["CCACHE_BASEDIR"] = root_dir - env_copy["CCACHE_DIR"] = os.path.join(root_dir, "ccache") # location of the binaries for the new test suite: env_copy["EXIV2_BINDIR"] = os.path.join(cwd, "bin") From b8a9423c5a078715dfa013c7bcf510205c709e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Thu, 7 Jun 2018 00:29:47 +0200 Subject: [PATCH 4/5] [CI] Deploy documentation to GitLab pages --- .gitlab-ci.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 984bdb86..e801322d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,7 +27,6 @@ variables: paths: - build/ - stages: - test - deploy @@ -73,3 +72,20 @@ Install: - make install - make clean - EXIV2_BINDIR=/usr/bin/ make tests + +pages: + image: fedora:28 + stage: deploy + <<: *default_config + script: + - dnf -y install doxygen graphviz + - mkdir build && cd build + - cmake -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_DOC=ON .. + - make doc + - cd .. + - mv build/doc/html/ public/ + artifacts: + paths: + - public + only: + - master From de2e260d0c299d5376d60fd2994916c08f5777ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Thu, 7 Jun 2018 11:24:07 +0200 Subject: [PATCH 5/5] Fix doxygen documentation generation The tagfile location in the Doxyfile was wrong and would point to a non-existent location, causing make doc to fail. --- config/Doxyfile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/Doxyfile.in b/config/Doxyfile.in index 94b06724..2a5bb736 100644 --- a/config/Doxyfile.in +++ b/config/Doxyfile.in @@ -1596,7 +1596,7 @@ TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. -GENERATE_TAGFILE = html/exiv2.xml +GENERATE_TAGFILE = doc/html/exiv2.xml # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes