Merge pull request #62 from fastfloat/dlemire/test_installation

Testing installation in CI
This commit is contained in:
Daniel Lemire 2021-03-01 14:09:23 -05:00 committed by GitHub
commit f41410b91f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 26 deletions

View File

@ -15,20 +15,13 @@ jobs:
#- {cxx: , arch: -DCMAKE_CXX_FLAGS="-m32"} # default=gcc9
steps:
- uses: actions/checkout@v2
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.4
with:
cmake-version: '3.11.x'
#- name: install older compilers
# run: |
# sudo -E dpkg --add-architecture i386
# sudo -E apt-get update
# sudo -E apt-get install -y g++-8 g++-8-multilib g++-multilib linux-libc-dev:i386 libc6:i386 libc6-dev:i386 libc6-dbg:i386
- name: Prepare build dir
run: mkdir build
- name: Configure
run: cd build && cmake ${{matrix.cxx}} ${{matrix.arch}} -DFASTFLOAT_TEST=ON ..
- name: Build
run: cmake --build build
- name: Run basic tests
run: cd build && ctest --output-on-failure -R basictest
- name: Use cmake
run: |
mkdir build &&
cd build &&
cmake ${{matrix.cxx}} ${{matrix.arch}} -DFASTFLOAT_TEST=ON -DCMAKE_INSTALL_PREFIX:PATH=destination .. &&
cmake --build . &&
ctest --output-on-failure &&
cmake --install . &&
cd ../tests/installation_tests/find &&
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build .

View File

@ -15,13 +15,13 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v2
- name: Configure
- name: Use cmake
run: |
mkdir build
cd build && cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -DFASTFLOAT_TEST=ON ..
- name: Build
run: cmake --build build --config Release --parallel
- name: Run basic tests
run: |
cd build
ctest -C Release --output-on-failure -R basictest
mkdir build &&
cd build &&
cmake ${{matrix.cxx}} ${{matrix.arch}} -DFASTFLOAT_TEST=ON -DCMAKE_INSTALL_PREFIX:PATH=destination .. &&
cmake --build . &&
ctest --output-on-failure &&
cmake --install . &&
cd ../tests/installation_tests/find &&
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build .

View File

@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.15)
project(test_simdjson_install VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(FastFloat REQUIRED)
file(WRITE main.cpp "
#include \"fast_float/fast_float.h\"
#include <iostream>
int main() {
const std::string input = \"3.1416 xyz \";
double result;
auto answer = fast_float::from_chars(input.data(), input.data()+input.size(), result);
if(answer.ec != std::errc()) { std::cerr << \"parsing failure\\n\"; return EXIT_FAILURE; }
std::cout << \"parsed the number \" << result << std::endl;
return EXIT_SUCCESS;
}")
add_executable(repro main.cpp)
target_link_libraries(repro PUBLIC FastFloat::fast_float)