diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..fabde25 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,74 @@ +name: CI + +on: + push: + branches: "*" + pull_request: + branches: main + +jobs: + linux: + name: ${{ matrix.python-version }}-posix + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + fail-fast: false + max-parallel: 5 + matrix: + python-version: ['3.11'] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Miniconda + uses: mamba-org/setup-micromamba@v1 + with: + cache-downloads: true + condarc: | + channels: + - conda-forge + create-args: | + python=${{ matrix.python-version }} + environment-name: FES + environment-file: conda/environment.yml + + - name: Compile and Testing Python Package + shell: bash -l {0} + run: | + python setup.py build + pytest -v -ra --processes + + - name: Build C++ Library and Testing + shell: bash -l {0} + run: | + mkdir build + cd build + cmake .. -DFES_ENABLE_TEST=ON + make + ctest + + win: + name: win + runs-on: windows-2019 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Miniconda + uses: mamba-org/setup-micromamba@v1 + with: + cache-downloads: true + condarc: | + channels: + - conda-forge + create-args: | + python=3.11 + environment-name: FES + environment-file: conda/environment.yml + + - name: Building Testing Python Package + shell: bash -l {0} + run: | + python setup.py build + pytest -v -ra --processes diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml deleted file mode 100644 index 71852be..0000000 --- a/.github/workflows/cmake.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: CMake - -on: - push: - branches: [ main, develop] - pull_request: - branches: [ main, develop ] - -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - -jobs: - build: - runs-on: ubuntu:24.04 - - steps: - - uses: actions/checkout@v2 - - - name: Install prerequisite - run: DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC sudo apt install cmake python3 python3-dev python3-setuptools python3-setuptools-scm python3-pytest python3-yaml python3-numpy python3-netcdf4 git git-lfs g++ libboost-dev libeigen3-dev libopenblas-dev libgtest-dev -q -y - - - name: Initialize the submodules - run: git submodule update --init --recursive - - - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DFES_ENABLE_TESTS=ON - - - name: Build Library And Tests - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Running Tests - working-directory: ${{github.workspace}}/build - run: ctest -C ${{env.BUILD_TYPE}} - - - name: Build Python Bindings - working-directory: ${{github.workspace}} - run: python3 setup.py build && pytest -vv diff --git a/conda/environment.yml b/conda/environment.yml index dede424..ed43701 100644 --- a/conda/environment.yml +++ b/conda/environment.yml @@ -3,5 +3,16 @@ channels: - conda-forge - defaults dependencies: - - boa - - anaconda-client + - cmake + - eigen + - setuptools_scm + - netcdf4 + - pytest + - boost-cpp + - git + - git-lfs + - gxx + - make # [not win] + - binutils # [not win] + - pyyaml + - gtest diff --git a/setup.py b/setup.py index f0bd0a0..014f03e 100755 --- a/setup.py +++ b/setup.py @@ -11,6 +11,7 @@ import re import sys import sysconfig +import warnings import setuptools import setuptools.command.build_ext @@ -49,7 +50,13 @@ def version() -> str: # otherwise setuptools_scm will not be able to find the version number. os.chdir(WORKING_DIRECTORY) import setuptools_scm - return setuptools_scm.get_version() + try: + return setuptools_scm.get_version() + except: # noqa: E722 + warnings.warn( + 'Unable to find the version number with setuptools_scm.', + RuntimeWarning) + return '0.0.0' with path.open() as stream: for line in stream: if line.startswith('__version__'):