From 27376e787517f11b9c0cddb717aabf99b3affff5 Mon Sep 17 00:00:00 2001 From: larsevj Date: Fri, 28 Jun 2024 13:56:58 +0200 Subject: [PATCH] Try more --- .github/workflows/style.yml | 2 +- .github/workflows/testing.yml | 54 ++++++++++++++++++++++++++++------- .github/workflows/windows.yml | 8 +++--- CMakeLists.txt | 6 +++- VisualStudio/stdbool.h | 26 ----------------- lib/include/ert/stdbool.h | 26 ----------------- 6 files changed, 54 insertions(+), 68 deletions(-) delete mode 100644 VisualStudio/stdbool.h delete mode 100644 lib/include/ert/stdbool.h diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index cd43adbbe8..0dbb6e2699 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -9,7 +9,7 @@ jobs: runs-on: "ubuntu-latest" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: | diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index a922211e2e..d34a48cc41 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -63,7 +63,7 @@ jobs: strategy: fail-fast: false matrix: - os: ['ubuntu-latest', 'macos-13', 'macos-latest'] + os: ['ubuntu-latest', 'macos-13', 'macos-latest', "windows-2019"] python: ['3.8', '3.9', '3.10', '3.11', '3.12'] exclude: - os: macos-latest @@ -74,37 +74,51 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: # required for `git describe --tags` to work fetch-depth: 0 - name: Build Linux Wheel + if: matrix.os == 'ubuntu-latest' uses: docker://quay.io/pypa/manylinux2014_x86_64 with: entrypoint: /github/workspace/ci/github/build_linux_wheel.sh args: ${{ matrix.python }} - if: matrix.os == 'ubuntu-latest' - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - - name: Build macOS/Windows Wheel + - name: Build macOS Wheel + if: runner.os == 'macOS' run: pip wheel . --no-deps -w dist - if: matrix.os != 'ubuntu-latest' + + - name: Build Windows Wheel + if: runner.os == 'windows' + run: | + python.exe -m pip install -U pip delvewheel + python.exe -m pip wheel . --no-deps -w dist - name: Upload wheel as artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.os }} Python ${{ matrix.python }} wheel path: dist/* - - name: Install + - name: Install for non Windows + if: runner.os != 'windows' run: pip install dist/* - - name: Run Python tests + - name: Install for Windows + if: runner.os == 'windows' + run: | + pip install (get-item .\dist\*) + python -c "import resdata" + + - name: Run Python tests non Windows + if: runner.os != 'windows' run: | # Runs tests on installed distribution from an empty directory python -m pip install pytest @@ -128,6 +142,26 @@ jobs: # Run tests python -m pytest python/tests + - name: Run Python tests Windows + if: runner.os == 'windows' + run: | + # Install pytest + python -m pip install pytest + + # Create a new directory for the tests to ensure we import the installed package + New-Item -ItemType Directory -Force -Path test-run + cd test-run + Copy-Item -Recurse ..\python\tests -Destination .\python\ + dir + dir python + + # Set environment variables + $env:RD_SKIP_SIGNAL = "1" + $env:ERT_SHOW_BACKTRACE = "1" + + # Run the tests + python -m pytest python\tests + publish: name: Publish to PyPI @@ -139,7 +173,7 @@ jobs: steps: - name: Get wheels - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: path: artifacts diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 613581b8d9..8aed2b66c0 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -36,12 +36,12 @@ jobs: - name: Install dependencies run: | - pip install -U pip - pip install "conan<2" + python.exe -m pip install --upgrade pip + python.exe -m pip install "conan<2" - name: Build ResData run: | - python3 -m pip install -r requirements.txt + python.exe -m pip install -r requirements.txt mkdir cmake-build - cmake -S . -B cmake-build -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS="ON" -DBUILD_TESTING=OFF + cmake -S . -B cmake-build -G "Visual Studio 16 2019" cmake --build cmake-build diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b2852ef64..773bd6328f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) include(GNUInstallDirs) include(TestBigEndian) -option(BUILD_TESTS "Should the tests be built" ON) +if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + option(BUILD_TESTS "Should the tests be built" OFF) +else() + option(BUILD_TESTS "Should the tests be built" ON) +endif() option(BUILD_APPLICATIONS "Should we build small utility applications" OFF) option(BUILD_RD_SUMMARY "Build the commandline application rd_summary" OFF) option(BUILD_SHARED_LIBS "Build shared libraries" ON) diff --git a/VisualStudio/stdbool.h b/VisualStudio/stdbool.h deleted file mode 100644 index c599cf5cbd..0000000000 --- a/VisualStudio/stdbool.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - The ert code is based on C99, and in particular makes extensive use - of the C99 feature stdbool.h. When including the ert headers in a - VisualStudio C++ project this creates problems because the - VisualStudio C compiler is not C99 conforming, and the compiler will - complain it can not find the stdbool.h header. - - The symbols defined in the stdbool header are actually correctly(?) - defined by the VisualStudio compiler already, so this header file - does not define any bool related symbols! - - To actually use this file you should copy it manually into the ert - include directory as used by VisualStudio. -*/ - -#ifndef ERT_STDBOOL_H -#define ERT_STDBOOL_H - -#ifndef __cplusplus -typedef int bool; -#define true 1 -#define false 0 -#endif - - -#endif diff --git a/lib/include/ert/stdbool.h b/lib/include/ert/stdbool.h deleted file mode 100644 index c599cf5cbd..0000000000 --- a/lib/include/ert/stdbool.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - The ert code is based on C99, and in particular makes extensive use - of the C99 feature stdbool.h. When including the ert headers in a - VisualStudio C++ project this creates problems because the - VisualStudio C compiler is not C99 conforming, and the compiler will - complain it can not find the stdbool.h header. - - The symbols defined in the stdbool header are actually correctly(?) - defined by the VisualStudio compiler already, so this header file - does not define any bool related symbols! - - To actually use this file you should copy it manually into the ert - include directory as used by VisualStudio. -*/ - -#ifndef ERT_STDBOOL_H -#define ERT_STDBOOL_H - -#ifndef __cplusplus -typedef int bool; -#define true 1 -#define false 0 -#endif - - -#endif