diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml index 743e864c..b138120f 100644 --- a/.github/workflows/conda.yml +++ b/.github/workflows/conda.yml @@ -37,6 +37,37 @@ jobs: user: __token__ password: ${{ secrets.PYPI_UPLOAD }} packages_dir: dist + linux-unit-tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + environment: + # - "py310-pa14" + # - "py311-pa14" + - "py312-pa14" + # - "py310-pa15" + # - "py311-pa15" + # - "py312-pa15" + # - "py310-pa16" + # - "py311-pa16" + # - "py312-pa16" + - "py310-pa17" + # - "py311-pa17" + # - "py312-pa17" + steps: + - name: Checkout branch + uses: actions/checkout@v4 + - name: Set up pixi + uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659 + with: + environments: ${{ matrix.environment }} + - name: Build the wheel + run: pixi run -e ${{ matrix.environment }} meson setup -Dbuild_testing=true builddir . + - name: Build the wheel + run: pixi run -e ${{ matrix.environment }} ninja -C builddir + - name: Build the wheel + run: pixi run -e ${{ matrix.environment }} ninja -C builddir test linux-tests: runs-on: ubuntu-latest strategy: @@ -202,11 +233,6 @@ jobs: uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659 with: environments: ${{ matrix.environment }} - - run: pixi run -e ${{ matrix.environment }} meson setup builddir - - run: type builddir\meson-logs\meson-log.txt - if: always() - - run: pixi run -e ${{ matrix.environment }} ninja -C builddir - - run: pixi run -e ${{ matrix.environment }} ninja -C builddir test - name: Build wheel run: pixi run -e ${{ matrix.environment }} python -m build - name: Install wheel diff --git a/cpp/cpp_odbc/meson.build b/cpp/cpp_odbc/meson.build index 8d91a243..b817683c 100644 --- a/cpp/cpp_odbc/meson.build +++ b/cpp/cpp_odbc/meson.build @@ -31,29 +31,29 @@ cpp_odbc = static_library( include_directories: include_directories('Library'), ) -cpp_odbc_test_sources = [ - 'Test/cpp_odbc_test/level1_mock_api.cpp', - 'Test/cpp_odbc_test/level2_mock_api.cpp', -] - -cpp_odbc_tests = [ - 'column_description_test', - 'connection_test', - 'credentials_test', - 'environment_test', - 'error_test', - 'make_environment_test', - 'multi_value_buffer_test', - 'statement_test', -] -foreach t: cpp_odbc_tests - e = executable( - t, - cpp_odbc_test_sources + ['Test/tests/' + t + '.cpp'], - dependencies: deps + [gtest, gtest_main, gmock], - link_with: [cpp_odbc], - include_directories: include_directories('Library', 'Test'), - ) - test(t, e) -endforeach - +if build_testing + cpp_odbc_test_sources = [ + 'Test/cpp_odbc_test/level1_mock_api.cpp', + 'Test/cpp_odbc_test/level2_mock_api.cpp', + ] + cpp_odbc_tests = [ + 'column_description_test', + 'connection_test', + 'credentials_test', + 'environment_test', + 'error_test', + 'make_environment_test', + 'multi_value_buffer_test', + 'statement_test', + ] + foreach t: cpp_odbc_tests + e = executable( + t, + cpp_odbc_test_sources + ['Test/tests/' + t + '.cpp'], + dependencies: deps + [gtest, gtest_main, gmock], + link_with: [cpp_odbc], + include_directories: include_directories('Library', 'Test'), + ) + test(t, e) + endforeach +endif diff --git a/cpp/turbodbc/meson.build b/cpp/turbodbc/meson.build index 2da49df3..24729e44 100644 --- a/cpp/turbodbc/meson.build +++ b/cpp/turbodbc/meson.build @@ -44,56 +44,55 @@ turbodbc = static_library( ) -turbodbc_test_sources = [ - 'Test/tests/mock_classes.cpp', -] - -turbodbc_tests = [ - 'parameter_sets/bound_parameter_set_test', - 'parameter_sets/set_field_test', - 'descriptions/boolean_description_test', - 'descriptions/date_description_test', - 'descriptions/floating_point_description_test', - 'descriptions/integer_description_test', - 'descriptions/string_description_test', - 'descriptions/timestamp_description_test', - 'descriptions/unicode_description_test', - 'field_translators/boolean_translator_test', - 'field_translators/date_translator_test', - 'field_translators/float64_translator_test', - 'field_translators/int64_translator_test', - 'field_translators/string_translator_test', - 'field_translators/timestamp_translator_test', - 'result_sets/bound_result_set_test', - # 'result_sets/double_buffered_result_set_test', - 'result_sets/field_result_set_test', - 'result_sets/result_set_test', - 'result_sets/row_based_result_set_test', - 'buffer_size_test', - 'column_test', - 'command_test', - 'configuration_test', - 'connection_test', - 'description_test', - 'errors_test', - 'field_translator_test', - 'make_description_of_description_test', - 'make_description_of_type_test', - 'make_description_of_value_test', - 'make_field_translator_test', - 'parameter_test', - 'string_helpers_test', - 'time_helpers_test', -] - -foreach t: turbodbc_tests - e = executable( - t.replace('/', '_'), - turbodbc_test_sources + ['Test/tests/' + t + '.cpp'], - dependencies: [gtest, gtest_main, gmock], - link_with: [turbodbc], - include_directories: include_directories('Library', 'Test', '../cpp_odbc/Library'), - ) - test(t, e) -endforeach - +if build_testing + turbodbc_test_sources = [ + 'Test/tests/mock_classes.cpp', + ] + turbodbc_tests = [ + 'parameter_sets/bound_parameter_set_test', + 'parameter_sets/set_field_test', + 'descriptions/boolean_description_test', + 'descriptions/date_description_test', + 'descriptions/floating_point_description_test', + 'descriptions/integer_description_test', + 'descriptions/string_description_test', + 'descriptions/timestamp_description_test', + 'descriptions/unicode_description_test', + 'field_translators/boolean_translator_test', + 'field_translators/date_translator_test', + 'field_translators/float64_translator_test', + 'field_translators/int64_translator_test', + 'field_translators/string_translator_test', + 'field_translators/timestamp_translator_test', + 'result_sets/bound_result_set_test', + # 'result_sets/double_buffered_result_set_test', + 'result_sets/field_result_set_test', + 'result_sets/result_set_test', + 'result_sets/row_based_result_set_test', + 'buffer_size_test', + 'column_test', + 'command_test', + 'configuration_test', + 'connection_test', + 'description_test', + 'errors_test', + 'field_translator_test', + 'make_description_of_description_test', + 'make_description_of_type_test', + 'make_description_of_value_test', + 'make_field_translator_test', + 'parameter_test', + 'string_helpers_test', + 'time_helpers_test', + ] + foreach t: turbodbc_tests + e = executable( + t.replace('/', '_'), + turbodbc_test_sources + ['Test/tests/' + t + '.cpp'], + dependencies: [gtest, gtest_main, gmock], + link_with: [turbodbc], + include_directories: include_directories('Library', 'Test', '../cpp_odbc/Library'), + ) + test(t, e) + endforeach +endif diff --git a/cpp/turbodbc_arrow/meson.build b/cpp/turbodbc_arrow/meson.build index d92850c2..b3dbf65f 100644 --- a/cpp/turbodbc_arrow/meson.build +++ b/cpp/turbodbc_arrow/meson.build @@ -9,11 +9,13 @@ turbodbc_arrow = static_library( link_with: [turbodbc] ) -arrow_result_set_test = executable( - 'arrow_result_set_test', - ['Test/tests/arrow_result_set_test.cpp'], - dependencies: [py.dependency(embed: true), arrow, arrow_python, gtest, gtest_main, gmock], - link_with: [turbodbc_arrow], - include_directories: include_directories('Library', 'Test', '../cpp_odbc/Library', '../turbodbc/Library'), - ) -test('arrow_result_set_test', arrow_result_set_test) +if build_testing + arrow_result_set_test = executable( + 'arrow_result_set_test', + ['Test/tests/arrow_result_set_test.cpp'], + dependencies: [py.dependency(embed: true), arrow, arrow_python, gtest, gtest_main, gmock], + link_with: [turbodbc_arrow], + include_directories: include_directories('Library', 'Test', '../cpp_odbc/Library', '../turbodbc/Library'), + ) + test('arrow_result_set_test', arrow_result_set_test) +endif diff --git a/meson.build b/meson.build index f1c4501d..45ba8c6a 100644 --- a/meson.build +++ b/meson.build @@ -1,11 +1,12 @@ project( 'turbodbc', 'cpp', license: 'MIT', - meson_version: '>= 1.0.0', + meson_version: '>= 1.1.0', default_options: [ 'buildtype=release', 'cpp_std=c++17', 'warning_level=3', + 'build_testing=false', ] ) @@ -19,9 +20,12 @@ if target_machine.system() == 'windows' endif simdutf = dependency('simdutf') arrow = dependency('arrow') -gtest = dependency('gtest') -gtest_main = dependency('gtest_main') -gmock = dependency('gmock') +build_testing = get_option('build_testing') +if build_testing + gtest = dependency('gtest') + gtest_main = dependency('gtest_main') + gmock = dependency('gmock') +endif # unixodbc = dependency('unixodbc') py = import('python').find_installation() diff --git a/meson.options b/meson.options new file mode 100644 index 00000000..af16c802 --- /dev/null +++ b/meson.options @@ -0,0 +1 @@ +option('build_testing', type : 'boolean', value : false)