From d0724a77bb30f3c4092a33b4a36b65a2d4da46f0 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Wed, 29 Apr 2020 13:49:52 -0400 Subject: [PATCH 01/29] Backport GitHub Actions CI (#259) * Add GitHub Actions * Add Windows Check * Fix wrong os selection * Add XCode version * Upgrade GCC Version * Make GCC match Ubuntu name * Do not fail everyone when one failed * More checks on ccache * Do not expose GenericValue on Windows * Fix BetweenFactor for Windows * Update * Add Python CI * Typo * Add note about GENERICVALUE_VISIBILITY * Fix Windows Boost * Change substitution scheme to PowerShell * Fix the spurious error of the Point3 default constructor * Separate builds to allow easier restarts * Fix uninitialized variable usage * Change of policy, only build python stuff, mac and win on PRs * Further separate the Python tests --- .github/workflows/build-cython.yml | 96 +++++++++++++++++++++ .github/workflows/build-linux.yml | 71 +++++++++++++++ .github/workflows/build-macos.yml | 51 +++++++++++ .github/workflows/build-python.yml | 96 +++++++++++++++++++++ .github/workflows/build-windows.yml | 75 ++++++++++++++++ .travis.sh | 2 +- cython/gtsam/utils/visual_data_generator.py | 14 +-- gtsam/base/GenericValue.h | 8 ++ gtsam/slam/BetweenFactor.h | 8 ++ 9 files changed, 413 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/build-cython.yml create mode 100644 .github/workflows/build-linux.yml create mode 100644 .github/workflows/build-macos.yml create mode 100644 .github/workflows/build-python.yml create mode 100644 .github/workflows/build-windows.yml diff --git a/.github/workflows/build-cython.yml b/.github/workflows/build-cython.yml new file mode 100644 index 000000000..c159a60fc --- /dev/null +++ b/.github/workflows/build-cython.yml @@ -0,0 +1,96 @@ +name: Cython CI + +on: [pull_request] + +jobs: + build: + name: ${{ matrix.name }} ${{ matrix.build_type }} ${{ matrix.python_version }} + runs-on: ${{ matrix.os }} + + env: + CTEST_OUTPUT_ON_FAILURE: ON + CTEST_PARALLEL_LEVEL: 2 + CMAKE_BUILD_TYPE: ${{ matrix.build_type }} + PYTHON_VERSION: ${{ matrix.python_version }} + WRAPPER: ${{ matrix.wrapper }} + strategy: + fail-fast: false + matrix: + # Github Actions requires a single row to be added to the build matrix. + # See https://help.github.com/en/articles/workflow-syntax-for-github-actions. + name: [ + ubuntu-18.04-gcc-5, + ubuntu-18.04-gcc-9, + ubuntu-18.04-clang-9, + macOS-10.15-xcode-11.3.1, + ] + + build_type: [Debug, Release] + python_version: [3] + wrapper: [cython] + include: + - name: ubuntu-18.04-gcc-5 + os: ubuntu-18.04 + compiler: gcc + version: "5" + + - name: ubuntu-18.04-gcc-9 + os: ubuntu-18.04 + compiler: gcc + version: "9" + + - name: ubuntu-18.04-clang-9 + os: ubuntu-18.04 + compiler: clang + version: "9" + + - name: macOS-10.15-xcode-11.3.1 + os: macOS-10.15 + compiler: xcode + version: "11.3.1" + + steps: + - name: Checkout + uses: actions/checkout@master + - name: Install (Linux) + if: runner.os == 'Linux' + run: | + # LLVM 9 is not in Bionic's repositories so we add the official LLVM repository. + if [ "${{ matrix.compiler }}" = "clang" ] && [ "${{ matrix.version }}" = "9" ]; then + sudo add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main" + fi + sudo apt-get -y update + sudo apt-get -y upgrade + + sudo apt install cmake g++-9 clang-9 build-essential pkg-config libpython-dev python-numpy libboost-all-dev + + if [ "${{ matrix.compiler }}" = "gcc" ]; then + sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib + echo "::set-env name=CC::gcc-${{ matrix.version }}" + echo "::set-env name=CXX::g++-${{ matrix.version }}" + else + sudo apt-get install -y clang-${{ matrix.version }} g++-multilib + echo "::set-env name=CC::clang-${{ matrix.version }}" + echo "::set-env name=CXX::clang++-${{ matrix.version }}" + fi + - name: Install (macOS) + if: runner.os == 'macOS' + run: | + brew install cmake ninja boost + if [ "${{ matrix.compiler }}" = "gcc" ]; then + brew install gcc@${{ matrix.version }} + echo "::set-env name=CC::gcc-${{ matrix.version }}" + echo "::set-env name=CXX::g++-${{ matrix.version }}" + else + sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app + echo "::set-env name=CC::clang" + echo "::set-env name=CXX::clang++" + fi + - name: Build (Linux) + if: runner.os == 'Linux' + run: | + bash .travis.python.sh + - name: Build (macOS) + if: runner.os == 'macOS' + run: | + bash .travis.python.sh \ No newline at end of file diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml new file mode 100644 index 000000000..f58fe5f37 --- /dev/null +++ b/.github/workflows/build-linux.yml @@ -0,0 +1,71 @@ +name: CI Linux + +on: [push, pull_request] + +jobs: + build: + name: ${{ matrix.name }} ${{ matrix.build_type }} ${{ matrix.build_unstable }} + runs-on: ${{ matrix.os }} + + env: + CTEST_OUTPUT_ON_FAILURE: ON + CTEST_PARALLEL_LEVEL: 2 + CMAKE_BUILD_TYPE: ${{ matrix.build_type }} + GTSAM_BUILD_UNSTABLE: ${{ matrix.build_unstable }} + strategy: + fail-fast: false + matrix: + # Github Actions requires a single row to be added to the build matrix. + # See https://help.github.com/en/articles/workflow-syntax-for-github-actions. + name: [ + ubuntu-18.04-gcc-5, + ubuntu-18.04-gcc-9, + ubuntu-18.04-clang-9, + ] + + build_type: [Debug, Release] + build_unstable: [ON, OFF] + include: + - name: ubuntu-18.04-gcc-5 + os: ubuntu-18.04 + compiler: gcc + version: "5" + + - name: ubuntu-18.04-gcc-9 + os: ubuntu-18.04 + compiler: gcc + version: "9" + + - name: ubuntu-18.04-clang-9 + os: ubuntu-18.04 + compiler: clang + version: "9" + + steps: + - name: Checkout + uses: actions/checkout@master + - name: Install (Linux) + if: runner.os == 'Linux' + run: | + # LLVM 9 is not in Bionic's repositories so we add the official LLVM repository. + if [ "${{ matrix.compiler }}" = "clang" ] && [ "${{ matrix.version }}" = "9" ]; then + sudo add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main" + fi + sudo apt-get -y update + sudo apt-get -y upgrade + + sudo apt install cmake g++-9 clang-9 build-essential pkg-config libpython-dev python-numpy libboost-all-dev + + if [ "${{ matrix.compiler }}" = "gcc" ]; then + sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib + echo "::set-env name=CC::gcc-${{ matrix.version }}" + echo "::set-env name=CXX::g++-${{ matrix.version }}" + else + sudo apt-get install -y clang-${{ matrix.version }} g++-multilib + echo "::set-env name=CC::clang-${{ matrix.version }}" + echo "::set-env name=CXX::clang++-${{ matrix.version }}" + fi + - name: Build (Linux) + if: runner.os == 'Linux' + run: | + bash .travis.sh -t \ No newline at end of file diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml new file mode 100644 index 000000000..2ab2e63c5 --- /dev/null +++ b/.github/workflows/build-macos.yml @@ -0,0 +1,51 @@ +name: CI macOS + +on: [pull_request] + +jobs: + build: + name: ${{ matrix.name }} ${{ matrix.build_type }} ${{ matrix.build_unstable }} + runs-on: ${{ matrix.os }} + + env: + CTEST_OUTPUT_ON_FAILURE: ON + CTEST_PARALLEL_LEVEL: 2 + CMAKE_BUILD_TYPE: ${{ matrix.build_type }} + GTSAM_BUILD_UNSTABLE: ${{ matrix.build_unstable }} + strategy: + fail-fast: false + matrix: + # Github Actions requires a single row to be added to the build matrix. + # See https://help.github.com/en/articles/workflow-syntax-for-github-actions. + name: [ + macOS-10.15-xcode-11.3.1, + ] + + build_type: [Debug, Release] + build_unstable: [ON, OFF] + include: + - name: macOS-10.15-xcode-11.3.1 + os: macOS-10.15 + compiler: xcode + version: "11.3.1" + + steps: + - name: Checkout + uses: actions/checkout@master + - name: Install (macOS) + if: runner.os == 'macOS' + run: | + brew install cmake ninja boost + if [ "${{ matrix.compiler }}" = "gcc" ]; then + brew install gcc@${{ matrix.version }} + echo "::set-env name=CC::gcc-${{ matrix.version }}" + echo "::set-env name=CXX::g++-${{ matrix.version }}" + else + sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app + echo "::set-env name=CC::clang" + echo "::set-env name=CXX::clang++" + fi + - name: Build (macOS) + if: runner.os == 'macOS' + run: | + bash .travis.sh -t \ No newline at end of file diff --git a/.github/workflows/build-python.yml b/.github/workflows/build-python.yml new file mode 100644 index 000000000..2dc98f05d --- /dev/null +++ b/.github/workflows/build-python.yml @@ -0,0 +1,96 @@ +name: Python CI + +on: [pull_request] + +jobs: + build: + name: ${{ matrix.name }} ${{ matrix.build_type }} ${{ matrix.python_version }} + runs-on: ${{ matrix.os }} + + env: + CTEST_OUTPUT_ON_FAILURE: ON + CTEST_PARALLEL_LEVEL: 2 + CMAKE_BUILD_TYPE: ${{ matrix.build_type }} + PYTHON_VERSION: ${{ matrix.python_version }} + WRAPPER: ${{ matrix.wrapper }} + strategy: + fail-fast: false + matrix: + # Github Actions requires a single row to be added to the build matrix. + # See https://help.github.com/en/articles/workflow-syntax-for-github-actions. + name: [ + ubuntu-18.04-gcc-5, + ubuntu-18.04-gcc-9, + ubuntu-18.04-clang-9, + macOS-10.15-xcode-11.3.1, + ] + + build_type: [Debug, Release] + python_version: [3] + wrapper: [pybind] + include: + - name: ubuntu-18.04-gcc-5 + os: ubuntu-18.04 + compiler: gcc + version: "5" + + - name: ubuntu-18.04-gcc-9 + os: ubuntu-18.04 + compiler: gcc + version: "9" + + - name: ubuntu-18.04-clang-9 + os: ubuntu-18.04 + compiler: clang + version: "9" + + - name: macOS-10.15-xcode-11.3.1 + os: macOS-10.15 + compiler: xcode + version: "11.3.1" + + steps: + - name: Checkout + uses: actions/checkout@master + - name: Install (Linux) + if: runner.os == 'Linux' + run: | + # LLVM 9 is not in Bionic's repositories so we add the official LLVM repository. + if [ "${{ matrix.compiler }}" = "clang" ] && [ "${{ matrix.version }}" = "9" ]; then + sudo add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main" + fi + sudo apt-get -y update + sudo apt-get -y upgrade + + sudo apt install cmake g++-9 clang-9 build-essential pkg-config libpython-dev python-numpy libboost-all-dev + + if [ "${{ matrix.compiler }}" = "gcc" ]; then + sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib + echo "::set-env name=CC::gcc-${{ matrix.version }}" + echo "::set-env name=CXX::g++-${{ matrix.version }}" + else + sudo apt-get install -y clang-${{ matrix.version }} g++-multilib + echo "::set-env name=CC::clang-${{ matrix.version }}" + echo "::set-env name=CXX::clang++-${{ matrix.version }}" + fi + - name: Install (macOS) + if: runner.os == 'macOS' + run: | + brew install cmake ninja boost + if [ "${{ matrix.compiler }}" = "gcc" ]; then + brew install gcc@${{ matrix.version }} + echo "::set-env name=CC::gcc-${{ matrix.version }}" + echo "::set-env name=CXX::g++-${{ matrix.version }}" + else + sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app + echo "::set-env name=CC::clang" + echo "::set-env name=CXX::clang++" + fi + - name: Build (Linux) + if: runner.os == 'Linux' + run: | + bash .travis.python.sh + - name: Build (macOS) + if: runner.os == 'macOS' + run: | + bash .travis.python.sh \ No newline at end of file diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 000000000..516e67e1d --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,75 @@ +name: CI Windows + +on: [pull_request] + +jobs: + build: + name: ${{ matrix.name }} ${{ matrix.build_type }} ${{ matrix.build_unstable }} + runs-on: ${{ matrix.os }} + + env: + CTEST_OUTPUT_ON_FAILURE: ON + CTEST_PARALLEL_LEVEL: 2 + CMAKE_BUILD_TYPE: ${{ matrix.build_type }} + GTSAM_BUILD_UNSTABLE: ${{ matrix.build_unstable }} + strategy: + fail-fast: false + matrix: + # Github Actions requires a single row to be added to the build matrix. + # See https://help.github.com/en/articles/workflow-syntax-for-github-actions. + name: [ + windows-2016-cl, + windows-2019-cl, + ] + + build_type: [Debug, Release] + build_unstable: [ON, OFF] + include: + - name: windows-2016-cl + os: windows-2016 + compiler: cl + + - name: windows-2019-cl + os: windows-2019 + compiler: cl + + steps: + - name: Checkout + uses: actions/checkout@master + - name: Install (Windows) + if: runner.os == 'Windows' + shell: powershell + run: | + Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') + scoop install ninja --global + if ("${{ matrix.compiler }}".StartsWith("clang")) { + scoop install llvm --global + } + if ("${{ matrix.compiler }}" -eq "gcc") { + # Chocolatey GCC is broken on the windows-2019 image. + # See: https://github.com/DaanDeMeyer/doctest/runs/231595515 + # See: https://github.community/t5/GitHub-Actions/Something-is-wrong-with-the-chocolatey-installed-version-of-gcc/td-p/32413 + scoop install gcc --global + echo "::set-env name=CC::gcc" + echo "::set-env name=CXX::g++" + } elseif ("${{ matrix.compiler }}" -eq "clang") { + echo "::set-env name=CC::clang" + echo "::set-env name=CXX::clang++" + } else { + echo "::set-env name=CC::${{ matrix.compiler }}" + echo "::set-env name=CXX::${{ matrix.compiler }}" + } + # Scoop modifies the PATH so we make the modified PATH global. + echo "::set-env name=PATH::$env:PATH" + - name: Build (Windows) + if: runner.os == 'Windows' + run: | + cmake -E remove_directory build + echo "BOOST_ROOT_1_72_0: ${env:BOOST_ROOT_1_72_0}" + cmake -B build -S . -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DBOOST_ROOT="${env:BOOST_ROOT_1_72_0}" -DBOOST_INCLUDEDIR="${env:BOOST_ROOT_1_72_0}\boost\include" -DBOOST_LIBRARYDIR="${env:BOOST_ROOT_1_72_0}\lib" + cmake --build build --config ${{ matrix.build_type }} --target gtsam + cmake --build build --config ${{ matrix.build_type }} --target gtsam_unstable + cmake --build build --config ${{ matrix.build_type }} --target wrap + cmake --build build --config ${{ matrix.build_type }} --target check.base + cmake --build build --config ${{ matrix.build_type }} --target check.base_unstable + cmake --build build --config ${{ matrix.build_type }} --target check.linear \ No newline at end of file diff --git a/.travis.sh b/.travis.sh index 7777e9919..35b964222 100755 --- a/.travis.sh +++ b/.travis.sh @@ -71,7 +71,7 @@ function configure() function finish () { # Print ccache stats - ccache -s + [ -x "$(command -v ccache)" ] && ccache -s cd $SOURCE_DIR } diff --git a/cython/gtsam/utils/visual_data_generator.py b/cython/gtsam/utils/visual_data_generator.py index f04588e70..5ce72fe68 100644 --- a/cython/gtsam/utils/visual_data_generator.py +++ b/cython/gtsam/utils/visual_data_generator.py @@ -30,8 +30,8 @@ class GroundTruth: def __init__(self, K=Cal3_S2(), nrCameras=3, nrPoints=4): self.K = K - self.cameras = [Pose3()] * nrCameras - self.points = [Point3()] * nrPoints + self.cameras = [gtsam.Pose3()] * nrCameras + self.points = [gtsam.Point3(0, 0, 0)] * nrPoints def print_(self, s=""): print(s) @@ -99,11 +99,11 @@ def generate_data(options): r = 40 for i in range(options.nrCameras): theta = i * 2 * np.pi / options.nrCameras - t = Point3(r * np.cos(theta), r * np.sin(theta), height) - truth.cameras[i] = PinholeCameraCal3_S2.Lookat(t, - Point3(), - Point3(0, 0, 1), - truth.K) + t = gtsam.Point3(r * np.cos(theta), r * np.sin(theta), height) + truth.cameras[i] = gtsam.SimpleCamera.Lookat(t, + gtsam.Point3(0, 0, 0), + gtsam.Point3(0, 0, 1), + truth.K) # Create measurements for j in range(nrPoints): # All landmarks seen in every frame diff --git a/gtsam/base/GenericValue.h b/gtsam/base/GenericValue.h index dc205b47f..0e928765f 100644 --- a/gtsam/base/GenericValue.h +++ b/gtsam/base/GenericValue.h @@ -30,6 +30,14 @@ #include #include // operator typeid +#ifdef _WIN32 +#define GENERICVALUE_VISIBILITY +#else +// This will trigger a LNKxxxx on MSVC, so disable for MSVC build +// Please refer to https://github.com/borglab/gtsam/blob/develop/Using-GTSAM-EXPORT.md +#define GENERICVALUE_VISIBILITY GTSAM_EXPORT +#endif + namespace gtsam { /** diff --git a/gtsam/slam/BetweenFactor.h b/gtsam/slam/BetweenFactor.h index 9afc2f72b..a594e95d5 100644 --- a/gtsam/slam/BetweenFactor.h +++ b/gtsam/slam/BetweenFactor.h @@ -21,6 +21,14 @@ #include #include +#ifdef _WIN32 +#define BETWEENFACTOR_VISIBILITY +#else +// This will trigger a LNKxxxx on MSVC, so disable for MSVC build +// Please refer to https://github.com/borglab/gtsam/blob/develop/Using-GTSAM-EXPORT.md +#define BETWEENFACTOR_VISIBILITY GTSAM_EXPORT +#endif + namespace gtsam { /** From 10754080fc34220503ae66f23bf3268a84c35322 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Fri, 14 Aug 2020 10:03:40 -0400 Subject: [PATCH 02/29] Remove travis and appveyor --- .travis.yml | 140 --------------------------------------------------- appveyor.yml | 33 ------------ 2 files changed, 173 deletions(-) delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 986e86cc2..000000000 --- a/.travis.yml +++ /dev/null @@ -1,140 +0,0 @@ -language: cpp -cache: ccache -dist: xenial - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - - sourceline: 'deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main' - key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' - packages: - - g++-9 - - clang-9 - - build-essential pkg-config - - cmake - - python3-dev libpython-dev - - python3-numpy - - libboost-all-dev - -# before_install: - # - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi - -install: - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache ; fi - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then export PATH="/usr/local/opt/ccache/libexec:$PATH" ; fi - -# We first do the compile stage specified below, then the matrix expansion specified after. -stages: - - compile - - test - - special - -env: - global: - - MAKEFLAGS="-j3" - - CCACHE_SLOPPINESS=pch_defines,time_macros - -# Compile stage without building examples/tests to populate the caches. -jobs: -# -------- STAGE 1: COMPILE ----------- - include: -# on Mac, GCC - - stage: compile - os: osx - compiler: gcc - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF - script: bash .travis.sh -b - - stage: compile - os: osx - compiler: gcc - env: CMAKE_BUILD_TYPE=Release - script: bash .travis.sh -b -# on Mac, CLANG - - stage: compile - os: osx - compiler: clang - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF - script: bash .travis.sh -b - - stage: compile - os: osx - compiler: clang - env: CMAKE_BUILD_TYPE=Release - script: bash .travis.sh -b -# on Linux, GCC - - stage: compile - os: linux - compiler: gcc - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF - script: bash .travis.sh -b - - stage: compile - os: linux - compiler: gcc - env: CMAKE_BUILD_TYPE=Release - script: bash .travis.sh -b -# on Linux, CLANG - - stage: compile - os: linux - compiler: clang - env: CC=clang-9 CXX=clang++-9 CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF - script: bash .travis.sh -b - - stage: compile - os: linux - compiler: clang - env: CC=clang-9 CXX=clang++-9 CMAKE_BUILD_TYPE=Release - script: bash .travis.sh -b -# on Linux, with deprecated ON to make sure that path still compiles/tests - - stage: special - os: linux - compiler: clang - env: CC=clang-9 CXX=clang++-9 CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_ALLOW_DEPRECATED_SINCE_V41=ON - script: bash .travis.sh -b -# on Linux, with GTSAM_WITH_TBB on to make sure GTSAM still compiles/tests - # - stage: special - # os: linux - # compiler: gcc - # env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_WITH_TBB=ON - # script: bash .travis.sh -t -# -------- STAGE 2: TESTS ----------- -# on Mac, GCC - - stage: test - os: osx - compiler: clang - env: CMAKE_BUILD_TYPE=Release - script: bash .travis.sh -t - - stage: test - os: osx - compiler: clang - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF - script: bash .travis.sh -t - - stage: test - os: linux - compiler: gcc - env: CMAKE_BUILD_TYPE=Release - script: bash .travis.sh -t - - stage: test - os: linux - compiler: gcc - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF - script: bash .travis.sh -t - - stage: test - os: linux - compiler: clang - env: CC=clang-9 CXX=clang++-9 CMAKE_BUILD_TYPE=Release - script: bash .travis.sh -t -# on Linux, with quaternions ON to make sure that path still compiles/tests - - stage: special - os: linux - compiler: clang - env: CC=clang-9 CXX=clang++-9 CMAKE_BUILD_TYPE=Release GTSAM_BUILD_UNSTABLE=OFF GTSAM_USE_QUATERNIONS=ON - script: bash .travis.sh -t - - stage: special - os: linux - compiler: gcc - env: PYTHON_VERSION=3 - script: bash .travis.python.sh - - stage: special - os: osx - compiler: clang - env: PYTHON_VERSION=3 - script: bash .travis.python.sh diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 3747354cf..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,33 +0,0 @@ -# version format -version: 4.0.3-{branch}-build{build} - -os: Visual Studio 2019 - -clone_folder: c:\projects\gtsam - -platform: x64 -configuration: Release - -environment: - CTEST_OUTPUT_ON_FAILURE: 1 - BOOST_ROOT: C:/Libraries/boost_1_71_0 - -build_script: - - cd c:\projects\gtsam\build - # As of Dec 2019, not all unit tests build cleanly for MSVC, so we'll just - # check that parts of GTSAM build correctly: - #- cmake --build . - - cmake --build . --config Release --target gtsam - - cmake --build . --config Release --target gtsam_unstable - - cmake --build . --config Release --target wrap - #- cmake --build . --target check - - cmake --build . --config Release --target check.base - - cmake --build . --config Release --target check.base_unstable - - cmake --build . --config Release --target check.linear - -before_build: - - cd c:\projects\gtsam - - mkdir build - - cd build - # Disable examples to avoid AppVeyor timeout - - cmake -G "Visual Studio 16 2019" .. -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF From d43d8b7c6959ddd3e4232110a7beb4acbaedfc9e Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Fri, 14 Aug 2020 10:03:56 -0400 Subject: [PATCH 03/29] Limit python triggering --- .github/workflows/trigger-python.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/trigger-python.yml b/.github/workflows/trigger-python.yml index 8fad9e7ca..94527e732 100644 --- a/.github/workflows/trigger-python.yml +++ b/.github/workflows/trigger-python.yml @@ -1,6 +1,9 @@ # This triggers Cython builds on `gtsam-manylinux-build` name: Trigger Python Builds -on: push +on: + push: + branches: + - develop jobs: triggerCython: runs-on: ubuntu-latest From 96169665b0644c64bd62e88cb3f35bdb74709934 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Fri, 14 Aug 2020 10:06:00 -0400 Subject: [PATCH 04/29] Remove pybind build --- .github/workflows/build-python.yml | 96 ------------------------------ 1 file changed, 96 deletions(-) delete mode 100644 .github/workflows/build-python.yml diff --git a/.github/workflows/build-python.yml b/.github/workflows/build-python.yml deleted file mode 100644 index 2dc98f05d..000000000 --- a/.github/workflows/build-python.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Python CI - -on: [pull_request] - -jobs: - build: - name: ${{ matrix.name }} ${{ matrix.build_type }} ${{ matrix.python_version }} - runs-on: ${{ matrix.os }} - - env: - CTEST_OUTPUT_ON_FAILURE: ON - CTEST_PARALLEL_LEVEL: 2 - CMAKE_BUILD_TYPE: ${{ matrix.build_type }} - PYTHON_VERSION: ${{ matrix.python_version }} - WRAPPER: ${{ matrix.wrapper }} - strategy: - fail-fast: false - matrix: - # Github Actions requires a single row to be added to the build matrix. - # See https://help.github.com/en/articles/workflow-syntax-for-github-actions. - name: [ - ubuntu-18.04-gcc-5, - ubuntu-18.04-gcc-9, - ubuntu-18.04-clang-9, - macOS-10.15-xcode-11.3.1, - ] - - build_type: [Debug, Release] - python_version: [3] - wrapper: [pybind] - include: - - name: ubuntu-18.04-gcc-5 - os: ubuntu-18.04 - compiler: gcc - version: "5" - - - name: ubuntu-18.04-gcc-9 - os: ubuntu-18.04 - compiler: gcc - version: "9" - - - name: ubuntu-18.04-clang-9 - os: ubuntu-18.04 - compiler: clang - version: "9" - - - name: macOS-10.15-xcode-11.3.1 - os: macOS-10.15 - compiler: xcode - version: "11.3.1" - - steps: - - name: Checkout - uses: actions/checkout@master - - name: Install (Linux) - if: runner.os == 'Linux' - run: | - # LLVM 9 is not in Bionic's repositories so we add the official LLVM repository. - if [ "${{ matrix.compiler }}" = "clang" ] && [ "${{ matrix.version }}" = "9" ]; then - sudo add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main" - fi - sudo apt-get -y update - sudo apt-get -y upgrade - - sudo apt install cmake g++-9 clang-9 build-essential pkg-config libpython-dev python-numpy libboost-all-dev - - if [ "${{ matrix.compiler }}" = "gcc" ]; then - sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib - echo "::set-env name=CC::gcc-${{ matrix.version }}" - echo "::set-env name=CXX::g++-${{ matrix.version }}" - else - sudo apt-get install -y clang-${{ matrix.version }} g++-multilib - echo "::set-env name=CC::clang-${{ matrix.version }}" - echo "::set-env name=CXX::clang++-${{ matrix.version }}" - fi - - name: Install (macOS) - if: runner.os == 'macOS' - run: | - brew install cmake ninja boost - if [ "${{ matrix.compiler }}" = "gcc" ]; then - brew install gcc@${{ matrix.version }} - echo "::set-env name=CC::gcc-${{ matrix.version }}" - echo "::set-env name=CXX::g++-${{ matrix.version }}" - else - sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app - echo "::set-env name=CC::clang" - echo "::set-env name=CXX::clang++" - fi - - name: Build (Linux) - if: runner.os == 'Linux' - run: | - bash .travis.python.sh - - name: Build (macOS) - if: runner.os == 'macOS' - run: | - bash .travis.python.sh \ No newline at end of file From a5b722d237c58c2354c081de169b7345b2a48b09 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Fri, 14 Aug 2020 10:48:17 -0400 Subject: [PATCH 05/29] Correct .travis.sh --- .travis.python.sh | 60 ++++++++++++++++++++++++++++++++++++++--------- .travis.sh | 16 ++++++------- 2 files changed, 57 insertions(+), 19 deletions(-) diff --git a/.travis.python.sh b/.travis.python.sh index 99506e749..7ccf56dd1 100644 --- a/.travis.python.sh +++ b/.travis.python.sh @@ -6,6 +6,11 @@ if [ -z ${PYTHON_VERSION+x} ]; then exit 127 fi +if [ -z ${WRAPPER+x} ]; then + echo "Please provide the wrapper to build!" + exit 126 +fi + PYTHON="python${PYTHON_VERSION}" if [[ $(uname) == "Darwin" ]]; then @@ -15,9 +20,29 @@ else sudo apt-get install wget libicu-dev python3-pip python3-setuptools fi -CURRDIR=$(pwd) +PATH=$PATH:$($PYTHON -c "import site; print(site.USER_BASE)")/bin -sudo $PYTHON -m pip install -r ./cython/requirements.txt +case $WRAPPER in +"cython") + BUILD_CYTHON="ON" + BUILD_PYBIND="OFF" + TYPEDEF_POINTS_TO_VECTORS="OFF" + + $PYTHON -m pip install --user -r ./cython/requirements.txt + ;; +"pybind") + BUILD_CYTHON="OFF" + BUILD_PYBIND="ON" + TYPEDEF_POINTS_TO_VECTORS="ON" + + $PYTHON -m pip install --user -r ./wrap/python/requirements.txt + ;; +*) + exit 126 + ;; +esac + +CURRDIR=$(pwd) mkdir $CURRDIR/build cd $CURRDIR/build @@ -27,17 +52,30 @@ cmake $CURRDIR -DCMAKE_BUILD_TYPE=Release \ -DGTSAM_USE_QUATERNIONS=OFF \ -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF \ -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \ - -DGTSAM_INSTALL_CYTHON_TOOLBOX=ON \ + -DGTSAM_INSTALL_CYTHON_TOOLBOX=${BUILD_CYTHON} \ + -DGTSAM_BUILD_PYTHON=${BUILD_PYBIND} \ + -DGTSAM_TYPEDEF_POINTS_TO_VECTORS=${TYPEDEF_POINTS_TO_VECTORS} \ -DGTSAM_PYTHON_VERSION=$PYTHON_VERSION \ - -DGTSAM_ALLOW_DEPRECATED_SINCE_V41=OFF \ + -DGTSAM_ALLOW_DEPRECATED_SINCE_V4=OFF \ + -DPYTHON_EXECUTABLE:FILEPATH=$(which $PYTHON) \ -DCMAKE_INSTALL_PREFIX=$CURRDIR/../gtsam_install make -j$(nproc) install -cd cython - -sudo $PYTHON setup.py install - -cd $CURRDIR/cython/gtsam/tests - -$PYTHON -m unittest discover \ No newline at end of file +case $WRAPPER in +"cython") + cd $CURRDIR/../gtsam_install/cython + $PYTHON setup.py install --user --prefix= + cd $CURRDIR/cython/gtsam/tests + $PYTHON -m unittest discover + ;; +"pybind") + $PYTHON setup.py install --user --prefix= + cd $CURRDIR/wrap/python/gtsam_py/tests + $PYTHON -m unittest discover + ;; +*) + echo "THIS SHOULD NEVER HAPPEN!" + exit 125 + ;; +esac diff --git a/.travis.sh b/.travis.sh index 35b964222..422f68065 100755 --- a/.travis.sh +++ b/.travis.sh @@ -4,17 +4,17 @@ function install_tbb() { TBB_BASEURL=https://github.com/oneapi-src/oneTBB/releases/download - TBB_VERSION=4.4.2 - TBB_DIR=tbb44_20151115oss + TBB_VERSION=4.4.5 + TBB_DIR=tbb44_20160526oss TBB_SAVEPATH="/tmp/tbb.tgz" - if [ "$TRAVIS_OS_NAME" == "linux" ]; then + if [ "$(uname)" == "Linux" ]; then OS_SHORT="lin" TBB_LIB_DIR="intel64/gcc4.4" SUDO="sudo" - elif [ "$TRAVIS_OS_NAME" == "osx" ]; then - OS_SHORT="lin" + elif [ "$(uname)" == "Darwin" ]; then + OS_SHORT="osx" TBB_LIB_DIR="" SUDO="" @@ -46,7 +46,7 @@ function configure() rm -fr $BUILD_DIR || true mkdir $BUILD_DIR && cd $BUILD_DIR - install_tbb + [ "${GTSAM_WITH_TBB:-OFF}" = "ON" ] && install_tbb if [ ! -z "$GCC_VERSION" ]; then export CC=gcc-$GCC_VERSION @@ -61,9 +61,9 @@ function configure() -DGTSAM_WITH_TBB=${GTSAM_WITH_TBB:-OFF} \ -DGTSAM_USE_QUATERNIONS=${GTSAM_USE_QUATERNIONS:-OFF} \ -DGTSAM_BUILD_EXAMPLES_ALWAYS=${GTSAM_BUILD_EXAMPLES_ALWAYS:-ON} \ - -DGTSAM_ALLOW_DEPRECATED_SINCE_V4=${GTSAM_ALLOW_DEPRECATED_SINCE_V41:-OFF} \ + -DGTSAM_ALLOW_DEPRECATED_SINCE_V4=${GTSAM_ALLOW_DEPRECATED_SINCE_V4:-OFF} \ -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \ - -DCMAKE_VERBOSE_MAKEFILE=OFF + -DCMAKE_VERBOSE_MAKEFILE=ON } From bb0de4f63b3aac40dd419f0c39c1b48cbf9ecc10 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Sat, 15 Aug 2020 11:51:56 -0400 Subject: [PATCH 06/29] switch to boost 1.69.0 --- .github/workflows/build-linux.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index f58fe5f37..eab879e2e 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -54,7 +54,7 @@ jobs: sudo apt-get -y update sudo apt-get -y upgrade - sudo apt install cmake g++-9 clang-9 build-essential pkg-config libpython-dev python-numpy libboost-all-dev + sudo apt install cmake g++-9 clang-9 build-essential pkg-config libpython-dev python-numpy if [ "${{ matrix.compiler }}" = "gcc" ]; then sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib @@ -64,6 +64,8 @@ jobs: sudo apt-get install -y clang-${{ matrix.version }} g++-multilib echo "::set-env name=CC::clang-${{ matrix.version }}" echo "::set-env name=CXX::clang++-${{ matrix.version }}" + echo "::set-env name=BOOST_ROOT:$BOOST_ROOT_1_69_0" + echo "BOOST_ROOT env set to $BOOST_ROOT" fi - name: Build (Linux) if: runner.os == 'Linux' From b3caa6de8363605dee4caf34dc7b54a392161b12 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Sat, 15 Aug 2020 12:06:07 -0400 Subject: [PATCH 07/29] typo --- .github/workflows/build-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index eab879e2e..fbf7d7cd1 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -64,7 +64,7 @@ jobs: sudo apt-get install -y clang-${{ matrix.version }} g++-multilib echo "::set-env name=CC::clang-${{ matrix.version }}" echo "::set-env name=CXX::clang++-${{ matrix.version }}" - echo "::set-env name=BOOST_ROOT:$BOOST_ROOT_1_69_0" + echo "::set-env name=BOOST_ROOT::$BOOST_ROOT_1_69_0" echo "BOOST_ROOT env set to $BOOST_ROOT" fi - name: Build (Linux) From 288195ba169456d9f5e89525f2554475b3cde231 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Sat, 15 Aug 2020 12:54:31 -0400 Subject: [PATCH 08/29] Add a display for current boost version --- .github/workflows/build-linux.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index fbf7d7cd1..837d0b174 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -56,6 +56,8 @@ jobs: sudo apt install cmake g++-9 clang-9 build-essential pkg-config libpython-dev python-numpy + echo "::set-env name=BOOST_ROOT::$(echo $BOOST_ROOT_1_69_0)" + if [ "${{ matrix.compiler }}" = "gcc" ]; then sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib echo "::set-env name=CC::gcc-${{ matrix.version }}" @@ -64,9 +66,11 @@ jobs: sudo apt-get install -y clang-${{ matrix.version }} g++-multilib echo "::set-env name=CC::clang-${{ matrix.version }}" echo "::set-env name=CXX::clang++-${{ matrix.version }}" - echo "::set-env name=BOOST_ROOT::$BOOST_ROOT_1_69_0" - echo "BOOST_ROOT env set to $BOOST_ROOT" fi + - name: Check Boost version + if: runner.os == 'Linux' + run: | + echo "BOOST_ROOT = $BOOST_ROOT" - name: Build (Linux) if: runner.os == 'Linux' run: | From b9f4f28e1aec4b4e1659785def4cbb7d7e931f86 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Sat, 15 Aug 2020 13:05:53 -0400 Subject: [PATCH 09/29] Manually specify BOOST_ROOT --- .travis.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.sh b/.travis.sh index 422f68065..c2b4e0590 100755 --- a/.travis.sh +++ b/.travis.sh @@ -64,6 +64,7 @@ function configure() -DGTSAM_ALLOW_DEPRECATED_SINCE_V4=${GTSAM_ALLOW_DEPRECATED_SINCE_V4:-OFF} \ -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \ -DCMAKE_VERBOSE_MAKEFILE=ON + -DBOOST_ROOT=$BOOST_ROOT } From bfae5561684de0a8c63ff56499f61e5fa868b237 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Sat, 15 Aug 2020 13:33:00 -0400 Subject: [PATCH 10/29] typo --- .travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.sh b/.travis.sh index c2b4e0590..7f5a58d0e 100755 --- a/.travis.sh +++ b/.travis.sh @@ -63,7 +63,7 @@ function configure() -DGTSAM_BUILD_EXAMPLES_ALWAYS=${GTSAM_BUILD_EXAMPLES_ALWAYS:-ON} \ -DGTSAM_ALLOW_DEPRECATED_SINCE_V4=${GTSAM_ALLOW_DEPRECATED_SINCE_V4:-OFF} \ -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \ - -DCMAKE_VERBOSE_MAKEFILE=ON + -DCMAKE_VERBOSE_MAKEFILE=ON \ -DBOOST_ROOT=$BOOST_ROOT } From 2d7fb05f6cf2bd944aee8afb8a067fcfb3af7caf Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Sat, 15 Aug 2020 13:54:02 -0400 Subject: [PATCH 11/29] Ignore system boost --- .travis.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.sh b/.travis.sh index 7f5a58d0e..c4ac675bd 100755 --- a/.travis.sh +++ b/.travis.sh @@ -64,7 +64,10 @@ function configure() -DGTSAM_ALLOW_DEPRECATED_SINCE_V4=${GTSAM_ALLOW_DEPRECATED_SINCE_V4:-OFF} \ -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \ -DCMAKE_VERBOSE_MAKEFILE=ON \ - -DBOOST_ROOT=$BOOST_ROOT + -DBOOST_ROOT=$BOOST_ROOT \ + -DBoost_NO_SYSTEM_PATHS=ON \ + -DBOOST_INCLUDEDIR="$BOOST_ROOT/boost/include" \ + -DBOOST_LIBRARYDIR="$BOOST_ROOT/lib" } From ae341c83a46508c92f24f0dcba6a798713df2d7b Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Sat, 15 Aug 2020 14:13:07 -0400 Subject: [PATCH 12/29] Fix wrong include path --- .travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.sh b/.travis.sh index c4ac675bd..6aa4c6da6 100755 --- a/.travis.sh +++ b/.travis.sh @@ -66,7 +66,7 @@ function configure() -DCMAKE_VERBOSE_MAKEFILE=ON \ -DBOOST_ROOT=$BOOST_ROOT \ -DBoost_NO_SYSTEM_PATHS=ON \ - -DBOOST_INCLUDEDIR="$BOOST_ROOT/boost/include" \ + -DBOOST_INCLUDEDIR="$BOOST_ROOT/include" \ -DBOOST_LIBRARYDIR="$BOOST_ROOT/lib" } From 799486b2f3d761e2cb991d377de5cb622f728f0d Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Sat, 15 Aug 2020 14:45:58 -0400 Subject: [PATCH 13/29] Do not search for the cmake boost file --- .travis.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.sh b/.travis.sh index 6aa4c6da6..eae460b2d 100755 --- a/.travis.sh +++ b/.travis.sh @@ -67,7 +67,8 @@ function configure() -DBOOST_ROOT=$BOOST_ROOT \ -DBoost_NO_SYSTEM_PATHS=ON \ -DBOOST_INCLUDEDIR="$BOOST_ROOT/include" \ - -DBOOST_LIBRARYDIR="$BOOST_ROOT/lib" + -DBOOST_LIBRARYDIR="$BOOST_ROOT/lib" \ + -DBoost_NO_BOOST_CMAKE=ON } From 7f7bf563f693f082a0d19ef7b6116ffd1084f97d Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Sat, 15 Aug 2020 15:28:56 -0400 Subject: [PATCH 14/29] Real reason why cannot find boost --- .travis.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.sh b/.travis.sh index eae460b2d..30713cac2 100755 --- a/.travis.sh +++ b/.travis.sh @@ -66,9 +66,7 @@ function configure() -DCMAKE_VERBOSE_MAKEFILE=ON \ -DBOOST_ROOT=$BOOST_ROOT \ -DBoost_NO_SYSTEM_PATHS=ON \ - -DBOOST_INCLUDEDIR="$BOOST_ROOT/include" \ - -DBOOST_LIBRARYDIR="$BOOST_ROOT/lib" \ - -DBoost_NO_BOOST_CMAKE=ON + -DBoost_ARCHITECTURE=-x64 } From 635c6f89b05105a1160d81bb736e39218fbb3ee4 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 15 Aug 2020 15:44:22 -0500 Subject: [PATCH 15/29] renamed from build-cython to build-python --- .github/workflows/{build-cython.yml => build-python.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{build-cython.yml => build-python.yml} (98%) diff --git a/.github/workflows/build-cython.yml b/.github/workflows/build-python.yml similarity index 98% rename from .github/workflows/build-cython.yml rename to .github/workflows/build-python.yml index c159a60fc..497272411 100644 --- a/.github/workflows/build-cython.yml +++ b/.github/workflows/build-python.yml @@ -1,4 +1,4 @@ -name: Cython CI +name: Python CI on: [pull_request] From d9f5c1ebb7556da6b6ef8d0c40952a4b47207504 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 15 Aug 2020 15:50:10 -0500 Subject: [PATCH 16/29] remove travis.python.sh and instead add script in .github folder --- .../scripts/python.sh | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) rename .travis.python.sh => .github/scripts/python.sh (63%) diff --git a/.travis.python.sh b/.github/scripts/python.sh similarity index 63% rename from .travis.python.sh rename to .github/scripts/python.sh index 7ccf56dd1..70a5f46e4 100644 --- a/.travis.python.sh +++ b/.github/scripts/python.sh @@ -17,7 +17,7 @@ if [[ $(uname) == "Darwin" ]]; then brew install wget else # Install a system package required by our library - sudo apt-get install wget libicu-dev python3-pip python3-setuptools + sudo apt-get install -y wget libicu-dev python3-pip python3-setuptools fi PATH=$PATH:$($PYTHON -c "import site; print(site.USER_BASE)")/bin @@ -28,26 +28,26 @@ case $WRAPPER in BUILD_PYBIND="OFF" TYPEDEF_POINTS_TO_VECTORS="OFF" - $PYTHON -m pip install --user -r ./cython/requirements.txt + sudo $PYTHON -m pip install -r $GITHUB_WORKSPACE/cython/requirements.txt ;; "pybind") BUILD_CYTHON="OFF" BUILD_PYBIND="ON" TYPEDEF_POINTS_TO_VECTORS="ON" - $PYTHON -m pip install --user -r ./wrap/python/requirements.txt + sudo $PYTHON -m pip install -r $GITHUB_WORKSPACE/python/requirements.txt ;; *) exit 126 ;; esac -CURRDIR=$(pwd) +git submodule update --init --recursive -mkdir $CURRDIR/build -cd $CURRDIR/build +mkdir $GITHUB_WORKSPACE/build +cd $GITHUB_WORKSPACE/build -cmake $CURRDIR -DCMAKE_BUILD_TYPE=Release \ +cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release \ -DGTSAM_BUILD_TESTS=OFF -DGTSAM_BUILD_UNSTABLE=ON \ -DGTSAM_USE_QUATERNIONS=OFF \ -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF \ @@ -56,26 +56,34 @@ cmake $CURRDIR -DCMAKE_BUILD_TYPE=Release \ -DGTSAM_BUILD_PYTHON=${BUILD_PYBIND} \ -DGTSAM_TYPEDEF_POINTS_TO_VECTORS=${TYPEDEF_POINTS_TO_VECTORS} \ -DGTSAM_PYTHON_VERSION=$PYTHON_VERSION \ - -DGTSAM_ALLOW_DEPRECATED_SINCE_V4=OFF \ -DPYTHON_EXECUTABLE:FILEPATH=$(which $PYTHON) \ - -DCMAKE_INSTALL_PREFIX=$CURRDIR/../gtsam_install + -DGTSAM_ALLOW_DEPRECATED_SINCE_V41=OFF \ + -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/gtsam_install -make -j$(nproc) install +make -j$(nproc) install & + +while ps -p $! > /dev/null +do + sleep 60 + now=$(date +%s) + printf "%d seconds have elapsed\n" $(( (now - start) )) +done case $WRAPPER in "cython") - cd $CURRDIR/../gtsam_install/cython + cd $GITHUB_WORKSPACE/gtsam_install/cython $PYTHON setup.py install --user --prefix= - cd $CURRDIR/cython/gtsam/tests + cd $GITHUB_WORKSPACE/gtsam_install/cython/gtsam/tests $PYTHON -m unittest discover ;; "pybind") + cd python $PYTHON setup.py install --user --prefix= - cd $CURRDIR/wrap/python/gtsam_py/tests + cd $GITHUB_WORKSPACE/wrap/python/gtsam_py/tests $PYTHON -m unittest discover ;; *) echo "THIS SHOULD NEVER HAPPEN!" exit 125 ;; -esac +esac \ No newline at end of file From 0172cd3c8c7348abca9cc42b5d77da3da38adf34 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 15 Aug 2020 15:50:59 -0500 Subject: [PATCH 17/29] updates to python CI yml file --- .github/workflows/build-python.yml | 7 +++---- .github/workflows/build-windows.yml | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-python.yml b/.github/workflows/build-python.yml index 497272411..9edd1c24d 100644 --- a/.github/workflows/build-python.yml +++ b/.github/workflows/build-python.yml @@ -60,9 +60,8 @@ jobs: sudo add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main" fi sudo apt-get -y update - sudo apt-get -y upgrade - sudo apt install cmake g++-9 clang-9 build-essential pkg-config libpython-dev python-numpy libboost-all-dev + sudo apt install cmake build-essential pkg-config libpython-dev python-numpy libboost-all-dev if [ "${{ matrix.compiler }}" = "gcc" ]; then sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib @@ -89,8 +88,8 @@ jobs: - name: Build (Linux) if: runner.os == 'Linux' run: | - bash .travis.python.sh + bash .github/scripts/python.sh - name: Build (macOS) if: runner.os == 'macOS' run: | - bash .travis.python.sh \ No newline at end of file + bash .github/scripts/python.sh \ No newline at end of file diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 516e67e1d..f7c5dbcce 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -1,4 +1,4 @@ -name: CI Windows +name: Windows CI on: [pull_request] From 808c043e733f1691bf0b09336434649497868cdd Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 15 Aug 2020 16:01:24 -0500 Subject: [PATCH 18/29] moved CI script for unix based systems --- .travis.sh => .github/scripts/unix.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename .travis.sh => .github/scripts/unix.sh (92%) mode change 100755 => 100644 diff --git a/.travis.sh b/.github/scripts/unix.sh old mode 100755 new mode 100644 similarity index 92% rename from .travis.sh rename to .github/scripts/unix.sh index 30713cac2..4f6d926fb --- a/.travis.sh +++ b/.github/scripts/unix.sh @@ -25,7 +25,7 @@ function install_tbb() TBBROOT=/tmp/$TBB_DIR # Copy the needed files to the correct places. - # This works correctly for travis builds, instead of setting path variables. + # This works correctly for CI builds, instead of setting path variables. # This is what Homebrew does to install TBB on Macs $SUDO cp -R $TBBROOT/lib/$TBB_LIB_DIR/* /usr/local/lib/ $SUDO cp -R $TBBROOT/include/ /usr/local/include/ @@ -38,11 +38,11 @@ function configure() set -e # Make sure any error makes the script to return an error code set -x # echo - SOURCE_DIR=`pwd` - BUILD_DIR=build + SOURCE_DIR=$GITHUB_WORKSPACE + BUILD_DIR=$GITHUB_WORKSPACE/build #env - git clean -fd || true + git submodule update --init --recursive rm -fr $BUILD_DIR || true mkdir $BUILD_DIR && cd $BUILD_DIR @@ -61,7 +61,7 @@ function configure() -DGTSAM_WITH_TBB=${GTSAM_WITH_TBB:-OFF} \ -DGTSAM_USE_QUATERNIONS=${GTSAM_USE_QUATERNIONS:-OFF} \ -DGTSAM_BUILD_EXAMPLES_ALWAYS=${GTSAM_BUILD_EXAMPLES_ALWAYS:-ON} \ - -DGTSAM_ALLOW_DEPRECATED_SINCE_V4=${GTSAM_ALLOW_DEPRECATED_SINCE_V4:-OFF} \ + -DGTSAM_ALLOW_DEPRECATED_SINCE_V4=${GTSAM_ALLOW_DEPRECATED_SINCE_V41:-OFF} \ -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \ -DCMAKE_VERBOSE_MAKEFILE=ON \ -DBOOST_ROOT=$BOOST_ROOT \ @@ -114,4 +114,4 @@ case $1 in -t) test ;; -esac +esac \ No newline at end of file From 1e3ca015f0e7822e8c3c417a71651f04c204df93 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 15 Aug 2020 16:01:40 -0500 Subject: [PATCH 19/29] updates to macOS and Linux CIs --- .github/workflows/build-linux.yml | 5 ++--- .github/workflows/build-macos.yml | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 837d0b174..0ab87cbeb 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -52,9 +52,8 @@ jobs: sudo add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main" fi sudo apt-get -y update - sudo apt-get -y upgrade - sudo apt install cmake g++-9 clang-9 build-essential pkg-config libpython-dev python-numpy + sudo apt install cmake build-essential pkg-config libpython-dev python-numpy echo "::set-env name=BOOST_ROOT::$(echo $BOOST_ROOT_1_69_0)" @@ -74,4 +73,4 @@ jobs: - name: Build (Linux) if: runner.os == 'Linux' run: | - bash .travis.sh -t \ No newline at end of file + bash .github/scripts/nix.sh -t \ No newline at end of file diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 2ab2e63c5..2feb02eb5 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -1,4 +1,4 @@ -name: CI macOS +name: macOS CI on: [pull_request] @@ -48,4 +48,4 @@ jobs: - name: Build (macOS) if: runner.os == 'macOS' run: | - bash .travis.sh -t \ No newline at end of file + bash .github/scripts/nix.sh -t \ No newline at end of file From de2344fc2e97d87808365bdf3091953f33cf5f69 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 15 Aug 2020 16:03:44 -0500 Subject: [PATCH 20/29] fix script name --- .github/workflows/build-linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 0ab87cbeb..5b02cb254 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -1,4 +1,4 @@ -name: CI Linux +name: Linux CI on: [push, pull_request] @@ -73,4 +73,4 @@ jobs: - name: Build (Linux) if: runner.os == 'Linux' run: | - bash .github/scripts/nix.sh -t \ No newline at end of file + bash .github/scripts/unix.sh -t \ No newline at end of file From 7f0767e85fb149f14dc7f42d2b3e9cc391737838 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 15 Aug 2020 16:22:01 -0500 Subject: [PATCH 21/29] fix cython path --- .github/scripts/python.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/python.sh b/.github/scripts/python.sh index 70a5f46e4..4321f4c64 100644 --- a/.github/scripts/python.sh +++ b/.github/scripts/python.sh @@ -71,9 +71,9 @@ done case $WRAPPER in "cython") - cd $GITHUB_WORKSPACE/gtsam_install/cython + cd $GITHUB_WORKSPACE/build/cython $PYTHON setup.py install --user --prefix= - cd $GITHUB_WORKSPACE/gtsam_install/cython/gtsam/tests + cd $GITHUB_WORKSPACE/build/cython/gtsam/tests $PYTHON -m unittest discover ;; "pybind") From ba6b18947dfeda49071b7489424a62424f1c7b9d Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 15 Aug 2020 18:45:18 -0500 Subject: [PATCH 22/29] fix build script --- .github/workflows/build-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 2feb02eb5..1304d863e 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -48,4 +48,4 @@ jobs: - name: Build (macOS) if: runner.os == 'macOS' run: | - bash .github/scripts/nix.sh -t \ No newline at end of file + bash .github/scripts/unix.sh -t \ No newline at end of file From e04ef8494863143cce6d0d9f90ff5b70802b88ab Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 15 Aug 2020 18:45:31 -0500 Subject: [PATCH 23/29] set LD_LIBRARY_PATH --- .github/workflows/build-linux.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 5b02cb254..267d995f8 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -12,6 +12,8 @@ jobs: CTEST_PARALLEL_LEVEL: 2 CMAKE_BUILD_TYPE: ${{ matrix.build_type }} GTSAM_BUILD_UNSTABLE: ${{ matrix.build_unstable }} + LD_LIBRARY_PATH: /usr/local/lib + strategy: fail-fast: false matrix: From 5315e3ed35b819c30c8367d5fbba40f8f569a5ae Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 15 Aug 2020 19:26:36 -0500 Subject: [PATCH 24/29] test LD_LIBRARY_PATH --- .github/workflows/build-linux.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 267d995f8..bbdc22202 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -72,6 +72,8 @@ jobs: if: runner.os == 'Linux' run: | echo "BOOST_ROOT = $BOOST_ROOT" + echo "LD_LIBRARY_PATH = $LD_LIBRARY_PATH" + ls $LD_LIBRARY_PATH - name: Build (Linux) if: runner.os == 'Linux' run: | From 51b201988f77ac68ee943dbc0f187471779ea3b5 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 15 Aug 2020 20:20:31 -0500 Subject: [PATCH 25/29] correctly add LD_LIBRARY_PATH boost lib directory --- .github/workflows/build-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index bbdc22202..24a1a2c96 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -12,7 +12,6 @@ jobs: CTEST_PARALLEL_LEVEL: 2 CMAKE_BUILD_TYPE: ${{ matrix.build_type }} GTSAM_BUILD_UNSTABLE: ${{ matrix.build_unstable }} - LD_LIBRARY_PATH: /usr/local/lib strategy: fail-fast: false @@ -58,6 +57,7 @@ jobs: sudo apt install cmake build-essential pkg-config libpython-dev python-numpy echo "::set-env name=BOOST_ROOT::$(echo $BOOST_ROOT_1_69_0)" + echo "::set-env name=LD_LIBRARY_PATH::$(echo $BOOST_ROOT_1_69_0/lib)" if [ "${{ matrix.compiler }}" = "gcc" ]; then sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib From b23dd711b077529f969a10145e7c573b21566e67 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 15 Aug 2020 23:40:43 -0500 Subject: [PATCH 26/29] remove unnecessary prints --- .github/workflows/build-linux.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 24a1a2c96..4fac0f7cc 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -72,8 +72,6 @@ jobs: if: runner.os == 'Linux' run: | echo "BOOST_ROOT = $BOOST_ROOT" - echo "LD_LIBRARY_PATH = $LD_LIBRARY_PATH" - ls $LD_LIBRARY_PATH - name: Build (Linux) if: runner.os == 'Linux' run: | From a2e748130085afa30f51c1e4c00ee9f216402dc3 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sun, 16 Aug 2020 08:31:44 -0500 Subject: [PATCH 27/29] add description for CI scripts --- .github/scripts/python.sh | 7 ++++++- .github/scripts/unix.sh | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/scripts/python.sh b/.github/scripts/python.sh index 4321f4c64..5cc6ada24 100644 --- a/.github/scripts/python.sh +++ b/.github/scripts/python.sh @@ -1,4 +1,9 @@ #!/bin/bash + +########################################################## +# Build and test the GTSAM Python wrapper. +########################################################## + set -x -e if [ -z ${PYTHON_VERSION+x} ]; then @@ -77,7 +82,7 @@ case $WRAPPER in $PYTHON -m unittest discover ;; "pybind") - cd python + cd $GITHUB_WORKSPACE/python $PYTHON setup.py install --user --prefix= cd $GITHUB_WORKSPACE/wrap/python/gtsam_py/tests $PYTHON -m unittest discover diff --git a/.github/scripts/unix.sh b/.github/scripts/unix.sh index 4f6d926fb..aa6e49650 100644 --- a/.github/scripts/unix.sh +++ b/.github/scripts/unix.sh @@ -1,5 +1,10 @@ #!/bin/bash +########################################################## +# Build and test GTSAM for *nix based systems. +# Specifically Linux and macOS. +########################################################## + # install TBB with _debug.so files function install_tbb() { From 0d5ee3fbc6d6848884aaa83a9339973aca8b8adc Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Sun, 16 Aug 2020 19:50:01 -0400 Subject: [PATCH 28/29] Always build unstable --- .github/workflows/build-linux.yml | 4 ++-- .github/workflows/build-macos.yml | 4 ++-- .github/workflows/build-windows.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 4fac0f7cc..911bec59c 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: build: - name: ${{ matrix.name }} ${{ matrix.build_type }} ${{ matrix.build_unstable }} + name: ${{ matrix.name }} ${{ matrix.build_type }} runs-on: ${{ matrix.os }} env: @@ -25,7 +25,7 @@ jobs: ] build_type: [Debug, Release] - build_unstable: [ON, OFF] + build_unstable: [ON] include: - name: ubuntu-18.04-gcc-5 os: ubuntu-18.04 diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 1304d863e..55d9071ef 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -4,7 +4,7 @@ on: [pull_request] jobs: build: - name: ${{ matrix.name }} ${{ matrix.build_type }} ${{ matrix.build_unstable }} + name: ${{ matrix.name }} ${{ matrix.build_type }} runs-on: ${{ matrix.os }} env: @@ -22,7 +22,7 @@ jobs: ] build_type: [Debug, Release] - build_unstable: [ON, OFF] + build_unstable: [ON] include: - name: macOS-10.15-xcode-11.3.1 os: macOS-10.15 diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index f7c5dbcce..b3150a751 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -4,7 +4,7 @@ on: [pull_request] jobs: build: - name: ${{ matrix.name }} ${{ matrix.build_type }} ${{ matrix.build_unstable }} + name: ${{ matrix.name }} ${{ matrix.build_type }} runs-on: ${{ matrix.os }} env: @@ -23,7 +23,7 @@ jobs: ] build_type: [Debug, Release] - build_unstable: [ON, OFF] + build_unstable: [ON] include: - name: windows-2016-cl os: windows-2016 From 84049ebecffcd334a97cedf9479fe8afc2f50f46 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Sun, 16 Aug 2020 20:02:35 -0400 Subject: [PATCH 29/29] Add Python to the name of CI --- .github/workflows/build-python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-python.yml b/.github/workflows/build-python.yml index 9edd1c24d..0b4a7f12f 100644 --- a/.github/workflows/build-python.yml +++ b/.github/workflows/build-python.yml @@ -4,7 +4,7 @@ on: [pull_request] jobs: build: - name: ${{ matrix.name }} ${{ matrix.build_type }} ${{ matrix.python_version }} + name: ${{ matrix.name }} ${{ matrix.build_type }} Python ${{ matrix.python_version }} runs-on: ${{ matrix.os }} env: