From 904fa0dea373814eef94c8977104cfd2851ea35b Mon Sep 17 00:00:00 2001 From: Tom de Geus Date: Mon, 28 Mar 2022 14:27:45 +0200 Subject: [PATCH 1/2] Trying MSVS 2019 --- .appveyor.yml | 2 +- .../azure-pipelines-linux-clang.yml | 38 ----------- .../azure-pipelines-linux-gcc.yml | 33 --------- .azure-pipelines/azure-pipelines-osx.yml | 28 -------- .azure-pipelines/unix-build.yml | 68 ------------------- azure-pipelines.yml | 8 --- 6 files changed, 1 insertion(+), 176 deletions(-) delete mode 100644 .azure-pipelines/azure-pipelines-linux-clang.yml delete mode 100644 .azure-pipelines/azure-pipelines-linux-gcc.yml delete mode 100644 .azure-pipelines/azure-pipelines-osx.yml delete mode 100644 .azure-pipelines/unix-build.yml delete mode 100644 azure-pipelines.yml diff --git a/.appveyor.yml b/.appveyor.yml index 91cebe4..66c8021 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,6 +1,6 @@ build: false -os: Visual Studio 2015 +os: Visual Studio 2019 platform: - x64 diff --git a/.azure-pipelines/azure-pipelines-linux-clang.yml b/.azure-pipelines/azure-pipelines-linux-clang.yml deleted file mode 100644 index 87d7592..0000000 --- a/.azure-pipelines/azure-pipelines-linux-clang.yml +++ /dev/null @@ -1,38 +0,0 @@ -jobs: - - job: 'Linux_0' - strategy: - matrix: - clang_6: - llvm_version: '6.0' - clang_7: - llvm_version: '7' - clang_8: - llvm_version: '8' - clang_9: - llvm_version: '9' - pool: - vmImage: ubuntu-18.04 - variables: - CC: clang-$(llvm_version) - CXX: clang++-$(llvm_version) - timeoutInMinutes: 360 - steps: - - - script: | - sudo add-apt-repository ppa:ubuntu-toolchain-r/test - if [[ $(llvm_version) == '4.0' || $(llvm_version) == '5.0' ]]; then - sudo apt-get update - sudo apt-get --no-install-suggests --no-install-recommends install gcc-4.9 clang-$(llvm_version) - else - LLVM_VERSION=$(llvm_version) - get -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-$LLVM_VERSION main" - sudo apt-get update - sudo apt-get --no-install-suggests --no-install-recommends install clang-$(llvm_version) - fi - displayName: Install build toolchain - - - bash: echo "##vso[task.prependpath]$CONDA/bin" - displayName: Add conda to PATH - - - template: unix-build.yml diff --git a/.azure-pipelines/azure-pipelines-linux-gcc.yml b/.azure-pipelines/azure-pipelines-linux-gcc.yml deleted file mode 100644 index e0a6aa0..0000000 --- a/.azure-pipelines/azure-pipelines-linux-gcc.yml +++ /dev/null @@ -1,33 +0,0 @@ -jobs: - - job: 'Linux_1' - strategy: - matrix: - gcc_6: - gcc_version: '6' - gcc_7: - gcc_version: '7' - gcc_8: - gcc_version: '8' - gcc_9: - gcc_version: '9' - pool: - vmImage: ubuntu-18.04 - variables: - CC: gcc-$(gcc_version) - CXX: g++-$(gcc_version) - timeoutInMinutes: 360 - steps: - - - script: | - if [[ $(gcc_version) == '4.9' || $(gcc_version) == '6' || $(gcc_version) == '7' || $(gcc_version) == '8' ]]; then - sudo add-apt-repository ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get --no-install-suggests --no-install-recommends install g++-$(gcc_version) - fi - displayName: Install build toolchain - - - bash: echo "##vso[task.prependpath]$CONDA/bin" - displayName: Add conda to PATH - - - template: unix-build.yml - diff --git a/.azure-pipelines/azure-pipelines-osx.yml b/.azure-pipelines/azure-pipelines-osx.yml deleted file mode 100644 index beeafce..0000000 --- a/.azure-pipelines/azure-pipelines-osx.yml +++ /dev/null @@ -1,28 +0,0 @@ -jobs: - - job: 'OSX' - strategy: - matrix: - macOS_10_15: - image_name: 'macOS-10.15' - macOS_11: - image_name: 'macOS-11' - pool: - vmImage: $(image_name) - variables: - CC: clang - CXX: clang++ - timeoutInMinutes: 360 - steps: - - script: | - echo "Removing homebrew for Azure to avoid conflicts with conda" - curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall > ~/uninstall_homebrew - chmod +x ~/uninstall_homebrew - ~/uninstall_homebrew -f -q - displayName: Remove homebrew - - - bash: | - echo "##vso[task.prependpath]$CONDA/bin" - sudo chown -R $USER $CONDA - displayName: Add conda to PATH - - - template: unix-build.yml diff --git a/.azure-pipelines/unix-build.yml b/.azure-pipelines/unix-build.yml deleted file mode 100644 index 97cb405..0000000 --- a/.azure-pipelines/unix-build.yml +++ /dev/null @@ -1,68 +0,0 @@ -steps: - - script: | - conda config --set always_yes yes --set changeps1 no - conda update -q conda - conda env create --file environment-dev.yml - source activate xtensor-python - displayName: Install dependencies - - - script: | - source activate xtensor-python - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DPYTHON_EXECUTABLE=`which python` -DDOWNLOAD_GTEST=ON $(Build.SourcesDirectory) - make install - displayName: Configure xtensor-python - workingDirectory: $(Build.BinariesDirectory) - - - script: | - source activate xtensor-python - make -j2 test_xtensor_python - displayName: Build xtensor-python - workingDirectory: $(Build.BinariesDirectory)/build - - - script: | - source activate xtensor-python - cd test - ./test_xtensor_python - displayName: Test xtensor-python (C++) - workingDirectory: $(Build.BinariesDirectory)/build/test - - - script: | - source activate xtensor-python - py.test -s - displayName: Test xtensor-python (Python) - workingDirectory: $(Build.SourcesDirectory) - - - script: | - source activate xtensor-python - cmake -Bbuild -DPython_EXECUTABLE=`which python` - cd build - cmake --build . - cp ../example.py . - python example.py - cd .. - displayName: Example - readme 1 - workingDirectory: $(Build.SourcesDirectory)/docs/source/examples/readme_example_1 - - - script: | - source activate xtensor-python - cmake -Bbuild -DPython_EXECUTABLE=`which python` - cd build - cmake --build . - cp ../example.py . - python example.py - cd .. - displayName: Example - Copy 'cast' - workingDirectory: $(Build.SourcesDirectory)/docs/source/examples/copy_cast - - - script: | - source activate xtensor-python - cmake -Bbuild -DPython_EXECUTABLE=`which python` - cd build - cmake --build . - cp ../example.py . - python example.py - cd .. - displayName: Example - SFINAE - workingDirectory: $(Build.SourcesDirectory)/docs/source/examples/sfinae diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index e930dbe..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,8 +0,0 @@ -trigger: - - master - -jobs: - - template: ./.azure-pipelines/azure-pipelines-linux-clang.yml - - template: ./.azure-pipelines/azure-pipelines-linux-gcc.yml - - template: ./.azure-pipelines/azure-pipelines-osx.yml - From 55205d1f163cd1146294eb2c3c5b9d920b9488a3 Mon Sep 17 00:00:00 2001 From: Tom de Geus Date: Mon, 28 Mar 2022 14:34:03 +0200 Subject: [PATCH 2/2] Adding test --- test_python/main.cpp | 6 ++++++ test_python/test_pyarray.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/test_python/main.cpp b/test_python/main.cpp index 5a5edfb..dce62b8 100644 --- a/test_python/main.cpp +++ b/test_python/main.cpp @@ -24,6 +24,11 @@ using complex_t = std::complex; // Examples +auto argmin(xt::pyarray& m) +{ + return xt::argmin(m); +} + double example1(xt::pyarray& m) { return m(0); @@ -291,6 +296,7 @@ PYBIND11_MODULE(xtensor_python_test, m) m.doc() = "Test module for xtensor python bindings"; + m.def("argmin", argmin); m.def("example1", example1); m.def("example2", example2); m.def("example3_xarray", example3_xarray); diff --git a/test_python/test_pyarray.py b/test_python/test_pyarray.py index c413002..455278d 100644 --- a/test_python/test_pyarray.py +++ b/test_python/test_pyarray.py @@ -27,6 +27,9 @@ class XtensorTest(TestCase): def test_rm(self): xt.test_rm(np.array([10], dtype=int)) + def test_argmin(self): + self.assertEqual(1, xt.argmin([7, 5, 6])) + def test_example1(self): self.assertEqual(4, xt.example1([4, 5, 6]))