diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index f0d98937a5..6278d1aba7 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -1,87 +1,94 @@ -name: checks +name: Checks on: + push: pull_request: types: [opened, synchronize] branches: - master - dev - - - - + jobs: linux-clang-build: - runs-on: ubuntu-latest env: - CFLAGS: -Werror QT_SELECT: qt5 + SCCACHE_GHA_ENABLED: "true" + SCCACHE_CACHE_SIZE: "2G" steps: - uses: actions/checkout@v1 + with: + submodules: true - name: install dependencies run: | sudo apt-get update - sudo apt-get install clang libqt5opengl5-dev libqt5svg5-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev + sudo apt-get install clang libqt5opengl5-dev libqt5svg5-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.3 + - name: configure - run: ./configure -assert || { cat configure.log; false; } + run: cmake --preset ci-release-checks -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ . - name: build - run: ./build -nowarnings -persistent -nopaginate || { cat build.log; false; } + run: cmake --build ../mrtrix3-build-ci-release-checks - name: unit tests - run: ./run_tests units || { cat testing_units.log; false; } + run: ctest -R unit --test-dir ../mrtrix3-build-ci-release-checks - name: binary tests - run: ./run_tests binaries || { cat testing_binaries.log; false; } - - - - - + run: ctest -R bin --test-dir ../mrtrix3-build-ci-release-checks linux-gcc-build: runs-on: ubuntu-latest env: - CXX: g++-9 - CFLAGS: -Werror QT_SELECT: qt5 + SCCACHE_GHA_ENABLED: "true" + SCCACHE_CACHE_SIZE: "2G" steps: - uses: actions/checkout@v1 + with: + submodules: true - name: install dependencies run: | sudo apt-get update - sudo apt-get install g++-9 libqt5opengl5-dev libqt5svg5-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev + sudo apt-get install g++-9 libqt5opengl5-dev libqt5svg5-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.3 + - name: configure - run: ./configure -nooptim || { cat configure.log; false; } + run: cmake --preset ci-release-checks - name: build - run: ./build -nowarnings -persistent -nopaginate || { cat build.log; false; } - - - + run: cmake --build ../mrtrix3-build-ci-release-checks + - name: unit tests + run: ctest -R unit --test-dir ../mrtrix3-build-ci-release-checks + - name: binary tests + run: ctest -R bin --test-dir ../mrtrix3-build-ci-release-checks macos-build: runs-on: macos-latest env: - CFLAGS: -Werror - PACKAGES: "qt5 eigen pkg-config fftw libpng" + PACKAGES: "qt5 eigen pkg-config fftw libpng ninja cmake" + SCCACHE_GHA_ENABLED: "true" + SCCACHE_CACHE_SIZE: "2G" steps: - uses: actions/checkout@v1 + with: + submodules: true - name: install dependencies run: | @@ -89,68 +96,84 @@ jobs: brew install $PACKAGES || brew install $PACKAGES brew link --force qt5 + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.3 + - name: configure - run: ./configure -assert || { cat configure.log; false; } + run: | + export PATH=/usr/local/opt/qt5/bin:$PATH + cmake --preset ci-release-checks - name: build - run: ./build -nowarnings -persistent -nopaginate || { cat build.log; false; } + run: cmake --build ../mrtrix3-build-ci-release-checks - name: unit tests - run: ./run_tests units || { cat testing_units.log; false; } + run: ctest -R unit --test-dir ../mrtrix3-build-ci-release-checks - name: binary tests - run: ./run_tests binaries || { cat testing_binaries.log; false; } - - - name: check command documentation - run: ./docs/generate_user_docs.sh && git diff --exit-code docs/ - - - - + run: ctest -R bin --test-dir ../mrtrix3-build-ci-release-checks windows-build: runs-on: windows-latest + defaults: + run: + shell: msys2 {0} env: - CFLAGS: -Werror - MSYSTEM: MINGW64 - MSYSCON: defterm + # CFLAGS: -Werror CHERE_INVOKING: enabled_from_arguments - MSYS2_NOSTART: yes + MINGW_PACKAGE_PREFIX: mingw-w64-ucrt-x86_64 + SCCACHE_GHA_ENABLED: "true" + SCCACHE_CACHE_SIZE: "2G" + SCCACHE_DIR: ${{ github.workspace }}/.sccache steps: - - - uses: actions/checkout@v1 - - - name: fetch and install MSYS2 - run: bash -c 'curl -sL https://github.com/MRtrix3/MinGW/releases/download/1.0/msys2.tar.{0,1} | tar xf -' - - - name: run qtbinpatcher - shell: cmd - run: msys64\msys2_shell.cmd -c "qtbinpatcher --qt-dir=$(dirname $(which qmake))" - - - name: configure - shell: cmd - run: msys64\msys2_shell.cmd -c "./configure -assert || { cat configure.log; false; }" - - - name: build - shell: cmd - run: msys64\msys2_shell.cmd -c "./build -nowarnings -persistent -nopaginate || { cat build.log; false; }" - - - name: unit tests - shell: cmd - run: msys64\msys2_shell.cmd -c "./run_tests units || { cat testing_units.log; false; }" - - - name: binary tests - shell: cmd - run: msys64\msys2_shell.cmd -c "./run_tests binaries || { cat testing_binaries.log; false; }" - - - + - uses: actions/checkout@v1 + with: + submodules: true + + - uses: msys2/setup-msys2@v2 + with: + msystem: UCRT64 + release: false + install: | + git + python + ${{env.MINGW_PACKAGE_PREFIX}}-bc + ${{env.MINGW_PACKAGE_PREFIX}}-cmake + ${{env.MINGW_PACKAGE_PREFIX}}-diffutils + ${{env.MINGW_PACKAGE_PREFIX}}-eigen3 + ${{env.MINGW_PACKAGE_PREFIX}}-fftw + ${{env.MINGW_PACKAGE_PREFIX}}-gcc + ${{env.MINGW_PACKAGE_PREFIX}}-libtiff + ${{env.MINGW_PACKAGE_PREFIX}}-ninja + ${{env.MINGW_PACKAGE_PREFIX}}-pkg-config + ${{env.MINGW_PACKAGE_PREFIX}}-qt5-base + ${{env.MINGW_PACKAGE_PREFIX}}-qt5-svg + ${{env.MINGW_PACKAGE_PREFIX}}-zlib + + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.3 + + - name: export sccache to msys2 shell + run: | + export SCCACHE_UNIX_PATH=$(cygpath -u "$SCCACHE_PATH") + echo "SCCACHE_UNIX_PATH=$SCCACHE_UNIX_PATH" >> $GITHUB_ENV + + - name: configure + run: cmake --preset ci-release-checks -DCMAKE_CXX_COMPILER_LAUNCHER=${{env.SCCACHE_UNIX_PATH}} . + + - name: build + run: cmake --build ../mrtrix3-build-ci-release-checks + + - name: unit tests + run: ctest -R unit --test-dir ../mrtrix3-build-ci-release-checks + + - name: binary tests + run: ctest -R bin --test-dir ../mrtrix3-build-ci-release-checks secondary-checks: - runs-on: ubuntu-latest env: @@ -158,22 +181,22 @@ jobs: steps: - uses: actions/checkout@v1 - + - name: install dependencies run: | - sudo apt-get update - sudo apt-get install pylint python3-sphinx sphinx-rtd-theme-common python3-recommonmark python3-sphinx-rtd-theme python3-pip python3-sphinx-notfound-page + sudo apt-get update + sudo apt-get install pylint python3-sphinx sphinx-rtd-theme-common python3-recommonmark python3-sphinx-rtd-theme python3-pip python3-sphinx-notfound-page - name: check syntax run: ./check_syntax || { cat syntax.log; false; } - name: pylint run: | - echo "__version__ = 'pylint testing' #pylint: disable=unused-variable" > ./lib/mrtrix3/_version.py + echo "__version__ = 'pylint testing' #pylint: disable=unused-variable" > ./python/lib/mrtrix3/_version.py ./run_pylint || { cat pylint.log; false; } - name: check copyright headers run: ./update_copyright && git diff --exit-code - name: check building of documentation - run: python3 -m sphinx -n -N -W -w sphinx.log docs/ tmp/ + run: python3 -m sphinx -n -N -W -w sphinx.log docs/ tmp/ \ No newline at end of file diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml deleted file mode 100644 index 2bf33189ce..0000000000 --- a/.github/workflows/cmake.yml +++ /dev/null @@ -1,197 +0,0 @@ -name: CMake checks - -on: - push: - -jobs: - linux-clang-build: - runs-on: ubuntu-latest - - env: - QT_SELECT: qt5 - SCCACHE_GHA_ENABLED: "true" - SCCACHE_CACHE_SIZE: "2G" - - steps: - - uses: actions/checkout@v1 - with: - submodules: true - - - name: install dependencies - run: | - sudo apt-get update - sudo apt-get install clang libqt5opengl5-dev libqt5svg5-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build - - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.3 - - - name: configure - run: cmake --preset ci-release-checks -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ . - - - name: build - run: cmake --build ../mrtrix3-build-ci-release-checks - - - name: unit tests - run: ctest -R unit --test-dir ../mrtrix3-build-ci-release-checks - - - name: binary tests - run: ctest -R bin --test-dir ../mrtrix3-build-ci-release-checks - - linux-gcc-build: - - runs-on: ubuntu-latest - - env: - QT_SELECT: qt5 - SCCACHE_GHA_ENABLED: "true" - SCCACHE_CACHE_SIZE: "2G" - - steps: - - uses: actions/checkout@v1 - with: - submodules: true - - - name: install dependencies - run: | - sudo apt-get update - sudo apt-get install g++-9 libqt5opengl5-dev libqt5svg5-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build - - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.3 - - - name: configure - run: cmake --preset ci-release-checks - - - name: build - run: cmake --build ../mrtrix3-build-ci-release-checks - - - name: unit tests - run: ctest -R unit --test-dir ../mrtrix3-build-ci-release-checks - - - name: binary tests - run: ctest -R bin --test-dir ../mrtrix3-build-ci-release-checks - - macos-build: - - runs-on: macos-latest - - env: - PACKAGES: "qt5 eigen pkg-config fftw libpng ninja cmake" - SCCACHE_GHA_ENABLED: "true" - SCCACHE_CACHE_SIZE: "2G" - - steps: - - uses: actions/checkout@v1 - with: - submodules: true - - - name: install dependencies - run: | - brew update || brew update # https://github.com/Homebrew/brew/issues/2491#issuecomment-294207661 - brew install $PACKAGES || brew install $PACKAGES - brew link --force qt5 - - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.3 - - - name: configure - run: | - export PATH=/usr/local/opt/qt5/bin:$PATH - cmake --preset ci-release-checks - - - name: build - run: cmake --build ../mrtrix3-build-ci-release-checks - - - name: unit tests - run: ctest -R unit --test-dir ../mrtrix3-build-ci-release-checks - - - name: binary tests - run: ctest -R bin --test-dir ../mrtrix3-build-ci-release-checks - - windows-build: - - runs-on: windows-latest - defaults: - run: - shell: msys2 {0} - - env: - # CFLAGS: -Werror - CHERE_INVOKING: enabled_from_arguments - MINGW_PACKAGE_PREFIX: mingw-w64-ucrt-x86_64 - SCCACHE_GHA_ENABLED: "true" - SCCACHE_CACHE_SIZE: "2G" - SCCACHE_DIR: ${{ github.workspace }}/.sccache - - steps: - - uses: actions/checkout@v1 - with: - submodules: true - - - uses: msys2/setup-msys2@v2 - with: - msystem: UCRT64 - release: false - install: | - git - python - ${{env.MINGW_PACKAGE_PREFIX}}-bc - ${{env.MINGW_PACKAGE_PREFIX}}-cmake - ${{env.MINGW_PACKAGE_PREFIX}}-diffutils - ${{env.MINGW_PACKAGE_PREFIX}}-eigen3 - ${{env.MINGW_PACKAGE_PREFIX}}-fftw - ${{env.MINGW_PACKAGE_PREFIX}}-gcc - ${{env.MINGW_PACKAGE_PREFIX}}-libtiff - ${{env.MINGW_PACKAGE_PREFIX}}-ninja - ${{env.MINGW_PACKAGE_PREFIX}}-pkg-config - ${{env.MINGW_PACKAGE_PREFIX}}-qt5-base - ${{env.MINGW_PACKAGE_PREFIX}}-qt5-svg - ${{env.MINGW_PACKAGE_PREFIX}}-zlib - - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.3 - - - name: export sccache to msys2 shell - run: | - export SCCACHE_UNIX_PATH=$(cygpath -u "$SCCACHE_PATH") - echo "SCCACHE_UNIX_PATH=$SCCACHE_UNIX_PATH" >> $GITHUB_ENV - - - name: configure - run: cmake --preset ci-release-checks -DCMAKE_CXX_COMPILER_LAUNCHER=${{env.SCCACHE_UNIX_PATH}} . - - - name: build - run: cmake --build ../mrtrix3-build-ci-release-checks - - - name: unit tests - run: ctest -R unit --test-dir ../mrtrix3-build-ci-release-checks - - - name: binary tests - run: ctest -R bin --test-dir ../mrtrix3-build-ci-release-checks - - secondary-checks: - runs-on: ubuntu-latest - - env: - QT_SELECT: qt5 - - steps: - - uses: actions/checkout@v1 - - - name: install dependencies - run: | - sudo apt-get update - sudo apt-get install pylint python3-sphinx sphinx-rtd-theme-common python3-recommonmark python3-sphinx-rtd-theme python3-pip python3-sphinx-notfound-page - - - name: check syntax - run: ./check_syntax || { cat syntax.log; false; } - - - name: pylint - run: | - echo "__version__ = 'pylint testing' #pylint: disable=unused-variable" > ./python/lib/mrtrix3/_version.py - ./run_pylint || { cat pylint.log; false; } - - - name: check copyright headers - run: ./update_copyright && git diff --exit-code - - - name: check building of documentation - run: python3 -m sphinx -n -N -W -w sphinx.log docs/ tmp/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index b4f5166a80..58b50c3e38 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,4 @@ *.o -*_moc.cpp -*.so -*.dll -*.dylib -*.a *~ *.swp *.pyc @@ -15,15 +10,10 @@ *.mri *.img *.hdr -# *.qrc *.rste /python/lib/mrtrix3/_version.py -/test/src/project_version.h /scripts/mrtrix_bash_completion -/release/ /dev/ -/bin/ -/tmp/ /compiled_docs/ /.vscode/ .cproject @@ -33,19 +23,11 @@ .pydevproject *.config *.creator -# *.txt *.log *.creator.user *.files *.includes *.code-workspace -/debug/ -/assert/ -testing.log -testing/build.log -testing/bin/ -testing/src/project_version.cpp -testing/src/project_version.h .__tmp.log .check_syntax.tmp .check_syntax2.tmp diff --git a/package_mrtrix b/package_mrtrix deleted file mode 100755 index cf9a7624df..0000000000 --- a/package_mrtrix +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2008-2023 the MRtrix3 contributors. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# Covered Software is provided under this License on an "as is" -# basis, without warranty of any kind, either expressed, implied, or -# statutory, including, without limitation, warranties that the -# Covered Software is free of defects, merchantable, fit for a -# particular purpose or non-infringing. -# See the Mozilla Public License v. 2.0 for more details. -# -# For more details, see http://www.mrtrix.org/. - -cat < _package/mrtrix3/launcher <<"EOF" -#!/bin/bash -PREFIX="$(dirname $0)/.." -COMMAND="$(basename $0)" -"$PREFIX"/lib/ld-*.so* "$PREFIX"/exe/"$COMMAND" "$@" -EOF - chmod a+x _package/mrtrix3/launcher - mkdir -p _package/mrtrix3/exe - ( - cd _package/mrtrix3/bin - for n in *; do - file $n | grep -q script || ( - mv $n ../exe - ln -s ../launcher $n - ) - done - ) - - echo - collating dependent system libraries... - LIBS=$(for n in bin/*; do ldd $n; done | sed 's/(.*)$//g' | sed 's/^.*=>//g' | sort | uniq | grep -v 'mrtrix\|vdso\|libGL.so\|libEGL.so\|nvidia\|fglrx' | xargs) - echo ' libraries identified:' - for n in $LIBS; do - if [ -e $n ]; then - echo ' '$n; - cp $n _package/mrtrix3/lib/ - fi - done - - QTCORE=$(for n in $LIBS; do echo $n; done | grep 'libQt.*Core') - [[ $QTCORE ]] && ( # sort out Qt: - [[ -z $QTPLUGDIR ]] && QTPLUGDIR=$(strings $QTCORE | sed -n 's/qt_plugpath=\(.*\)$/\1/p') - [[ ! -d "$QTPLUGDIR" ]] && echo "could not find Qt plugins in $QTPLUGDIR, try 'export QTPLUGDIR=/usr/lib/qt/plugins/; package_mrtrix -standalone'" && exit 1 - echo ' Qt plugins in' $QTPLUGDIR - LDD_PATTERN='^[[:space:]]*[[:graph:]]*[[:space:]]*=>[[:space:]]*\([[:graph:]]*\)[[:space:]]*([[:graph:]]*)$' - QTLIBS=$(find $QTPLUGDIR -name '*.so' -print0 | xargs -n 1 -0 ldd | sed -n 's/'"$LDD_PATTERN"'/\1/p' | sort | uniq | grep -v 'libGL.so\|libEGL.so\|nvidia\|fglrx' ) - echo ' additional libraries required for Qt:' - for n in $QTLIBS; do echo ' '$n; done - - cp $QTLIBS _package/mrtrix3/lib/ - cp -r $QTPLUGDIR _package/mrtrix3/lib/ - cat > _package/mrtrix3/lib/qt.conf << EOF -[Paths] -Prefix = . -EOF - - - ) - - ) - -) && cat < $LOGFILE <> $LOGFILE 2>&1 - if [ $? != 0 ]; then - if [[ -e $datadir && ! -z $(ls -A $datadir) ]]; then - echo "Found; UNABLE TO VERIFY VERSION MATCH" - else - echo "ERROR!" - exit 1 - fi - else - echo "Synchronized OK" - fi -fi - - -if [ ! -z $testsdir ]; then - echo -n "building list of tests... " - for item in $testsdir/*; do - testlist="$testlist $(basename $item)" - done - if [ -z "$testlist" ]; then - echo ERROR! - exit 1 - fi - echo OK - cat >> $LOGFILE <> $LOGFILE <> $LOGFILE 2>&1 -if [ $? != 0 ]; then - echo ERROR! - exit 1 -else - echo OK -fi - - -if [[ $datadir == "testing/scripts/data/" && -d "testing/scripts/tmp/" ]]; then - echo -n "Erasing old script test output directory... " - rm -rf testing/scripts/tmp/ - echo OK -fi - - -a_test_has_failed=false - -cat >> $LOGFILE <> $LOGFILE <> $LOGFILE <> $LOGFILE - ( - export PATH="$(pwd)/testing/bin:${MRTRIX_BINDIR}:$PATH"; - cd $datadir - eval $cmd - ) > .__tmp.log 2>&1 - - if [[ $? -ne 0 ]]; then - echo " [ ERROR ]" >> $LOGFILE - else - echo " [ ok ]" >> $LOGFILE - ((success++)); - fi - cat .__tmp.log >> $LOGFILE - echo "" >> $LOGFILE - ((ntests++)) - done < $testsdir$testitem - - echo -n $success of $ntests passed - if [[ $success -lt $ntests ]]; then - echo " <-------- ERROR" - a_test_has_failed=true - cat >> $LOGFILE <> $LOGFILE <