diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml new file mode 100644 index 000000000..aa023d9fb --- /dev/null +++ b/.github/workflows/test-linux.yml @@ -0,0 +1,112 @@ +name: test-linux + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + tests: + name: Test Compile ${{ matrix.compiler }} + runs-on: ubuntu-latest + env: + CC: ${{ matrix.compiler }} + + strategy: + matrix: + compiler: [clang, gcc] + + steps: + - uses: actions/checkout@v2.1.1 + + - name: Install Doxygen + run: sudo apt-get install doxygen graphviz + + - name: Configure build + run: cmake -Bbuild -DWARNINGS_AS_ERRORS=ON . + + - name: Formatting check + working-directory: build + run: | + clang-format-9 --version + make format + git diff --exit-code + + - name: Build + working-directory: build + run: make + + - name: binding-functions + working-directory: build + run: | + make binding-functions + test -s binding-functions + + - name: Tests + working-directory: build + run: | + make test + sudo make install + + # Note the packages aren't used to test the examples below + - name: Test packaging + working-directory: build + run: cpack -D CPACK_PACKAGE_CONTACT="Test build in CI" + + - name: Examples + run: | + mkdir build/examples + cd build/examples + cmake ../../examples + make + make test + + valgrind-tests: + name: Test Valgrind + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2.1.1 + + - name: Install Valgrind + run: sudo apt-get install valgrind + + - name: Configure build + run: cmake -Bbuild -DCMAKE_BUILD_TYPE=Debug -DWRAP_VALGRIND=ON . + + - name: Build + working-directory: build + run: make + + - name: Tests + working-directory: build + env: + CTEST_OUTPUT_ON_FAILURE: 1 + run: make test-fast + + coverage-tests: + name: Coverage + runs-on: ubuntu-latest + env: + CC: gcc + + steps: + - uses: actions/checkout@v2.1.1 + + - name: Install lcov + run: sudo apt-get install lcov + + - name: Configure build + run: cmake -DCMAKE_BUILD_TYPE=Debug -DWARNINGS_AS_ERRORS=ON -DH3_PREFIX=testprefix_ . + + - name: Build + run: make + + - name: Tests + run: make coverage + + - uses: coverallsapp/github-action@master + with: + path-to-lcov: ./coverage.cleaned.info + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml new file mode 100644 index 000000000..4474fab8c --- /dev/null +++ b/.github/workflows/test-macos.yml @@ -0,0 +1,42 @@ +name: test-macos + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + tests: + name: Test Compile ${{ matrix.compiler }} + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2.1.1 + + - name: Configure build + run: cmake -Bbuild -DWARNINGS_AS_ERRORS=ON . + + - name: Build + working-directory: build + run: make + + - name: binding-functions + working-directory: build + run: | + make binding-functions + test -s binding-functions + + - name: Tests + working-directory: build + run: | + make test + sudo make install + + - name: Examples + run: | + mkdir build/examples + cd build/examples + cmake ../../examples + make + make test diff --git a/.github/workflows/test-website.yml b/.github/workflows/test-website.yml new file mode 100644 index 000000000..2bb16fbec --- /dev/null +++ b/.github/workflows/test-website.yml @@ -0,0 +1,32 @@ +name: test-website + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + tests: + name: Test Website and FOSSA + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2.1.1 + + - uses: actions/setup-node@v1 + with: + node-version: 10.x + + - name: Install FOSSA + run: | + curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | sudo bash + + - name: Test Website Build + working-directory: website + run: | + yarn + yarn build + + - name: Submit FOSSA report + run: if [ -n "${{ secrets.FOSSA_API_KEY }}" ]; then fossa; fi diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml new file mode 100644 index 000000000..e7211cc84 --- /dev/null +++ b/.github/workflows/test-windows.yml @@ -0,0 +1,44 @@ +name: test-windows + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + tests: + name: Test Compile ${{ matrix.config }} ${{ matrix.arch }} + runs-on: windows-latest + env: + CC: cl.exe + CXX: cl.exe + + strategy: + matrix: + config: [Release, Debug] + arch: [Win32, x64] + + steps: + - uses: actions/checkout@v2.1.1 + + - name: Configure build + shell: cmd + run: cmake -Bbuild -A ${{ matrix.arch }} -DWARNINGS_AS_ERRORS=ON . + + - name: Build + working-directory: build + run: cmake --build . --config ${{ matrix.config }} + + - name: binding-functions + working-directory: build + run: | + cmake --build . --config ${{ matrix.config }} --target binding-functions + if ((Get-Item "binding-functions").Length -lt 10) { $host.SetShouldExit(1) } + + - name: Tests + working-directory: build + shell: cmd + env: + CTEST_OUTPUT_ON_FAILURE: 1 + run: ctest -C ${{ matrix.config }} diff --git a/.travis.yml b/.travis.yml index 3acc25265..5e9fbe939 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,20 +30,6 @@ addons: matrix: include: - # Check that clang-format doesn't detect some files are not formatted. - - name: "Formatting check" - compiler: clang - addons: - apt: - sources: - - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main' - key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' - packages: - - clang-format-9 - script: - - clang-format-9 --version - - make format - - git diff --exit-code # Submit coverage report to Coveralls.io, also test that prefixing works. - name: "Coverage report" compiler: gcc @@ -73,24 +59,6 @@ matrix: - yarn build - cd .. - 'if [ -n "$FOSSA_API_KEY" ]; then fossa; fi' - - name: "Valgrind test" - compiler: gcc - addons: - apt: - packages: - - valgrind - before_script: - - cmake -DCMAKE_BUILD_TYPE=Debug -DWRAP_VALGRIND=ON . - script: - - make - - CTEST_OUTPUT_ON_FAILURE=1 make test-fast - - name: "Mac OSX (Xcode 8)" - os: osx - - name: "binding-functions target" - script: - - make binding-functions - # Check that the file exists and has contents - - test -s binding-functions - name: "ARM64" arch: arm64 @@ -105,8 +73,6 @@ script: - make - make test - sudo make install - # Note the packages aren't used to test the examples below - - 'if [ "$TRAVIS_OS_NAME" = "linux" ]; then cpack -D CPACK_PACKAGE_CONTACT="Test build in CI"; fi' - mkdir examples - cd examples - cmake ../../examples diff --git a/CHANGELOG.md b/CHANGELOG.md index 24b7ab289..8414957f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ The public API of this library consists of the functions declared in file ## [Unreleased] ### Fixed - Fixed building the library with custom memory allocation functions on Mac OSX. (#362) +- The installed H3 CMake target should have include directories specified. (#381) +### Changed +- Tests now use `bash` on Windows. (#381) ## [3.6.4] - 2020-06-19 ### Added diff --git a/CMakeLists.txt b/CMakeLists.txt index aabe2f7dc..ed6c5195a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,8 @@ option(BUILD_FILTERS "Build filter applications." ON) option(BUILD_GENERATORS "Build code generation applications." ON) if(WIN32) - set(SHELL PowerShell -Command) + # Use bash (usually from Git for Windows) for piping results + set(SHELL bash -c) set(EXECUTABLE_OUTPUT_PATH bin) set(LIBRARY_OUTPUT_PATH bin) @@ -478,11 +479,7 @@ if(BUILD_TESTING) macro(add_h3_test_with_file name srcfile argfile) add_h3_test_common(${name} ${srcfile}) # add a special command (so we don't need to read the test file from the test program) - if(WIN32) - set(dump_command "Get-Content") - else() - set(dump_command "cat") - endif() + set(dump_command "cat") add_test(NAME ${name}_test${test_number} COMMAND ${SHELL} "${dump_command} ${argfile} | ${TEST_WRAPPER_STR} $") @@ -663,10 +660,11 @@ install( install( TARGETS h3 EXPORT "${TARGETS_EXPORT_NAME}" + COMPONENT libh3 LIBRARY DESTINATION "lib" ARCHIVE DESTINATION "lib" RUNTIME DESTINATION "bin" - COMPONENT libh3 + INCLUDES DESTINATION "${include_install_dir}" ) # Headers: diff --git a/README.md b/README.md index daa7b52a8..09a95091b 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,9 @@ # H3: A Hexagonal Hierarchical Geospatial Indexing System -[![Build Status](https://travis-ci.com/uber/h3.svg?branch=master)](https://travis-ci.com/uber/h3) -[![Build status](https://ci.appveyor.com/api/projects/status/61431y4sc5w0tsuk/branch/master?svg=true)](https://ci.appveyor.com/project/Uber/h3/branch/master) +[![test-linux](https://github.com/uber/h3/workflows/test-linux/badge.svg)](https://github.com/uber/h3/actions) +[![test-macos](https://github.com/uber/h3/workflows/test-macos/badge.svg)](https://github.com/uber/h3/actions) +[![test-windows](https://github.com/uber/h3/workflows/test-windows/badge.svg)](https://github.com/uber/h3/actions) [![Coverage Status](https://coveralls.io/repos/github/uber/h3/badge.svg?branch=master)](https://coveralls.io/github/uber/h3?branch=master) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 9b2d02ee4..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (c) 2014, Ruslan Baratov -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -environment: - matrix: - - GENERATOR: "Visual Studio 12" - CONFIG: Debug - - - GENERATOR: "Visual Studio 12" - CONFIG: Release - - - GENERATOR: "Visual Studio 12 Win64" - CONFIG: Debug - - - GENERATOR: "Visual Studio 12 Win64" - CONFIG: Release - -build_script: - - cmake "-G%GENERATOR%" -H. -Bbuild - - cmake --build build --config "%CONFIG%" - - cmake --build build --config "%CONFIG%" --target binding-functions - -test_script: - - ps: cd build - - ctest -C "%CONFIG%" - # Check that binding-functions was generated and has content - - ps: | - $ErrorActionPreference = "Stop" - if ((Get-Item "binding-functions").Length -lt 10) { $host.SetShouldExit(1) } diff --git a/dev-docs/build_windows.md b/dev-docs/build_windows.md index 8240239ad..d9a2fa162 100644 --- a/dev-docs/build_windows.md +++ b/dev-docs/build_windows.md @@ -10,9 +10,14 @@ cd build cmake .. ``` -You can now open `h3.sln` and build the `ALL_BUILD` project to build the H3 library, filter applications, and tests. Tests can be run by building the `RUN_TESTS` project. From the command line: +You can now open `h3.sln` and build the `ALL_BUILD` project to build the H3 library, filter applications, and tests. From the command line: ``` msbuild ALL_BUILD.vcxproj +``` + +Tests can be run by building the `RUN_TESTS` project. Tests require `bash` be available, which is usually supplied by Git for Windows. From the command line: + +``` msbuild RUN_TESTS.vcxproj ```