From 75efbdb60bc90988a1f8cf38973a596d5b77fe13 Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Thu, 9 May 2024 13:41:48 +0200 Subject: [PATCH] updated CI-pipline to Github Actions --- .github/workflows/build_docs.yml | 70 ++++++++++++++++++ .github/workflows/build_linux.yml | 73 +++++++++++++++++++ .github/workflows/build_windows.yml | 70 ++++++++++++++++++ .github/workflows/msvc-codeanalysis.yml | 51 ++++++++++++++ .travis.yml | 94 ------------------------- CMakeLists.txt | 8 +-- appveyor.yml | 68 ------------------ ci/install_travis.sh | 37 ---------- ci/test_travis.sh | 11 --- 9 files changed, 268 insertions(+), 214 deletions(-) create mode 100644 .github/workflows/build_docs.yml create mode 100644 .github/workflows/build_linux.yml create mode 100644 .github/workflows/build_windows.yml create mode 100644 .github/workflows/msvc-codeanalysis.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml delete mode 100644 ci/install_travis.sh delete mode 100644 ci/test_travis.sh diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml new file mode 100644 index 0000000..466f589 --- /dev/null +++ b/.github/workflows/build_docs.yml @@ -0,0 +1,70 @@ +# This is a basic workflow to help you get started with Actions + +name: Doxygen build&deploy + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-20.04 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get update --fix-missing + sudo apt-get install -f + sudo apt -y install build-essential doxygen graphviz doxygen-latex libclang-common-10-dev libclang-10-dev fonts-freefont-ttf + doxygen -v + + - name: Update Doxygen to 1.9.8 + run: | + currDir=`pwd` + cd $GITHUB_WORKSPACE + mkdir doxygen + wget -O - https://github.com/doxygen/doxygen/releases/download/Release_1_9_8/doxygen-1.9.8.linux.bin.tar.gz | tar --strip-components=1 -xz -C doxygen + export PATH=$GITHUB_WORKSPACE/doxygen/bin:${PATH} + echo PATH=$PATH + cd $currDir + $GITHUB_WORKSPACE/doxygen/bin/doxygen --version + + - name: Run Doxygen + run: | + $GITHUB_WORKSPACE/doxygen/bin/doxygen --version + cd doc + pwd + ls + $GITHUB_WORKSPACE/doxygen/bin/doxygen + pwd + ls + ls -R + + - name: Create .nojekyll (ensures pages with underscores work on gh pages) + run: | + pwd + touch doc/html/.nojekyll + shell: bash + + - name: 🚀 Deploy to Github-Pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + #github_token: ${{ secrets.GH_PAGES_SECRET }} + ssh-key: ${{ secrets.TINYMAT_DEPLOY_KEY }} + branch: gh-pages + folder: doc/html + diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml new file mode 100644 index 0000000..4ea9936 --- /dev/null +++ b/.github/workflows/build_linux.yml @@ -0,0 +1,73 @@ +name: BUILD-LINUX-CI + +on: [push, pull_request] + +permissions: + checks: write + +jobs: + ci: + if: >- + ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && + ! contains(toJSON(github.event.commits.*.message), '[skip github]') + name: LINUX-CI + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - {gen: Unix Makefiles, shared: ON, ccompiler: gcc, cxxcompiler: g++} + - {gen: Unix Makefiles, shared: OFF, ccompiler: gcc, cxxcompiler: g++} + - {gen: Unix Makefiles, shared: ON, ccompiler: clang, cxxcompiler: clang++} + - {gen: Unix Makefiles, shared: OFF, ccompiler: clang, cxxcompiler: clang++} + steps: + - name: checkout + uses: actions/checkout@v4 + - name: Configure + run: | + mkdir install + cmake -G "${{matrix.gen}}" -DBUILD_SHARED_LIBS=${{matrix.shared}} "-DCMAKE_INSTALL_PREFIX=./install" -DCMAKE_CXX_COMPILER=${{matrix.cxxcompiler}} -DCMAKE_C_COMPILER=${{matrix.ccompiler}} -B build + - name: Build Release + run: | + cmake --build build --config Release --verbose + - name: Install Release + run: | + cmake --install build --config Release + cd install + ls -R + - name: Build Debug + run: | + cmake -G "${{matrix.gen}}" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=${{matrix.shared}} "-DTinyMAT_BUILD_EXAMPLES=OFF" -DCMAKE_CXX_COMPILER=${{matrix.cxxcompiler}} -DCMAKE_C_COMPILER=${{matrix.ccompiler}} -DCMAKE_CXX_FLAGS_DEBUG:STRING="-Wall" -DCMAKE_C_FLAGS_DEBUG:STRING="-Wall" -B build_debug + cmake --build build_debug --config Debug --verbose + - name: Test CMake-build against TinyMAT + run: | + cd examples + cd extcmake_tinymat_test + mkdir build + cd build + cmake -G "${{matrix.gen}}" "-DCMAKE_PREFIX_PATH=${{github.workspace}}/install/" -DCMAKE_CXX_COMPILER=${{matrix.cxxcompiler}} -DCMAKE_C_COMPILER=${{matrix.ccompiler}} -B . -S .. + cmake --build . --config Release --verbose +# - name: Test CMake-build against TinyMAT, using FetchContent-API +# if: success() || failure() # always run even if the previous step fails +# run: | +# cd examples +# cd extcmake_fetchcontent_tinytiff_test +# mkdir build +# cd build +# cmake -G "${{matrix.gen}}" -DCMAKE_CXX_COMPILER=${{matrix.cxxcompiler}} -DCMAKE_C_COMPILER=${{matrix.ccompiler}} -B . -S .. +# cmake --build . --config Release --verbose + +# - name: Run Release tests +# run: | +# cd install +# cd bin +# pwd +# ls +# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{github.workspace}}/install/lib/ +# ./tinytiffwriter_test --simple +# ./tinytiffreader_test --simple +# - name: Publish Test Report +# uses: mikepenz/action-junit-report@v4 +# if: success() || failure() # always run even if the previous step fails +# with: +# report_paths: '**/install/bin/*.xml' diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml new file mode 100644 index 0000000..8b71f4d --- /dev/null +++ b/.github/workflows/build_windows.yml @@ -0,0 +1,70 @@ +name: BUILD-MSVC-CI + +on: [push, pull_request] + +permissions: + checks: write + +jobs: + ci: + if: >- + ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && + ! contains(toJSON(github.event.commits.*.message), '[skip github]') + name: MSVC 2022 + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - {gen: Visual Studio 17 2022, arch: Win32, shared: ON} + - {gen: Visual Studio 17 2022, arch: Win32, shared: OFF} + - {gen: Visual Studio 17 2022, arch: x64, shared: ON} + - {gen: Visual Studio 17 2022, arch: x64, shared: OFF} + steps: + - name: checkout + uses: actions/checkout@v4 + - name: Configure + run: | + mkdir install + cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -DBUILD_SHARED_LIBS=${{matrix.shared}} "-DCMAKE_INSTALL_PREFIX=./install" -B build + - name: Build Release + run: | + cmake --build build --config Release --verbose + - name: Install Release + run: | + cmake --install build --config Release + cd install + ls -R + - name: Test CMake-build against TinyMAT + run: | + cd examples + cd extcmake_tinymat_test + mkdir build + cd build + pwd + echo ${{github.workspace}} + cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} "-DCMAKE_PREFIX_PATH=${{github.workspace}}/install/" -B . -S .. + cmake --build . --config Release --verbose +# - name: Test CMake-build against TinyMAT, using FetchContent-API +# if: success() || failure() # always run even if the previous step fails +# run: | +# cd examples +# cd extcmake_tinymat_test +# mkdir build +# cd build +# cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -B . -S .. +# cmake --build . --config Release --verbose + +# - name: Run Release tests +# run: | +# cd install +# cd bin +# pwd +# ls +# .\tinytiffwriter_test --simple +# .\tinytiffreader_test --simple +# - name: Publish Test Report +# uses: mikepenz/action-junit-report@v4 +# if: success() || failure() # always run even if the previous step fails +# with: +# report_paths: '**/install/bin/*.xml' diff --git a/.github/workflows/msvc-codeanalysis.yml b/.github/workflows/msvc-codeanalysis.yml new file mode 100644 index 0000000..e57b53b --- /dev/null +++ b/.github/workflows/msvc-codeanalysis.yml @@ -0,0 +1,51 @@ +name: "MSVC-CodeAnalysis" + +on: [push, pull_request] + + +env: + # Path to the CMake build directory. + build: '${{ github.workspace }}/build' + config: 'Debug' + +jobs: + analyze: + name: Analyze + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Configure CMake + run: cmake -B ${{ env.build }} -DCMAKE_BUILD_TYPE=${{ env.config }} "-DTinyMAT_BUILD_SHARED_LIBS:BOOL=OFF" "-DTinyMAT_BUILD_STATIC_LIBS:BOOL=ON" "-DBUILD_SHARED_LIBS:BOOL=ON" "-DTinyMAT_BUILD_EXAMPLES:BOOL=OFF" + + - name: Build CMake + run: cmake --build ${{ env.build }} --config ${{ env.config }} + + - name: Run MSVC Code Analysis + uses: microsoft/msvc-code-analysis-action@v0.1.1 + # Provide a unique ID to access the sarif output path + id: run-analysis + with: + cmakeBuildDirectory: ${{ env.build }} + buildConfiguration: ${{ env.config }} + # Ruleset file that will determine what checks will be run + ruleset: NativeRecommendedRules.ruleset + # Paths to ignore analysis of CMake targets and includes + # ignoredPaths: ${{ github.workspace }}/dependencies;${{ github.workspace }}/test + + # Upload SARIF file to GitHub Code Scanning Alerts + - name: Upload SARIF to GitHub + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: ${{ steps.run-analysis.outputs.sarif }} + + # Upload SARIF file as an Artifact to download and view + - name: Upload SARIF as an Artifact + uses: actions/upload-artifact@v2 + with: + name: sarif-file + path: ${{ steps.run-analysis.outputs.sarif }} + + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8f98fe4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,94 +0,0 @@ -language: cpp -sudo: false -compiler: - - gcc - - clang -os: - - linux - - osx -dist: focal -osx_image: xcode12.2 - -matrix: - exclude: - # Disable all automatic entries in the test matrix - - compiler: clang - - compiler: gcc - - os: osx - - os: linux - include: - # Explicitly add tests that we want to run - - env: BUILD_DOXYGEN="yes" - compiler: gcc - os: linux - addons: - apt: - packages: - - doxygen - - doxygen-doc - - doxygen-latex - - doxygen-gui - - graphviz - - clang-9 - - libclang-9-dev - - libclang-cpp9 - install: - - pwd - - doxygen --version - ############################################################################ - # All the dependencies are installed in ${TRAVIS_BUILD_DIR}/deps/ - ############################################################################ - - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" - - mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR} - ############################################################################ - # Install a recent Doxygen - ############################################################################ - - DOXYGEN_URL="http://doxygen.nl/files/doxygen-1.8.20.linux.bin.tar.gz" - - mkdir doxygen - - travis_retry wget -O - ${DOXYGEN_URL} | tar --strip-components=1 -xz -C doxygen - - export PATH=${DEPS_DIR}/doxygen/bin:${PATH} - - doxygen --version - script: - - pwd - - cd ${TRAVIS_BUILD_DIR} - - cd doc - - doxygen --version - - doxygen Doxyfile - - echo "" > html/.nojekyll - - compiler: clang - os: osx - - compiler: clang - os: linux - addons: - apt: - packages: - - libglu1-mesa-dev - - compiler: gcc - os: linux - addons: - apt: - packages: - - libglu1-mesa-dev - -install: - - source ci/install_travis.sh - -script: - - mkdir build - - cd build - - cmake -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DTinyMAT_QT5_SUPPORT=ON -DTinyMAT_BUILD_SHARED_LIBS=ON -DTinyMAT_BUILD_STATIC_LIBS=ON -DTinyMAT_OPENCV_SUPPORT=ON .. - - cmake --build . --target install - -notifications: - email: false - -deploy: - provider: pages - verbose: true - deployment_file: true - skip_cleanup: true - local_dir: doc/html - github_token: $GH_REPO_TOKEN - on: - branch: master - condition: $BUILD_DOXYGEN = yes diff --git a/CMakeLists.txt b/CMakeLists.txt index 2026e8d..c933381 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,12 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.10) ###################################################################################################### # Project Name and Version -project(libTinyMAT LANGUAGES CXX VERSION 2.1.0.0) +project(libTinyMAT LANGUAGES CXX VERSION 3.0.0.0) # set search path for CMake files list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake) -find_package(Qt5 COMPONENTS Core REQUIRED) -find_package(OpenCV) ###################################################################################################### # ensure a build-type is set (Release is default) @@ -20,9 +18,11 @@ if(NOT DEFINED TinyMAT_FILEBACKEND_USE_MEMORY_CACHE) option(TinyMAT_FILEBACKEND_USE_MEMORY_CACHE "Build with a file-backend, that caches the output in memory, before writing to disk (sets TINYMAT_WRITE_VIA_MEMORY when building)" ON) endif() if(NOT DEFINED TinyMAT_OPENCV_SUPPORT) + find_package(OpenCV) option(TinyMAT_OPENCV_SUPPORT "Build with Support for OpenCV" ${OpenCV_FOUND}) endif() if(NOT DEFINED TinyMAT_QT5_SUPPORT) + find_package(Qt5 COMPONENTS Core REQUIRED) option(TinyMAT_QT5_SUPPORT "Build with Support for Qt5" ${Qt5_FOUND}) endif() if(NOT DEFINED TinyMAT_BUILD_SHARED_LIBS) diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 9f2c79e..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,68 +0,0 @@ -version: 0.{build}-{branch} - -image: - - Visual Studio 2017 - -environment: - global: - QTVER: 5.11 - JOMDIR: C:\Qt\Tools\QtCreator\bin - MINGWDIR: C:\Qt\Tools\mingw530_32 - VSVER: 0 - - matrix: - - QTABI: mingw53_32 - ARCH: x86 - MAKETOOL: mingw32-make - CMAKE_GENERATOR: "MinGW Makefiles" - MSBUILD_FLAGS: - - QTABI: msvc2017_64 - ARCH: x64 - VSVER: 2017 - CMAKE_GENERATOR: "Visual Studio 15 2017 Win64" - MSBUILD_FLAGS: /verbosity:minimal /maxcpucount - - QTABI: msvc2015 - ARCH: x86 - VSVER: 14 - CMAKE_GENERATOR: "Visual Studio 15 2017" - MSBUILD_FLAGS: /verbosity:minimal /maxcpucount - -skip_tags: true - -build: - parallel: true - verbosity: detailed - -configuration: - - release -# - debug - - -install: - - IF %VSVER% GTR 14 ( - call "C:\Program Files (x86)\Microsoft Visual Studio\%VSVER%\Community\VC\Auxiliary\Build\vcvarsall.bat" %ARCH% - ) ELSE ( - IF %VSVER% GTR 0 ( - call "C:\Program Files (x86)\Microsoft Visual Studio "%VSVER%".0\VC\vcvarsall.bat" %ARCH% - ) ELSE ( - set "PATH=%MINGWDIR%\bin;%PATH%" - ) - ) - - set PATH=C:\Qt\%QTVER%\%QTABI%\bin;%JOMDIR%;%PATH% - - echo "BUILD ID Qt%QTVER%_%QTABI%_%APPVEYOR_BUILD_VERSION%_%CONFIGURATION%" - # Rename sh.exe as sh.exe in PATH interferes with MinGW - - rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe" - - cmd: choco install OpenCV - - cmd: set OPENCV_DIR=C:\tools\opencv\build - - -build_script: - - mkdir build - - cd build - - if "%CONFIGURATION%"=="release" (set CMAKE_CONFIGURATION=Release) else (set CMAKE_CONFIGURATION=Debug) - - if "%QTABI%"=="msvc2017_64" (set OPENCV_USAGE=ON) else (set OPENCV_USAGE=OFF) - - echo "Call CMake..." - - cmake --version - - cmake -G "%CMAKE_GENERATOR%" "-DCMAKE_PREFIX_PATH=%QT5%" -DOpenCV_DIR=%OPENCV_DIR% -DTinyMAT_QT5_SUPPORT=ON -DTinyMAT_OPENCV_SUPPORT=%OPENCV_USAGE% -DTinyMAT_BUILD_SHARED_LIBS=ON -DTinyMAT_BUILD_STATIC_LIBS=ON .. - - echo "Build..." - - cmake --build . --config "%CMAKE_CONFIGURATION%" -- %MSBUILD_FLAGS% diff --git a/ci/install_travis.sh b/ci/install_travis.sh deleted file mode 100644 index 7167c33..0000000 --- a/ci/install_travis.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -# Exit on error -set -e -# Echo each command -set -x - -export SOURCE_DIR=`pwd` -export our_install_dir="$HOME/our_usr" - -if [[ ! -d $HOME/conda_root/pkgs ]]; then - rm -rf $HOME/conda_root - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then - wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh - else - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh - fi - bash miniconda.sh -b -p $HOME/conda_root -fi -export PATH="$HOME/conda_root/bin:$PATH" -conda config --set always_yes yes --set changeps1 no -conda config --add channels conda-forge --force -# Useful for debugging any issues with conda -conda info -a - -conda_pkgs="qt cmake opencv" - -conda create -q -p $our_install_dir ${conda_pkgs} - -# Since this script is getting sourced, remove error on exit -set +e -set +x - -source activate $our_install_dir - -cd $SOURCE_DIR; - diff --git a/ci/test_travis.sh b/ci/test_travis.sh deleted file mode 100644 index 4583b01..0000000 --- a/ci/test_travis.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -# Exit on error -set -e -# Echo each command -set -x - -mkdir build -cd build -cmake -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DTinyMAT_QT5_SUPPORT=ON -DTinyMAT_BUILD_SHARED_LIBS=ON -DTinyMAT_BUILD_STATIC_LIBS=ON -DTinyMAT_OPENCV_SUPPORT=ON .. -cmake --build . --target install